List of usage examples for com.google.common.collect ImmutableSet of
@SuppressWarnings("unchecked") public static <E> ImmutableSet<E> of(E e1, E e2)
From source file:com.spotify.heroic.aggregation.simple.SumInstance.java
@ConstructorProperties({ "size", "extent" }) public SumInstance(final long size, final long extent) { super(size, extent, ImmutableSet.of(MetricType.POINT, MetricType.SPREAD), MetricType.POINT); }
From source file:com.spotify.heroic.aggregation.simple.Sum2Instance.java
@ConstructorProperties({ "size", "extent" }) public Sum2Instance(final long size, final long extent) { super(size, extent, ImmutableSet.of(MetricType.POINT, MetricType.SPREAD), MetricType.POINT); }
From source file:com.spotify.heroic.aggregation.simple.SpreadInstance.java
@ConstructorProperties({ "size", "extent" }) public SpreadInstance(final long size, final long extent) { super(size, extent, ImmutableSet.of(MetricType.POINT, MetricType.SPREAD), MetricType.SPREAD); }
From source file:test.MultibindingProducerModule.java
@Produces(type = SET_VALUES)
ListenableFuture<Set<String>> futureStrs() {
return Futures.<Set<String>>immediateFuture(ImmutableSet.of("foo1", "foo2"));
}
From source file:de.digitalcollections.commons.springmvc.thymeleaf.SpacesDialect.java
@Override public Set<IProcessor> getProcessors(String dialectPrefix) { return ImmutableSet.of(new EmptyTextProcessor(templateMode, getDialectProcessorPrecedence()), new AttributesInnerWhitespacesProcessor(templateMode, getDialectProcessorPrecedence())); }
From source file:grakn.core.graql.gremlin.sets.NeqFragmentSet.java
@Override public final Set<Fragment> fragments() { return ImmutableSet.of(Fragments.neq(varProperty(), varA(), varB()), Fragments.neq(varProperty(), varB(), varA())); }
From source file:grakn.core.graql.gremlin.sets.RelatesFragmentSet.java
@Override public final Set<Fragment> fragments() { return ImmutableSet.of(Fragments.outRelates(varProperty(), relationType(), role()), Fragments.inRelates(varProperty(), role(), relationType())); }
From source file:org.apache.hadoop.hive.ql.io.AvroStorageFormatDescriptor.java
@Override public Set<String> getNames() { return ImmutableSet.of(IOConstants.AVRO, IOConstants.AVROFILE); }
From source file:grakn.core.graql.gremlin.sets.PlaysFragmentSet.java
@Override public final Set<Fragment> fragments() { return ImmutableSet.of(Fragments.outPlays(varProperty(), type(), role(), required()), Fragments.inPlays(varProperty(), role(), type(), required())); }
From source file:es.upm.oeg.tools.quality.ldsniffer.util.HistrogramInputDataGenerator.java
public static void histrogram(String SPARQLEndpoint, List<String> metrics) { int min = 100; int max = 0;//from w ww .java2 s . c om Map<String, Map<Integer, Long>> histrograms = new HashMap<>(); for (String metric : metrics) { Map<String, String> litMap = new HashMap<>(); Map<String, String> iriMap = ImmutableMap.of("metric", metric); String queryString = bindQueryString(HIST_QUERY_STRING, ImmutableMap.of(IRI_BINDINGS, iriMap, LITERAL_BINDINGS, litMap)); List<Map<String, RDFNode>> results = executeQueryForList(queryString, SPARQLEndpoint, ImmutableSet.of("valueInt", "count")); Map<Integer, Long> resultMap = new HashMap<>(); long sum = 0; long countTotal = 0; for (Map<String, RDFNode> result : results) { int value = result.get("valueInt").asLiteral().getInt(); long count = result.get("count").asLiteral().getLong(); resultMap.put(value, count); long subTotal = value * count; sum += subTotal; countTotal += count; //set min and max if (value < min) { min = value; } else if (value > max) { max = value; } } double average = ((double) (sum)) / countTotal; System.out.println(metric + " : total : " + sum); System.out.println(metric + " : count : " + countTotal); System.out.println(metric + " : abg : " + average); histrograms.put(metric, resultMap); } StringBuffer buffer = new StringBuffer(); buffer.append("data.addRows(["); for (int avgValue = min; avgValue < max; avgValue++) { long[] value = new long[metrics.size()]; for (int metricID = 0; metricID < metrics.size(); metricID++) { Map<Integer, Long> metricResultMap = histrograms.get(metrics.get(metricID)); value[metricID] = metricResultMap.containsKey(avgValue) ? metricResultMap.get(avgValue) : 0; } buffer.append("["); buffer.append(avgValue + ","); for (int metricID = 0; metricID < (metrics.size() - 1); metricID++) { buffer.append(value[metricID] + ","); } buffer.append(value[(metrics.size() - 1)] + "],"); buffer.append("\n"); } System.out.println(buffer.toString()); }