List of usage examples for com.google.common.collect ImmutableTable.Builder put
@Deprecated @Override public final V put(R rowKey, C columnKey, V value)
From source file:org.apache.beam.runners.dataflow.worker.BeamFnMapTaskExecutorFactory.java
/** * Returns a table where the row key is the PTransform id, the column key is the side input id, * and the value is the corresponding PCollectionView. *//* ww w . j av a2 s.com*/ private static ImmutableTable<String, String, PCollectionView<?>> buildPTransformIdToSideInputIdToPCollectionView( RegisterRequestNode registerRequestNode) { ImmutableTable.Builder<String, String, PCollectionView<?>> ptransformIdToSideInputIdToPCollectionViewBuilder = ImmutableTable .builder(); for (Map.Entry<String, Iterable<PCollectionView<?>>> ptransformIdToPCollectionViews : registerRequestNode .getPTransformIdToPCollectionViewMap().entrySet()) { for (PCollectionView<?> pCollectionView : ptransformIdToPCollectionViews.getValue()) { ptransformIdToSideInputIdToPCollectionViewBuilder.put(ptransformIdToPCollectionViews.getKey(), pCollectionView.getTagInternal().getId(), pCollectionView); } } return ptransformIdToSideInputIdToPCollectionViewBuilder.build(); }
From source file:com.google.devtools.build.lib.skyframe.serialization.ImmutableTableCodec.java
@Override public ImmutableTable<R, C, V> deserialize(DeserializationContext context, CodedInputStream codedIn) throws SerializationException, IOException { int length = codedIn.readInt32(); if (length < 0) { throw new SerializationException("Expected non-negative length: " + length); }/*w w w .j a v a2 s.c om*/ ImmutableTable.Builder<R, C, V> builder = ImmutableTable.builder(); for (int i = 0; i < length; i++) { builder.put(/*rowKey=*/ context.deserialize(codedIn), /*columnKey=*/ context.deserialize(codedIn), /*value=*/ context.deserialize(codedIn)); } return builder.build(); }
From source file:com.proofpoint.discovery.ConfigStore.java
@Inject public ConfigStore(final ConfigStoreConfig config) { Multimap<TypeAndPool, Service> multimap = HashMultimap.create(); for (Entry<String, StaticAnnouncementConfig> entry : config.getAnnouncements().entrySet()) { Service service = new Service(Id.valueOf(UUID.nameUUIDFromBytes(entry.getKey().getBytes(UTF_8))), null, entry.getValue().getType(), entry.getValue().getPool(), "/somewhere/" + entry.getKey(), entry.getValue().getProperties()); multimap.put(/* w w w . j a v a 2 s. c om*/ new AutoValue_ConfigStore_TypeAndPool(entry.getValue().getType(), entry.getValue().getPool()), service); } ImmutableTable.Builder<String, String, Collection<Service>> builder = ImmutableTable.builder(); for (Entry<TypeAndPool, Collection<Service>> entry : multimap.asMap().entrySet()) { builder.put(entry.getKey().getType(), entry.getKey().getPool(), ImmutableList.copyOf(entry.getValue())); } table = builder.build(); }
From source file:de.fhg.igd.iva.explorer.main.CompareView.java
public CompareView(List<KnownColormap> colorMaps) { setLayout(new GridLayout(1, 0)); List<ColormapQuality> metrics = getMetrics(); ImmutableTable.Builder<KnownColormap, ColormapQuality, Double> builder = ImmutableTable.builder(); for (KnownColormap cm : colorMaps) { for (ColormapQuality metric : metrics) { builder.put(cm, metric, metric.getQuality(cm)); }/*from w w w . j av a2 s . co m*/ } Table<KnownColormap, ColormapQuality, Double> infoTable = builder.build(); add(new CompareViewPanel(infoTable)); add(new CompareViewPanel(infoTable)); add(new CompareViewPanel(infoTable)); }
From source file:uk.ac.open.kmi.iserve.discovery.api.impl.AbstractMatcher.java
/** * Perform a match between two Sets of URIs (from {@code origin} to {@code destination}) * and returns the result.//from w w w. j a v a 2 s . c o m * * @param origins Set of URIs of the elements to match * @param destinations Set of URIs of the elements to match against * @return a {@link com.google.common.collect.Table} with the result of the matching indexed by origin URI and then destination URI. */ @Override public Table<URI, URI, MatchResult> match(Set<URI> origins, Set<URI> destinations) { ImmutableTable.Builder<URI, URI, MatchResult> builder = ImmutableTable.builder(); for (URI origin : origins) { for (URI destination : destinations) { builder.put(origin, destination, this.match(origin, destination)); } } return builder.build(); }
From source file:foo.domaintest.config.ConfigModule.java
@Provides @Singleton/*from w w w . ja v a 2 s .c om*/ @EasterEggs @SuppressWarnings("unchecked") Table<String, String, String> provideEasterEggs() { ImmutableTable.Builder<String, String, String> table = new ImmutableTable.Builder<>(); for (Map<String, String> egg : ((List<Map<String, String>>) JSONValue .parse(Optional.fromNullable(System.getProperty("foo.domaintest.eastereggs")).or("[]")))) { table.put(egg.get("key"), egg.get("value"), egg.get("url")); } return table.build(); }
From source file:edu.mit.streamjit.impl.blob.DrainData.java
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject();/*from www .ja v a2 s . c o m*/ ImmutableMap<Integer, Map<String, Object>> map = (ImmutableMap<Integer, Map<String, Object>>) ois .readObject(); ImmutableTable.Builder<Integer, String, Object> builder = ImmutableTable.builder(); for (Map.Entry<Integer, Map<String, Object>> e1 : map.entrySet()) for (Map.Entry<String, Object> e2 : e1.getValue().entrySet()) builder.put(e1.getKey(), e2.getKey(), e2.getValue()); state = builder.build(); }
From source file:com.rackspacecloud.blueflood.cache.ConfigTtlProvider.java
private ConfigTtlProvider() { final Configuration config = Configuration.getInstance(); // String rollups stringTTL = new TimeValue(config.getIntegerProperty(TtlConfig.STRING_METRICS_TTL), TimeUnit.DAYS); ImmutableTable.Builder<Granularity, RollupType, TimeValue> ttlMapBuilder = new ImmutableTable.Builder<Granularity, RollupType, TimeValue>(); // Basic rollups ttlMapBuilder.put(Granularity.FULL, RollupType.BF_BASIC, new TimeValue(config.getIntegerProperty(TtlConfig.RAW_METRICS_TTL), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_5, RollupType.BF_BASIC, new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN5), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_20, RollupType.BF_BASIC, new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN20), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_60, RollupType.BF_BASIC, new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN60), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_240, RollupType.BF_BASIC, new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN240), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_1440, RollupType.BF_BASIC, new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN1440), TimeUnit.DAYS)); // Histogram rollups ttlMapBuilder.put(Granularity.MIN_5, RollupType.BF_HISTOGRAMS, new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN5), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_20, RollupType.BF_HISTOGRAMS, new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN20), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_60, RollupType.BF_HISTOGRAMS, new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN60), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_240, RollupType.BF_HISTOGRAMS, new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN240), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_1440, RollupType.BF_HISTOGRAMS, new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN1440), TimeUnit.DAYS)); /* Pre-aggregated rollups */ // Set rollups ttlMapBuilder.put(Granularity.FULL, RollupType.SET, new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_FULL), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_5, RollupType.SET, new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN5), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_20, RollupType.SET, new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN20), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_60, RollupType.SET, new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN60), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_240, RollupType.SET, new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN240), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_1440, RollupType.SET, new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN1440), TimeUnit.DAYS)); // Timer rollups ttlMapBuilder.put(Granularity.FULL, RollupType.TIMER, new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_FULL), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_5, RollupType.TIMER, new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN5), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_20, RollupType.TIMER, new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN20), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_60, RollupType.TIMER, new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN60), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_240, RollupType.TIMER, new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN240), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_1440, RollupType.TIMER, new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN1440), TimeUnit.DAYS)); // Gauge rollups ttlMapBuilder.put(Granularity.FULL, RollupType.GAUGE, new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_FULL), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_5, RollupType.GAUGE, new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN5), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_20, RollupType.GAUGE, new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN20), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_60, RollupType.GAUGE, new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN60), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_240, RollupType.GAUGE, new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN240), TimeUnit.DAYS)); ttlMapBuilder.put(Granularity.MIN_1440, RollupType.GAUGE, new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN1440), TimeUnit.DAYS)); this.ttlMapper = ttlMapBuilder.build(); }
From source file:org.apache.beam.runners.fnexecution.control.ProcessBundleDescriptors.java
private static Map<String, Map<String, SideInputSpec>> addSideInputs(ExecutableStage stage, Components.Builder components) throws IOException { ImmutableTable.Builder<String, String, SideInputSpec> idsToSpec = ImmutableTable.builder(); for (SideInputReference sideInputReference : stage.getSideInputs()) { // Update the coder specification for side inputs to be length prefixed so that the // SDK and Runner agree on how to encode/decode the key, window, and values for // side inputs. PCollectionNode pcNode = sideInputReference.collection(); PCollection pc = pcNode.getPCollection(); String lengthPrefixedCoderId = LengthPrefixUnknownCoders.addLengthPrefixedCoder(pc.getCoderId(), components, false);/*ww w . j a v a 2s. c o m*/ components.putPcollections(pcNode.getId(), pc.toBuilder().setCoderId(lengthPrefixedCoderId).build()); FullWindowedValueCoder<KV<?, ?>> coder = (FullWindowedValueCoder) WireCoders .instantiateRunnerWireCoder(pcNode, components.build()); idsToSpec.put(sideInputReference.transform().getId(), sideInputReference.localName(), SideInputSpec.of(sideInputReference.transform().getId(), sideInputReference.localName(), getAccessPattern(sideInputReference), coder.getValueCoder(), coder.getWindowCoder())); } return idsToSpec.build().rowMap(); }
From source file:org.dishevelled.analysis.AnalysisUtils.java
/** * Convert the specified graph to an immutable table. Note that only nodes with degree * of at least one will be present in the returned immutable table. * * @param <N> graph node type and immutable table row and column key type * @param <E> graph edge type and immutable table value type * @param graph graph to convert, must not be null * @return the specified graph converted to an immutable table *//*ww w .j a v a2s. c om*/ public static <N, E> ImmutableTable<N, N, E> toImmutableTable(final Graph<N, E> graph) { if (graph == null) { throw new IllegalArgumentException("graph must not be null"); } final ImmutableTable.Builder<N, N, E> builder = ImmutableTable.builder(); graph.forEachEdge(new UnaryProcedure<Edge<N, E>>() { @Override public void run(final Edge<N, E> edge) { // todo: provide "merge strategy" for multiple edges builder.put(edge.source().getValue(), edge.target().getValue(), edge.getValue()); } }); return builder.build(); }