Example usage for com.google.common.collect ImmutableTable copyOf

List of usage examples for com.google.common.collect ImmutableTable copyOf

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableTable copyOf.

Prototype

public static <R, C, V> ImmutableTable<R, C, V> copyOf(Table<? extends R, ? extends C, ? extends V> table) 

Source Link

Document

Returns an immutable copy of the provided table.

Usage

From source file:com.google.gerrit.server.ReviewerSet.java

private ReviewerSet(Table<ReviewerStateInternal, Account.Id, Timestamp> table) {
    this.table = ImmutableTable.copyOf(table);
}

From source file:com.assylias.jbloomberg.ReferenceData.java

/**
 * The table contains one security per row, one field per column and the objects are the values of each combination
 * of security ID / field. Both the rows and columns are sorted in alphabetical order.
 *
 * @return an immutable copy of the whole table - the table can be empty
 *//*  w w w .  j  a va  2 s.c  om*/
public Table<String, String, TypedObject> get() {
    return ImmutableTable.copyOf(data);
}

From source file:com.assylias.jbloomberg.IntradayBarData.java

/**
 * The table contains one security per row, one field per column and the objects are the values of each combination
 * of security ID / field. Both the rows and columns are sorted in alphabetical order.
 *
 * @return an immutable copy of the whole table - the table can be empty
 */// w ww. j  a  v  a  2  s.com
public Table<LocalDateTime, IntradayBarField, TypedObject> get() {
    return ImmutableTable.copyOf(data);
}

From source file:com.opengamma.strata.report.cashflow.CashFlowReport.java

private CashFlowReport(LocalDate valuationDate, Instant runInstant, List<ExplainKey<?>> columnKeys,
        List<String> columnHeaders, Table<Integer, Integer, Object> data) {
    JodaBeanUtils.notNull(valuationDate, "valuationDate");
    JodaBeanUtils.notNull(runInstant, "runInstant");
    JodaBeanUtils.notNull(columnKeys, "columnKeys");
    JodaBeanUtils.notNull(columnHeaders, "columnHeaders");
    JodaBeanUtils.notNull(data, "data");
    this.valuationDate = valuationDate;
    this.runInstant = runInstant;
    this.columnKeys = ImmutableList.copyOf(columnKeys);
    this.columnHeaders = ImmutableList.copyOf(columnHeaders);
    this.data = ImmutableTable.copyOf(data);
}

From source file:com.opengamma.strata.report.trade.TradeReport.java

private TradeReport(LocalDate valuationDate, Instant runInstant, List<TradeReportColumn> columns,
        Table<Integer, Integer, Result<?>> data) {
    JodaBeanUtils.notNull(valuationDate, "valuationDate");
    JodaBeanUtils.notNull(runInstant, "runInstant");
    JodaBeanUtils.notNull(columns, "columns");
    JodaBeanUtils.notNull(data, "data");
    this.valuationDate = valuationDate;
    this.runInstant = runInstant;
    this.columns = ImmutableList.copyOf(columns);
    this.data = ImmutableTable.copyOf(data);
}

From source file:com.google.devtools.build.lib.packages.License.java

private static Table<DistributionType, LicenseType, Object> createLicenseIncompatibilitySet() {
    Table<DistributionType, LicenseType, Object> result = HashBasedTable.create();
    result.put(DistributionType.CLIENT, LicenseType.RESTRICTED, MARKER);
    result.put(DistributionType.EMBEDDED, LicenseType.RESTRICTED, MARKER);
    result.put(DistributionType.INTERNAL, LicenseType.BY_EXCEPTION_ONLY, MARKER);
    result.put(DistributionType.CLIENT, LicenseType.BY_EXCEPTION_ONLY, MARKER);
    result.put(DistributionType.WEB, LicenseType.BY_EXCEPTION_ONLY, MARKER);
    result.put(DistributionType.EMBEDDED, LicenseType.BY_EXCEPTION_ONLY, MARKER);
    return ImmutableTable.copyOf(result);
}

From source file:com.google.devtools.build.lib.packages.License.java

private static Table<DistributionType, LicenseType, Object> createLicenseWarningsSet() {
    Table<DistributionType, LicenseType, Object> result = HashBasedTable.create();
    result.put(DistributionType.CLIENT, LicenseType.RECIPROCAL, MARKER);
    result.put(DistributionType.EMBEDDED, LicenseType.RECIPROCAL, MARKER);
    result.put(DistributionType.CLIENT, LicenseType.NOTICE, MARKER);
    result.put(DistributionType.EMBEDDED, LicenseType.NOTICE, MARKER);
    return ImmutableTable.copyOf(result);
}

From source file:org.ambraproject.wombat.config.site.RequestMappingContextDictionary.java

private void buildAndFreeze() {
    /*/* w w w .ja v a 2  s .c  o  m*/
     * We permit a harmless race condition on the `if (!isFrozen)` block: if the first two calls to this method happen
     * concurrently, we might copy the builders more than once. This is safe because they will contain identical data.
     */
    if (!isFrozen) {
        synchronized (writeLock) {
            siteTable = ImmutableTable.copyOf(siteTableBuilder);
            globalTable = ImmutableMap.copyOf(globalTableBuilder);
            isFrozen = true;
        }
    }
}

From source file:org.joda.beans.gen.ImmAddress.java

private ImmAddress(int number, String street, String city, Number abstractNumber, byte[] data,
        String[][] array2d, ImmPerson owner, Object object1, Object object2, Risk risk, RiskLevel riskLevel,
        Set<RiskLevel> riskLevels, Serializable serializable, Map<String, Object> objectInMap,
        Map<String, List<String>> listInMap, Map<String, List<Integer>> listNumericInMap,
        Map<String, List<List<Integer>>> listInListInMap, Map<String, List<List<Object>>> objectListInListInMap,
        Map<ImmPerson, Map<String, ImmPerson>> mapInMap, Table<Integer, Integer, String> simpleTable,
        Table<Integer, Integer, ImmPerson> compoundTable, Grid<ImmPerson> sparseGrid, Grid<ImmPerson> denseGrid,
        Map<ImmPerson, ImmAddress> beanBeanMap) {
    JodaBeanUtils.notNull(street, "street");
    JodaBeanUtils.notNull(city, "city");
    JodaBeanUtils.notNull(owner, "owner");
    JodaBeanUtils.notNull(objectInMap, "objectInMap");
    JodaBeanUtils.notNull(listInMap, "listInMap");
    JodaBeanUtils.notNull(listNumericInMap, "listNumericInMap");
    JodaBeanUtils.notNull(listInListInMap, "listInListInMap");
    JodaBeanUtils.notNull(objectListInListInMap, "objectListInListInMap");
    JodaBeanUtils.notNull(mapInMap, "mapInMap");
    JodaBeanUtils.notNull(beanBeanMap, "beanBeanMap");
    this.number = number;
    this.street = street;
    this.city = city;
    this.abstractNumber = abstractNumber;
    this.data = (data != null ? data.clone() : null);
    this.array2d = array2d;
    this.owner = owner;
    this.object1 = object1;
    this.object2 = object2;
    this.risk = risk;
    this.riskLevel = riskLevel;
    this.riskLevels = (riskLevels != null ? EnumSet.copyOf(riskLevels) : null);
    this.serializable = serializable;
    this.objectInMap = ImmutableMap.copyOf(objectInMap);
    this.listInMap = ImmutableMap.copyOf(listInMap);
    this.listNumericInMap = ImmutableMap.copyOf(listNumericInMap);
    this.listInListInMap = ImmutableMap.copyOf(listInListInMap);
    this.objectListInListInMap = ImmutableMap.copyOf(objectListInListInMap);
    this.mapInMap = ImmutableMap.copyOf(mapInMap);
    this.simpleTable = (simpleTable != null ? ImmutableTable.copyOf(simpleTable) : null);
    this.compoundTable = (compoundTable != null ? ImmutableTable.copyOf(compoundTable) : null);
    this.sparseGrid = (sparseGrid != null ? ImmutableGrid.copyOf(sparseGrid) : null);
    this.denseGrid = (denseGrid != null ? ImmutableGrid.copyOf(denseGrid) : null);
    this.beanBeanMap = ImmutableMap.copyOf(beanBeanMap);
}

From source file:org.age.util.fsm.StateMachineServiceBuilder.java

/**
 * Builds the transitions table./*  www  . j a  v  a 2s  .  co m*/
 *
 * @return an immutable transitions table.
 */
@NonNull
Table<S, E, TransitionDescriptor<S, E>> buildTransitionsTable() {
    final EnumSet<S> allStates = EnumSet.allOf(stateClass);
    final EnumSet<E> allEvents = EnumSet.allOf(eventClass);
    final Table<S, E, TransitionDescriptor<S, E>> table = ArrayTable.create(allStates, allEvents);

    for (final S state : allStates) {
        for (final E event : allEvents) {
            table.put(state, event, TransitionDescriptor.nullDescriptor());
        }
    }

    for (final S state : allStates) {
        noStateTransitions.forEach((event, targetStates) -> {
            final TransitionDescriptor<S, E> descriptor = new TransitionDescriptor<>(state, event, targetStates,
                    noStateActions.get(event));
            table.put(state, event, descriptor);
        });
        transitions.row(state).forEach((event, targetStates) -> {
            if (isNull(targetStates)) {
                return;
            }
            final TransitionDescriptor<S, E> descriptor = new TransitionDescriptor<>(state, event, targetStates,
                    actions.get(state, event));
            table.put(state, event, descriptor);
        });
    }

    if (log.isDebugEnabled()) {
        table.values().forEach(descriptor -> {
            if (nonNull(descriptor.initial())) {
                log.debug("New transition: {}.", descriptor);
            }
        });
    }

    return ImmutableTable.copyOf(table);
}