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,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,IBlockState>copyOf(table);
}
}
项目:BaseClient
文件:BlockState.java
public void buildPropertyValueTable(Map<Map<IProperty,IBlockState>copyOf(table);
}
}
项目:url-classifier
文件:MediaTypeClassifierBuilder.java
MediaTypeClassifierImpl(Iterable<? extends MediaType> mts) {
Table<String,String,Set<MediaType>> typeTable =
HashBasedTable.<String,Set<MediaType>>create();
for (MediaType mt : mts) {
String type = mt.type();
String subtype = mt.subtype();
Set<MediaType> typeSet = typeTable.get(type,subtype);
if (typeSet == null) {
typeSet = Sets.newLinkedHashSet();
typeTable.put(type,subtype,typeSet);
}
typeSet.add(mt);
}
ImmutableTable.Builder<String,ImmutableSet<MediaType>> b =
ImmutableTable.builder();
for (Table.Cell<String,Set<MediaType>> cell
: typeTable.cellSet()) {
b.put(cell.getRowKey(),cell.getColumnKey(),ImmutableSet.copyOf(cell.getValue()));
}
this.types = b.build();
}
项目:dremio-oss
文件:ImmutableCollectionSerializers.java
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(3));
baseTable.put(Integer.valueOf(4),Integer.valueOf(5),Integer.valueOf(6));
ImmutableTable table = ImmutableTable.copyOf(baseTable);
kryo.register(table.values().getClass(),serializer);
}
项目:CustomWorldGen
文件:BlockStateContainer.java
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<?>,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)));
}
}
}
this.propertyValueTable = ImmutableTable. < IProperty<?>,IBlockState > copyOf(table);
}
}
项目:nomulus
文件:IcannReportingStager.java
/**
* Creates and stores reports of a given type on GCS.
*
* <p>This is factored out to facilitate choosing which reports to upload,*/
ImmutableList<String> stageReports(ReportType reportType) throws Exception {
QueryBuilder queryBuilder =
(reportType == ReportType.ACTIVITY) ? activityQueryBuilder : transactionsQueryBuilder;
ImmutableMap<String,String> viewQueryMap = queryBuilder.getViewQueryMap();
// Generate intermediary views
for (Entry<String,String> entry : viewQueryMap.entrySet()) {
createIntermediaryTableView(entry.getKey(),entry.getValue(),reportType);
}
// Get an in-memory table of the aggregate query's result
ImmutableTable<Integer,TableFieldSchema,Object> reportTable =
bigquery.queryToLocalTableSync(queryBuilder.getReportQuery());
// Get report headers from the table schema and convert into CSV format
String headerRow = constructrow(getHeaders(reportTable.columnKeySet()));
return (reportType == ReportType.ACTIVITY)
? stageActivityReports(headerRow,reportTable.rowMap().values())
: stageTransactionsReports(headerRow,reportTable.rowMap().values());
}
项目:nomulus
文件:ListObjectsAction.java
/**
* Returns a table of data for the given sets of fields and objects. The table is row-keyed by
* object and column-keyed by field,in the same iteration order as the provided sets.
*/
private ImmutableTable<T,String>
extractData(ImmutableSet<String> fields,ImmutableSet<T> objects) {
ImmutableTable.Builder<T,String> builder = new ImmutableTable.Builder<>();
for (T object : objects) {
Map<String,Object> fieldMap = new HashMap<>();
// Base case of the mapping is to use ImmutableObject's toDiffableFieldMap().
fieldMap.putAll(object.toDiffableFieldMap());
// Next,overlay any field-level overrides specified by the subclass.
fieldMap.putAll(getFieldOverrides(object));
// Next,add to the mapping all the aliases,with their values defined as whatever was in the
// map under the aliased field's original name.
fieldMap.putAll(new HashMap<>(Maps.transformValues(getFieldaliases(),fieldMap::get)));
Set<String> expectedFields = ImmutableSortedSet.copyOf(fieldMap.keySet());
for (String field : fields) {
checkArgument(fieldMap.containsKey(field),"Field '%s' not found - recognized fields are:\n%s",field,expectedFields);
builder.put(object,Objects.toString(fieldMap.get(field),""));
}
}
return builder.build();
}
项目:nomulus
文件:ListObjectsAction.java
/** Converts the provided table of data to text,formatted using the provided column widths. */
private List<String> generateFormattedData(
ImmutableTable<T,String> data,ImmutableMap<String,Integer> columnWidths) {
Function<Map<String,String>,String> rowFormatter = makeRowFormatter(columnWidths);
List<String> lines = new ArrayList<>();
if (isHeaderRowInUse(data)) {
// Add a row of headers (column names mapping to themselves).
Map<String,String> headerRow = Maps.asMap(data.columnKeySet(),key -> key);
lines.add(rowFormatter.apply(headerRow));
// Add a row of separator lines (column names mapping to '-' * column width).
Map<String,String> separatorRow =
Maps.transformValues(columnWidths,width -> Strings.repeat("-",width));
lines.add(rowFormatter.apply(separatorRow));
}
// Add the actual data rows.
for (Map<String,String> row : data.rowMap().values()) {
lines.add(rowFormatter.apply(row));
}
return lines;
}
项目:greyfish
文件:ImmutableMarkovChain.java
@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);
}
项目:gerrit
文件:ChangeField.java
public static ReviewerSet parseReviewerFieldValues(Iterable<String> values) {
ImmutableTable.Builder<ReviewerStateInternal,Account.Id,Timestamp> b =
ImmutableTable.builder();
for (String v : values) {
int f = v.indexOf(',');
if (f < 0) {
continue;
}
int l = v.lastIndexOf(',');
if (l == f) {
continue;
}
b.put(
ReviewerStateInternal.valueOf(v.substring(0,f)),Account.Id.parse(v.substring(f + 1,l)),new Timestamp(Long.valueOf(v.substring(l + 1,v.length()))));
}
return ReviewerSet.fromTable(b.build());
}
项目:gerrit
文件:ChangeField.java
public static ReviewerByEmailSet parseReviewerByEmailFieldValues(Iterable<String> values) {
ImmutableTable.Builder<ReviewerStateInternal,Address,Timestamp> b = ImmutableTable.builder();
for (String v : values) {
int f = v.indexOf(',Address.parse(v.substring(f + 1,v.length()))));
}
return ReviewerByEmailSet.fromTable(b.build());
}
项目:gerrit
文件:ChangeNotesTest.java
@Test
public void multipleReviewers() throws Exception {
Change c = newChange();
ChangeUpdate update = newUpdate(c,changeOwner);
update.putReviewer(changeOwner.getAccount().getId(),REVIEWER);
update.putReviewer(otherUser.getAccount().getId(),REVIEWER);
update.commit();
ChangeNotes notes = newNotes(c);
Timestamp ts = new Timestamp(update.getWhen().getTime());
assertthat(notes.getReviewers())
.isEqualTo(
ReviewerSet.fromTable(
ImmutableTable.<ReviewerStateInternal,Timestamp>builder()
.put(REVIEWER,new Account.Id(1),ts)
.put(REVIEWER,new Account.Id(2),ts)
.build()));
}
项目:gerrit
文件:ChangeNotesTest.java
@Test
public void reviewerTypes() throws Exception {
Change c = newChange();
ChangeUpdate update = newUpdate(c,CC);
update.commit();
ChangeNotes notes = newNotes(c);
Timestamp ts = new Timestamp(update.getWhen().getTime());
assertthat(notes.getReviewers())
.isEqualTo(
ReviewerSet.fromTable(
ImmutableTable.<ReviewerStateInternal,ts)
.put(CC,ts)
.build()));
}
项目:gerrit
文件:ChangeNotesTest.java
@Test
public void oneReviewerMultipleTypes() throws Exception {
Change c = newChange();
ChangeUpdate update = newUpdate(c,changeOwner);
update.putReviewer(otherUser.getAccount().getId(),REVIEWER);
update.commit();
ChangeNotes notes = newNotes(c);
Timestamp ts = new Timestamp(update.getWhen().getTime());
assertthat(notes.getReviewers())
.isEqualTo(ReviewerSet.fromTable(ImmutableTable.of(REVIEWER,ts)));
update = newUpdate(c,otherUser);
update.putReviewer(otherUser.getAccount().getId(),CC);
update.commit();
notes = newNotes(c);
ts = new Timestamp(update.getWhen().getTime());
assertthat(notes.getReviewers())
.isEqualTo(ReviewerSet.fromTable(ImmutableTable.of(CC,ts)));
}
项目:bue-common-open
文件:ProvenancedConfusionMatrix.java
/**
* Return a new {@code ProvenancedConfusionMatrix} containing only those provenance entries
* matching the provided predicate.
*/
public ProvenancedConfusionMatrix<CellFiller> filteredcopy(Predicate<CellFiller> predicate) {
final ImmutableTable.Builder<Symbol,Symbol,List<CellFiller>> newTable =
ImmutableTable.builder();
for (final Cell<Symbol,List<CellFiller>> curCell : table.cellSet()) {
final List<CellFiller> newFiller = FluentIterable.from(curCell.getValue())
.filter(predicate).toList();
if (!newFiller.isEmpty()) {
newTable.put(curCell.getRowKey(),curCell.getColumnKey(),newFiller);
}
}
return new ProvenancedConfusionMatrix<CellFiller>(newTable.build());
}
项目:bue-common-open
文件:ImmutableSetMultitable.java
public ImmutableSetMultitable<R,C,V> build() {
final ImmutableTable.Builder<R,Collection<V>> immutableTable =
ImmutableTable.builder();
int size = 0;
ImmutableSet.Builder<R> rowIterationBuilder = ImmutableSet.builder();
ImmutableSet.Builder<C> columnIterationBuilder = ImmutableSet.builder();
for (final RowKeyColumnKeyPair<R,C> rowKeyColKey : rowInsertionorder.build()) {
final ImmutableSet<V> valuesForPair =
tableWeCanLookUpIn.get(rowKeyColKey.row(),rowKeyColKey.column()).build();
size += valuesForPair.size();
immutableTable.put(rowKeyColKey.row(),rowKeyColKey.column(),valuesForPair);
rowIterationBuilder.add(rowKeyColKey.row());
columnIterationBuilder.add(rowKeyColKey.column());
}
return new ImmutableSetMultitable<>(immutableTable.build(),size,rowIterationBuilder.build(),columnIterationBuilder.build());
}
项目:bue-common-open
文件:ImmutableListMultitable.java
public ImmutableListMultitable<R,C> rowKeyColKey : rowInsertionorder.build()) {
final ImmutableList<V> valuesForPair =
tableWeCanLookUpIn.get(rowKeyColKey.row(),valuesForPair);
rowIterationBuilder.add(rowKeyColKey.row());
columnIterationBuilder.add(rowKeyColKey.column());
}
return new ImmutableListMultitable<>(immutableTable.build(),columnIterationBuilder.build());
}
项目:bue-common-open
文件:FileUtils.java
public static ImmutableTable<Symbol,Symbol> loadSymbolTable(CharSource input)
throws IOException {
final ImmutableTable.Builder<Symbol,Symbol> ret = ImmutableTable.builder();
int lineNo = 0;
for (final String line : input.readLines()) {
final List<String> parts = StringUtils.onTabs().splitToList(line);
if (parts.size() != 3) {
throw new IOException(String.format("Invalid line %d when reading symbol table: %s",lineNo,line));
}
ret.put(Symbol.from(parts.get(0)),Symbol.from(parts.get(1)),Symbol.from(parts.get(2)));
++lineNo;
}
return ret.build();
}
项目:guava
文件:NullPointerTesterTest.java
final void check() {
runTester()
.assertNonNullValues(
Gender.MALE,Integer.valueOf(0),"",ImmutableList.of(),ImmutableMap.of(),ImmutableSet.of(),ImmutableSortedSet.of(),ImmutableMultiset.of(),ImmutableMultimap.of(),ImmutableTable.of(),ImmutableTable.of());
}
项目:kidneyExchange
文件:MinWaitingTimeKepSolver.java
private ImmutableTable<V,V,Double> getPrecedenceVariableValues(
VariableSet.VariableExtractor variableExtractor) {
ImmutableTable.Builder<V,Double> ans = ImmutableTable.builder();
List<Cell<V,IloNumVar>> varsAsList = Lists
.newArrayList(this.precedenceVariables.cellSet());
IloNumVar[] vararray = new IloNumVar[varsAsList.size()];
int i = 0;
for (Cell<V,IloNumVar> cell : varsAsList) {
vararray[i++] = cell.getValue();
}
double[] varVals;
try {
varVals = variableExtractor.getValuesve(vararray);
} catch (IloException e) {
throw new RuntimeException(e);
}
for (int j = 0; j < varsAsList.size(); j++) {
ans.put(varsAsList.get(j).getRowKey(),varsAsList.get(j).getColumnKey(),varVals[j]);
}
return ans.build();
}
项目:kidneyExchange
文件:MinWaitingTimeKepSolver.java
/**
*
* @param nonZeroEdgeValues
* @return A list of lists of length 3. A returned list of [u,v,w] indicates
* that the constraint delta_uv + delta_vw <= delta_uw + 1 should be
* added.
*/
public List<List<V>> checkFractionalSolution(
Map<E,Double> nonZeroEdgeValues,ImmutableTable<V,Double> precVarVals) {
Set<V> retainedVertices = Sets.newHashSet(kepInstance.getGraph()
.getVertices());
Set<E> retainedEdges = Maps.filterValues(nonZeroEdgeValues,Range.<Double> atLeast(.51)).keySet();
// In the below graph,each node will have in degree and out degree
// at most one
DirectedSparseMultigraph<V,E> inUseEdges = SubgraphUtil.subgraph(
kepInstance.getGraph(),retainedVertices,retainedEdges);
CycleChainDecomposition<V,E> decomposition = new CycleChainDecomposition<V,E>(
inUseEdges);
List<List<V>> ans = checkCycleChainDecomposition(decomposition,precVarVals,checkChains);
fractionalCutsAdded += ans.size();
return ans;
}
项目:ExpandedRailsMod
文件:BlockStateContainer.java
public void buildPropertyValueTable(Map < Map < IProperty<?>,IBlockState > copyOf(table);
}
}
项目:mnist-machine-learning
文件:Main.java
private static List<NistInstance> readInstances(CharSource input) throws IOException {
return input.readLines().stream().map(line -> {
List<String> tokens = PARSER.splitToList(line);
List<Integer> values = tokens.stream().map(Integer::parseInt).collect(Collectors.toList());
List<Integer> instanceInput = values.subList(0,values.size() - 1);
int instanceOutput = values.get(values.size() - 1);
ImmutableTable.Builder<Integer,Integer,Integer> instance = ImmutableTable.builder();
for (int i = 0; i < instanceInput.size(); i++) {
int value = instanceInput.get(i);
int row = i / COLUMNS;
int column = i % COLUMNS;
instance.put(row,column,value);
}
return NistInstance.create(
instanceInput,instance
.orderRowsBy(Comparator.<Integer>naturalOrder())
.orderColumnsBy(Comparator.<Integer>naturalOrder())
.build(),instanceOutput);
}).collect(Collectors.toList());
}
项目:closure-templates
文件:DelTemplateSelector.java
private DelTemplateSelector(Builder<T> builder) {
ImmutableTable.Builder<String,Group<T>> nameAndVariantBuilder =
ImmutableTable.builder();
ImmutableListMultimap.Builder<String,T> delTemplateNameTovaluesBuilder =
ImmutableListMultimap.builder();
for (Table.Cell<String,Group.Builder<T>> entry :
builder.nameAndVariantToGroup.cellSet()) {
Group<T> group = entry.getValue().build();
nameAndVariantBuilder.put(entry.getRowKey(),entry.getColumnKey(),group);
String delTemplateName = entry.getRowKey();
if (group.defaultValue != null) {
delTemplateNameTovaluesBuilder.put(delTemplateName,group.defaultValue);
}
delTemplateNameTovaluesBuilder.putAll(delTemplateName,group.delpackageTovalue.values());
}
this.nameAndVariantToGroup = nameAndVariantBuilder.build();
this.delTemplateNameTovalues = delTemplateNameTovaluesBuilder.build();
}
项目:colormap-explorer
文件: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));
}
}
Table<KNownColormap,Double> infoTable = builder.build();
add(new CompareViewPanel(infoTable));
add(new CompareViewPanel(infoTable));
add(new CompareViewPanel(infoTable));
}
项目:Strata
文件:CashFlowReport.java
private CashFlowReport(
LocalDate valuationDate,Instant runInstant,List<ExplainKey<?>> columnKeys,List<String> columnHeaders,Table<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);
}
项目:streamjit
文件:ActorGroup.java
/**
* Returns a void->void MethodHandle that will run this ActorGroup for the
* given iterations using the given ConcreteStorage instances.
* @param iterations the range of iterations to run for
* @param storage the storage being used
* @return a void->void method handle
*/
public MethodHandle specialize(Range<Integer> iterations,Map<Storage,ConcreteStorage> storage,BiFunction<MethodHandle[],WorkerActor,MethodHandle> switchFactory,int unrollFactor,ImmutableTable<Actor,IndexFunctionTransformer> inputTransformers,IndexFunctionTransformer> outputTransformers) {
//TokenActors are special.
assert !isTokenGroup() : actors();
Map<Actor,MethodHandle> withRWHandlesBound =
bindActorsToStorage(iterations,storage,switchFactory,inputTransformers,outputTransformers);
int totalIterations = iterations.upperEndpoint() - iterations.lowerEndpoint();
unrollFactor = Math.min(unrollFactor,totalIterations);
int unrolls = (totalIterations/unrollFactor);
int unrollEndpoint = iterations.lowerEndpoint() + unrolls*unrollFactor;
MethodHandle overall = Combinators.semicolon(
makeGroupLoop(Range.closedOpen(iterations.lowerEndpoint(),unrollEndpoint),unrollFactor,withRWHandlesBound),makeGroupLoop(Range.closedOpen(unrollEndpoint,iterations.upperEndpoint()),1,withRWHandlesBound)
);
return overall;
}
项目:SpigotSource
文件:BlockStateList.java
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,map.get(this.b(iblockstate,comparable)));
}
}
}
this.c = ImmutableTable.copyOf(hashbasedtable);
}
}
项目:incubator-provisionr
文件:ImageTable.java
/**
* Load the list of AMIs from a resource file (csv format)
* <p/>
* Note: the parser is doing only split by comma. There is no
* support for escaping line components
*
* @param resource path to resource
* @return an instance of {@see ImageTable}
* @throws IOException
*/
public static ImageTable fromCsvResource(String resource) throws IOException {
checkNotNull(resource,"resource is null");
List<String> lines = Resources.readLines(Resources.getResource(ImageTable.class,resource),Charsets.UTF_8);
checkArgument(!lines.isEmpty(),"the resource is an empty file");
final ImmutableTable.Builder<String,String> table = ImmutableTable.builder();
final Iterable<String> headers = extractHeaders(lines);
int index = 0;
for (String line : Iterables.skip(lines,1)) {
final Iterable<Table.Cell<String,String>> cells =
combineHeadersWithLinePartsAsTableCells(index,headers,COMMA.split(line));
for (Table.Cell<String,String> cell : cells) {
table.put(cell);
}
index++;
}
return new ImageTable(table.build());
}
/**
* Helper function to build the ttl mapping. Only insert to the mapping if the value is a valid date.
* @param ttlMapBuilder
* @param config
* @param gran
* @param rollupType
* @param configKey
* @return true if the insertion is successful,false otherwise.
*/
private boolean put(
ImmutableTable.Builder<Granularity,RollupType,TimeValue> ttlMapBuilder,Configuration config,Granularity gran,RollupType rollupType,TtlConfig configKey) {
int value;
try {
value = config.getIntegerProperty(configKey);
if (value < 0) return false;
} catch (NumberFormatException ex) {
log.trace(String.format("No valid TTL config set for granularity: %s,rollup type: %s",gran.name(),rollupType.name()),ex);
return false;
}
ttlMapBuilder.put(gran,rollupType,new TimeValue(value,TimeUnit.DAYS));
return true;
}
项目:blueflood
文件:SafetyTtlProvider.java
SafetyTtlProvider() {
ImmutableTable.Builder<Granularity,TimeValue> ttlMapBuilder =
new ImmutableTable.Builder<Granularity,TimeValue>();
for (Granularity granularity : Granularity.granularities()) {
for (RollupType type : RollupType.values()) {
if (type == RollupType.NOT_A_ROLLUP) {
continue;
}
MetricColumnFamily metricCF = CassandraModel.getColumnFamily(RollupType.classOf(type,granularity),granularity);
TimeValue ttl = new TimeValue(metricCF.getDefaultTTL().getValue(),metricCF.getDefaultTTL().getUnit());
ttlMapBuilder.put(granularity,type,ttl);
}
}
this.SAFETY_TTLS = ttlMapBuilder.build();
}
public Table<String,Property> loadFromConfiguration(Configuration config) {
final Table<String,Property> properties = HashBasedTable.create();
for (Table.Cell<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,prop);
if (!prop.wasRead()) continue;
if (!prop.isBooleanValue()) prop.set(entry.isEnabled);
else entry.isEnabled = prop.getBoolean(entry.isEnabled);
}
return ImmutableTable.copyOf(properties);
}
@Test
public void positiveViewState() {
try {
assertCompilationResultIs(ImmutableTable.<Diagnostic.Kind,Pattern>of(),ImmutableList.of(getString("com/arellomobile/mvp/view/PositiveViewStateView$$State.java")));
} catch (IOException e) {
fail(e.getLocalizedMessage());
}
}
@Test
public void positiveViewStateProvider() {
try {
assertCompilationResultIs(ImmutableTable.<Diagnostic.Kind,ImmutableList.of(getString("com/arellomobile/mvp/presenter/PositiveViewStateProviderPresenter$$ViewStateProvider.java")));
} catch (IOException e) {
fail(e.getLocalizedMessage());
}
}
项目:GitHub
文件:TableEncoding.java
@Encoding.copy
@Encoding.Naming("with*Put")
public ImmutableTable<R,V> withPut(R row,C column,V value) {
return ImmutableTable.<R,V>builder()
.put(row,value)
.build();
}
项目:guava-mock
文件:NullPointerTesterTest.java
@SuppressWarnings("unused") // called by NullPointerTester
public void checkDefaultValuesForTheseTypes(
Gender gender,Integer integer,int i,String string,CharSequence charSequence,List<String> list,ImmutableList<Integer> immutableList,Map<String,Integer> map,String> immutableMap,Set<String> set,ImmutableSet<Integer> immutableSet,SortedSet<Number> sortedSet,ImmutableSortedSet<Number> immutableSortedSet,Multiset<String> multiset,ImmutableMultiset<Integer> immutableMultiset,Multimap<String,Integer> multimap,ImmutableMultimap<String,Integer> immutableMultimap,Table<String,Exception> table,ImmutableTable<Integer,Exception> immutableTable) {
calledWith(
gender,integer,i,string,charSequence,list,immutableList,map,immutableMap,set,immutableSet,sortedSet,immutableSortedSet,multiset,immutableMultiset,multimap,immutableMultimap,table,immutableTable);
}
项目:guava-mock
文件:NullPointerTesterTest.java
final void check() {
runTester().assertNonNullValues(
Gender.MALE,ImmutableTable.of());
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。