當前位置: 首頁>>代碼示例>>Java>>正文


Java ImmutableTable.copyOf方法代碼示例

本文整理匯總了Java中com.google.common.collect.ImmutableTable.copyOf方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableTable.copyOf方法的具體用法?Java ImmutableTable.copyOf怎麽用?Java ImmutableTable.copyOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.ImmutableTable的用法示例。


在下文中一共展示了ImmutableTable.copyOf方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildPropertyValueTable

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public void buildPropertyValueTable(Map<Map<IProperty, Comparable>, BlockState.StateImplementation> map)
{
    if (this.propertyValueTable != null)
    {
        throw new IllegalStateException();
    }
    else
    {
        Table<IProperty, Comparable, IBlockState> table = HashBasedTable.<IProperty, Comparable, IBlockState>create();

        for (IProperty <? extends Comparable > iproperty : this.properties.keySet())
        {
            for (Comparable comparable : iproperty.getAllowedValues())
            {
                if (comparable != this.properties.get(iproperty))
                {
                    table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
                }
            }
        }

        this.propertyValueTable = ImmutableTable.<IProperty, Comparable, IBlockState>copyOf(table);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:BlockState.java

示例2: register

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public static void register(final Kryo kryo) {
  // register list
  final ImmutableListSerializer serializer = new ImmutableListSerializer();
  kryo.register(ImmutableList.class, serializer);
  kryo.register(ImmutableList.of().getClass(), serializer);
  kryo.register(ImmutableList.of(Integer.valueOf(1)).getClass(), serializer);
  kryo.register(ImmutableList.of(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)).subList(1, 2).getClass(), serializer);
  kryo.register(ImmutableList.of().reverse().getClass(), serializer);
  kryo.register(Lists.charactersOf("dremio").getClass(), serializer);

  final HashBasedTable baseTable = HashBasedTable.create();
  baseTable.put(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
  baseTable.put(Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6));
  ImmutableTable table = ImmutableTable.copyOf(baseTable);
  kryo.register(table.values().getClass(), serializer);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:17,代碼來源:ImmutableCollectionSerializers.java

示例3: buildPropertyValueTable

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public void buildPropertyValueTable(Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map)
{
    if (this.propertyValueTable != null)
    {
        throw new IllegalStateException();
    }
    else
    {
        Table < IProperty<?>, Comparable<?>, IBlockState > table = HashBasedTable. < IProperty<?>, Comparable<?>, IBlockState > create();

        for (Entry < IProperty<?>, Comparable<? >> entry : this.properties.entrySet())
        {
            IProperty<?> iproperty = (IProperty)entry.getKey();

            for (Comparable<?> comparable : iproperty.getAllowedValues())
            {
                if (comparable != entry.getValue())
                {
                    table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
                }
            }
        }

        this.propertyValueTable = ImmutableTable. < IProperty<?>, Comparable<?>, IBlockState > copyOf(table);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:BlockStateContainer.java

示例4: build

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
@Override
public ImmutableMarkovChain<S> build() {
    // todo: check if sum of transition probabilities in rows are <= 1
    for (final S state : table.rowKeySet()) {
        double sum = 0.0;
        for (final Double value : table.row(state).values()) {
            sum += value;
        }
        if (sum < 0 || sum > 1) {
            final String message = "Sum of transition probabilities from state "
                    + state + " must be in >= 0 and <= 1";
            throw new IllegalArgumentException(message);
        }
    }
    rng = RandomGenerators.rng();
    return new ImmutableMarkovChain<S>(ImmutableTable.copyOf(table), rng);
}
 
開發者ID:asoem,項目名稱:greyfish,代碼行數:18,代碼來源:ImmutableMarkovChain.java

示例5: CashFlowReport

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
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);
}
 
開發者ID:OpenGamma,項目名稱:Strata,代碼行數:18,代碼來源:CashFlowReport.java

示例6: a

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public void a(Map<Map<IBlockState<?>, Comparable<?>>, BlockStateList.BlockData> map) {
    if (this.c != null) {
        throw new IllegalStateException();
    } else {
        HashBasedTable hashbasedtable = HashBasedTable.create();
        Iterator iterator = this.b.entrySet().iterator();

        while (iterator.hasNext()) {
            Entry entry = (Entry) iterator.next();
            IBlockState iblockstate = (IBlockState) entry.getKey();
            Iterator iterator1 = iblockstate.c().iterator();

            while (iterator1.hasNext()) {
                Comparable comparable = (Comparable) iterator1.next();

                if (comparable != entry.getValue()) {
                    hashbasedtable.put(iblockstate, comparable, map.get(this.b(iblockstate, comparable)));
                }
            }
        }

        this.c = ImmutableTable.copyOf(hashbasedtable);
    }
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:25,代碼來源:BlockStateList.java

示例7: loadFromConfiguration

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public Table<String, String, Property> loadFromConfiguration(Configuration config) {
	final Table<String, String, Property> properties = HashBasedTable.create();
	for (Table.Cell<String, String, FeatureEntry> cell : features.cellSet()) {
		final FeatureEntry entry = cell.getValue();
		if (!entry.isConfigurable) continue;

		final String categoryName = cell.getRowKey();
		final String featureName = cell.getColumnKey();
		final Property prop = config.get(categoryName, featureName, entry.isEnabled);
		properties.put(categoryName, featureName, prop);
		if (!prop.wasRead()) continue;

		if (!prop.isBooleanValue()) prop.set(entry.isEnabled);
		else entry.isEnabled = prop.getBoolean(entry.isEnabled);
	}

	return ImmutableTable.copyOf(properties);
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:19,代碼來源:ConfigurableFeatureManager.java

示例8: buildPropertyValueTable

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public void buildPropertyValueTable(Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map)
{
    if (this.propertyValueTable != null)
    {
        throw new IllegalStateException();
    }
    else
    {
        Table < IProperty<?>, Comparable<?>, IBlockState > table = HashBasedTable. < IProperty<?>, Comparable<?>, IBlockState > create();
        UnmodifiableIterator unmodifiableiterator = this.properties.entrySet().iterator();

        while (unmodifiableiterator.hasNext())
        {
            Entry < IProperty<?>, Comparable<? >> entry = (Entry)unmodifiableiterator.next();
            IProperty<?> iproperty = (IProperty)entry.getKey();

            for (Comparable<?> comparable : iproperty.getAllowedValues())
            {
                if (comparable != entry.getValue())
                {
                    table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
                }
            }
        }

        this.propertyValueTable = ImmutableTable. < IProperty<?>, Comparable<?>, IBlockState > copyOf(table);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:29,代碼來源:BlockStateContainer.java

示例9: create

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public static NistInstance create(
        List<Integer> inputRow,
        Table<Integer, Integer, Integer> input,
        Integer output) {
    return new AutoValue_NistInstance(
            ImmutableList.copyOf(inputRow),
            ImmutableTable.copyOf(input),
            Preconditions.checkNotNull(output));
}
 
開發者ID:ksean,項目名稱:mnist-machine-learning,代碼行數:10,代碼來源:NistInstance.java

示例10: createLicenseIncompatibilitySet

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
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);
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:11,代碼來源:License.java

示例11: createLicenseWarningsSet

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
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);
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:9,代碼來源:License.java

示例12: registerSerializers

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
/**
 * Creates a new {@link ImmutableListSerializer} and registers its serializer for the several
 * ImmutableList related classes.
 *
 * @param kryo the {@link Kryo} instance to set the serializer on
 */
static void registerSerializers(Kryo kryo) {

  // ImmutableList (abstract class)
  //  +- RegularImmutableList
  //  |   RegularImmutableList
  //  +- SingletonImmutableList
  //  |   Optimized for List with only 1 element.
  //  +- SubList
  //  |   Representation for part of ImmutableList
  //  +- ReverseImmutableList
  //  |   For iterating in reverse order
  //  +- StringAsImmutableList
  //  |   Used by Lists#charactersOf
  //  +- Values (ImmutableTable values)
  //      Used by return value of #values() when there are multiple cells

  ImmutableListSerializer serializer = new ImmutableListSerializer();

  kryo.register(ImmutableList.class, serializer);

  // Note:
  //  Only registering above is good enough for serializing/deserializing.
  //  but if using Kryo#copy, following is required.

  kryo.register(ImmutableList.of().getClass(), serializer);
  kryo.register(ImmutableList.of(1).getClass(), serializer);
  kryo.register(ImmutableList.of(1, 2).getClass(), serializer);
  kryo.register(ImmutableList.of(1, 2, 3, 4).subList(1, 3).getClass(), serializer);
  kryo.register(ImmutableList.of(1, 2).reverse().getClass(), serializer);

  kryo.register(Lists.charactersOf("KryoRocks").getClass(), serializer);

  Table<Integer, Integer, Integer> baseTable = HashBasedTable.create();
  baseTable.put(1, 2, 3);
  baseTable.put(4, 5, 6);
  Table<Integer, Integer, Integer> table = ImmutableTable.copyOf(baseTable);
  kryo.register(table.values().getClass(), serializer);
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:45,代碼來源:ImmutableListSerializer.java

示例13: TradeReport

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
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);
}
 
開發者ID:OpenGamma,項目名稱:Strata,代碼行數:15,代碼來源:TradeReport.java

示例14: DrainData

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
public DrainData(Map<Token, ? extends List<Object>> data, Table<Integer, String, Object> state) {
	ImmutableMap.Builder<Token, ImmutableList<Object>> dataBuilder = ImmutableMap.builder();
	for (Map.Entry<Token, ? extends List<Object>> e : data.entrySet())
		dataBuilder.put(e.getKey(), ImmutableList.copyOf(e.getValue()));
	this.data = dataBuilder.build();
	this.state = ImmutableTable.copyOf(state);
}
 
開發者ID:jbosboom,項目名稱:streamjit,代碼行數:8,代碼來源:DrainData.java

示例15: registerSerializers

import com.google.common.collect.ImmutableTable; //導入方法依賴的package包/類
/**
 * Creates a new {@link ImmutableListSerializer} and registers its serializer
 * for the several ImmutableList related classes.
 *
 * @param kryo the {@link Kryo} instance to set the serializer on
 */
public static void registerSerializers(final Kryo kryo) {

    // ImmutableList (abstract class)
    //  +- RegularImmutableList
    //  |   RegularImmutableList
    //  +- SingletonImmutableList
    //  |   Optimized for List with only 1 element.
    //  +- SubList
    //  |   Representation for part of ImmutableList
    //  +- ReverseImmutableList
    //  |   For iterating in reverse order
    //  +- StringAsImmutableList
    //  |   Used by Lists#charactersOf
    //  +- Values (ImmutableTable values)
    //      Used by return value of #values() when there are multiple cells

    final ImmutableListSerializer serializer = new ImmutableListSerializer();

    kryo.register(ImmutableList.class, serializer);

    // Note:
    //  Only registering above is good enough for serializing/deserializing.
    //  but if using Kryo#copy, following is required.

    kryo.register(ImmutableList.of().getClass(), serializer);
    kryo.register(ImmutableList.of(1).getClass(), serializer);
    kryo.register(ImmutableList.of(1,2,3).subList(1, 2).getClass(), serializer);
    kryo.register(ImmutableList.of().reverse().getClass(), serializer);

    kryo.register(Lists.charactersOf("KryoRocks").getClass(), serializer);

    Table<Integer,Integer,Integer> baseTable = HashBasedTable.create();
    baseTable.put(1, 2, 3);
    baseTable.put(4, 5, 6);
    Table<Integer, Integer, Integer> table = ImmutableTable.copyOf(baseTable);
    kryo.register(table.values().getClass(), serializer);
}
 
開發者ID:gbif,項目名稱:checklistbank,代碼行數:44,代碼來源:ImmutableListSerializer.java


注:本文中的com.google.common.collect.ImmutableTable.copyOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。