本文整理匯總了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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}