项目:cc-analysis
文件:AnalysisTestHelper.java
public static void printResultOfTokenStream(PrintStream out,TokenStream ts) throws IOException {
CharTermAttribute termAttr = ts.getAttribute(CharTermAttribute.class);
TypeAttribute typeAttr = ts.getAttribute(TypeAttribute.class);
OffsetAttribute offAttr = ts.getAttribute(OffsetAttribute.class);
PositionIncrementAttribute posIncAttr = ts.getAttribute(PositionIncrementAttribute.class);
PositionLengthAttribute posLenAttr = ts.getAttribute(PositionLengthAttribute.class);
ts.reset();
Table<String,String,String> contentTable = Tables.newCustomTable(new LinkedHashMap<String,Map<String,String>>(),new supplier<Map<String,String>>() {
@Override
public Map<String,String> get() {
return Maps.newLinkedHashMap();
}
});
int lineNo = 1;
int pos = 0;
while (ts.incrementToken()) {
String lineId = lineNo + ".";
contentTable.put(lineId,"term",termAttr.toString());
contentTable.put(lineId,"type",typeAttr.type());
contentTable.put(lineId,"startOffset",offAttr.startOffset() + "");
contentTable.put(lineId,"endOffset",offAttr.endOffset() + "");
contentTable.put(lineId,"posInc",posIncAttr.getPositionIncrement() + "");
contentTable.put(lineId,"posLen",posLenAttr.getPositionLength() + "");
pos += posIncAttr.getPositionIncrement();
contentTable.put(lineId,"pos",pos + "");
lineNo++;
}
printTable(out,contentTable);
}
项目:gerrit
文件:ChangeNotesParser.java
private ChangeNotesstate buildState() {
return ChangeNotesstate.create(
tip.copy(),id,new Change.Key(changeId),createdOn,lastUpdatedOn,ownerId,branch,buildCurrentPatchSetId(),subject,topic,originalSubject,submissionId,assignee != null ? assignee.orElse(null) : null,status,Sets.newLinkedHashSet(Lists.reverse(pastAssignees)),hashtags,patchSets,buildApprovals(),ReviewerSet.fromTable(Tables.transpose(reviewers)),ReviewerByEmailSet.fromTable(Tables.transpose(reviewersByEmail)),pendingReviewers,pendingReviewersByEmail,allPastReviewers,buildreviewerUpdates(),submitRecords,buildAllMessages(),buildMessagesByPatchSet(),comments,readOnlyUntil,isPrivate,workInProgress,hasReviewStarted,revertOf);
}
项目:gerrit
文件:ChangeNotesParser.java
private void parseWorkInProgress(ChangeNotesCommit commit) throws ConfigInvalidException {
String raw = parSEOneFooter(commit,FOOTER_WORK_IN_PROGRESS);
if (raw == null) {
// No change to WIP state in this revision.
prevIoUsWorkInProgressFooter = null;
return;
} else if (Boolean.TRUE.toString().equalsIgnoreCase(raw)) {
// This revision moves the change into WIP.
prevIoUsWorkInProgressFooter = true;
if (workInProgress == null) {
// Because this is the first time workInProgress is being set,we kNow
// that this change's current state is WIP. All the reviewer updates
// we've seen so far are pending,so take a snapshot of the reviewers
// and reviewersByEmail tables.
pendingReviewers =
ReviewerSet.fromTable(Tables.transpose(ImmutableTable.copyOf(reviewers)));
pendingReviewersByEmail =
ReviewerByEmailSet.fromTable(Tables.transpose(ImmutableTable.copyOf(reviewersByEmail)));
workInProgress = true;
}
return;
} else if (Boolean.FALSE.toString().equalsIgnoreCase(raw)) {
prevIoUsWorkInProgressFooter = false;
hasReviewStarted = true;
if (workInProgress == null) {
workInProgress = false;
}
return;
}
throw invalidFooter(FOOTER_WORK_IN_PROGRESS,raw);
}
项目:db-table
文件:TableCellMapper.java
@Override
public Table.Cell<R,C,V> map(int index,ResultSet r,StatementContext ctx) throws sqlException {
return Tables.immutableCell(
rowMapper.map(index,r,ctx),columnMapper.map(index,valueMapper.map(index,ctx)
);
}
项目:RuneCraftery
文件:GameData.java
public static void buildModobjectTable()
{
if (modobjectTable != null)
{
throw new IllegalStateException("Illegal call to buildModobjectTable!");
}
Map<Integer,Cell<String,Integer>> map = Maps.transformValues(idMap,new Function<ItemData,Integer>>() {
public Cell<String,Integer> apply(ItemData data)
{
if ("minecraft".equals(data.getModId()) || !data.isOveridden())
{
return null;
}
return Tables.immutableCell(data.getModId(),data.getItemType(),data.getItemId());
}
});
Builder<String,Integer> tBuilder = ImmutableTable.builder();
for (Cell<String,Integer> c : map.values())
{
if (c!=null)
{
tBuilder.put(c);
}
}
modobjectTable = tBuilder.build();
}
项目:BetterNutritionMod
文件:GameData.java
项目:LD-FusionTool
文件:LDFusionToolCRUtils.java
/**
* Creates a new HashMap backed {@link Table}.
*/
public static <R,V> Table<R,V> newHashTable() {
return Tables.newCustomTable(
new HashMap<R,Map<C,V>>(),new supplier<Map<C,V>>() {
@Override
public Map<C,V> get() {
return new HashMap<>();
}
}
);
}
项目:azure-table
文件:CellSetMutableView.java
@Override
public Table.Cell<Bytes,Bytes,Bytes> apply(AzureEntity input) {
return Tables.immutableCell(
decode(input.getPartitionKey()),decode(input.getRowKey()),decode(input.getValue()));
}
项目:azure-table
文件:CellSetMutableViewTest.java
@Test
public void contains_delegates_to_table() {
Object o1 = new Object();
Object o2 = new Object();
Table.Cell<Object,Object,Object> cell = Tables.immutableCell(o1,o2,new Object());
when(baseAzureTable.contains(o1,o2)).thenReturn(true);
assertthat(set.contains(cell),is(equalTo(true)));
}
项目:incubator-provisionr
文件:ImageTable.java
static Iterable<Table.Cell<String,String>> combineHeadersWithLinePartsAsTableCells(
int index,Iterable<String> headers,Iterable<String> lineParts
) {
final String rowKey = "" + index;
return transform(zip(headers,lineParts),new Function<Map.Entry<String,String>,Table.Cell<String,String>>() {
@Override
public Table.Cell<String,String> apply(Map.Entry<String,String> entry) {
checkNotNull(entry,"entry is null");
return Tables.immutableCell(rowKey,entry.getKey(),entry.getValue());
}
});
}
项目:incubator-provisionr
文件:ImageTableTest.java
@Test
@SuppressWarnings("unchecked")
public void testCombineHeadersWithLinePartsAsTableCells() {
final ImmutableList<String> headers = ImmutableList.of("a","b");
final ImmutableList<String> lineParts = ImmutableList.of("1","2");
Iterable<Table.Cell<String,String>> cells =
ImageTable.combineHeadersWithLinePartsAsTableCells(0,headers,lineParts);
assertthat(cells).contains(Tables.immutableCell("0","a","1"));
}
项目:yammer-collections
文件:TransformingTable.java
@Override
public Cell<R1,C1,V1> apply(Cell<R,V> input) {
return Tables.immutableCell(
toRowFunction.apply(input.getRowKey()),toColumnFunction.apply(input.getColumnKey()),tovalueFunction.apply(input.getValue())
);
}
项目:yammer-collections
文件:TransformingTable.java
@Override
public Cell<R,V> apply(Cell<R1,V1> input) {
return Tables.immutableCell(
fromrowFunction.apply(input.getRowKey()),fromColumnFunction.apply(input.getColumnKey()),fromValueFunction.apply(input.getValue())
);
}
项目:yammer-collections
文件:TransformingTableTest.java
public void cellSet_delegates_to_backing_table() {
Set<Table.Cell<String,String>> cellSet = Collections.singleton(Tables.immutableCell(STRING_ROW_KEY_1,STRING_COLUMN_KEY_1,STRING_VALUE_1));
when(backingTableMock.cellSet()).thenReturn(cellSet);
Table.Cell<Float,Long,Integer> expectedCell = Tables.immutableCell(ROW_KEY_1,COLUMN_KEY_1,VALUE_1);
//noinspection unchecked
assertthat(transformingTable.cellSet(),containsInAnyOrder(expectedCell));
}
项目:ProjectAres
文件:TableView.java
@Override
public Set<Cell<R,V>> cellSet() {
return new AbstractSet<Cell<R,V>>() {
@Override
public int size() {
return TableView.this.size();
}
@Override
public boolean isEmpty() {
return TableView.this.isEmpty();
}
@Override
public boolean contains(Object o) {
if(!(o instanceof Cell)) return false;
final Cell cell = (Cell) o;
return Objects.equals(get(cell.getRowKey(),cell.getColumnKey()),cell.getValue());
}
@Override
public Stream<Cell<R,V>> stream() {
return map.entrySet()
.stream()
.flatMap(row -> row.getValue()
.entrySet()
.stream()
.map(col -> Tables.immutableCell(row.getKey(),col.getKey(),col.getValue())));
}
@Override
public Spliterator<Cell<R,V>> spliterator() {
return stream().spliterator();
}
@Override
public Iterator<Cell<R,V>> iterator() {
return Spliterators.iterator(spliterator());
}
};
}
@Nonnull
@Override
public Table<HOLDER,Class<Object>,Object> getAll() {
return Tables.unmodifiableTable(Metadata);
}
项目:Rapture
文件:ReflexSparseMatrixValue.java
public ReflexSparseMatrixValue transpose() {
ReflexSparseMatrixValue ret = new ReflexSparseMatrixValue(2);
ret.table = Tables.transpose(table);
return ret;
}
项目:owsi-core-parent
文件:Functions2.java
@Override
public Table<R,V> apply(Table<? extends R,? extends C,? extends V> input) {
return input == null ? null : Tables.unmodifiableTable(input);
}
public PhaseVfsstatistics(ProfilePhase phase) {
this.phase = phase;
this.statistics =
Tables.newCustomTable(
new EnumMap<ProfilerTask,Stat>>(ProfilerTask.class),HashMap::new);
}
@Override
public Table<Integer,String> load(InlineTable inlineTable){
return Tables.unmodifiableTable(parse(inlineTable));
}
项目:azure-table
文件:RowViewTest.java
@Test
public void contains_value_returns_false_if_does_not_contain_value_in_row() throws StorageException {
setAzureTabletoContain(Tables.immutableCell(ROW_KEY_1,OTHER_COLUMN_KEY,VALUE_1));
assertthat(rowView.containsValue(VALUE_1),is(equalTo(false)));
}
项目:azure-table
文件:ColumnViewTest.java
@Test
public void contains_value_returns_false_if_does_not_contain_value_in_row() throws StorageException {
setAzureTabletoContain(Tables.immutableCell(OTHER_ROW_KEY,VALUE_1));
assertthat(columnView.containsValue(VALUE_1),is(equalTo(false)));
}
/**
* Returns an unmodifiable view of the table of inclusion rules: rows are
* metamodel URIs,columns are type names or WILDCARD (meaning all types in
* the metamodel) and cells are either sets of slot names or a singleton set
* with WILDCARD (meaning "all"). An empty table means "include everything".
*/
public Table<String,ImmutableSet<String>> getInclusionRules() {
return Tables.unmodifiableTable(inclusions);
}
/**
* Returns an unmodifiable view of the table of exclusion rules: rows are
* metamodel URIs,columns are type names and cells are either sets of slot
* names or a singleton set with WILDCARD (meaning "all"). An empty table
* means "exclude nothing".
*/
public Table<String,ImmutableSet<String>> getExclusionRules() {
return Tables.unmodifiableTable(exclusions);
}
/**
* Returns an unmodifiable view of the table of inclusion rules: rows are
* metamodel URIs,ImmutableSet<String>> getInclusionRules() {
return Tables.unmodifiableTable(inclusions);
}
/**
* Returns an unmodifiable view of the table of exclusion rules: rows are
* metamodel URIs,ImmutableSet<String>> getExclusionRules() {
return Tables.unmodifiableTable(exclusions);
}
/**
* Returns an unmodifiable view of the table of inclusion rules: rows are
* metamodel URIs,ImmutableSet<String>> getInclusionRules() {
return Tables.unmodifiableTable(inclusions);
}
/**
* Returns an unmodifiable view of the table of exclusion rules: rows are
* metamodel URIs,ImmutableSet<String>> getExclusionRules() {
return Tables.unmodifiableTable(exclusions);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。