本文整理汇总了Java中it.unimi.dsi.fastutil.objects.Object2LongMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java Object2LongMap.put方法的具体用法?Java Object2LongMap.put怎么用?Java Object2LongMap.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.objects.Object2LongMap
的用法示例。
在下文中一共展示了Object2LongMap.put方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIdentifiers
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
public static Object2LongMap<ValueSpecification> getIdentifiers(final IdentifierMap map, final Collection<ValueSpecification> specifications) {
final Object2LongMap<ValueSpecification> identifiers = new Object2LongOpenHashMap<ValueSpecification>();
for (ValueSpecification specification : specifications) {
identifiers.put(specification, map.getIdentifier(specification));
}
return identifiers;
}
示例2: getIdentifiers
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
@Override
public Object2LongMap<ValueSpecification> getIdentifiers(Collection<ValueSpecification> specs) {
final IdentifierLookupRequest request = new IdentifierLookupRequest(specs);
final IdentifierLookupResponse response = getRemoteCacheClient().sendGetMessage(request, IdentifierLookupResponse.class);
final List<Long> identifiers = response.getIdentifier();
final Object2LongMap<ValueSpecification> identifierMap = new Object2LongOpenHashMap<ValueSpecification>();
int i = 0;
for (ValueSpecification spec : request.getSpecification()) {
identifierMap.put(spec, identifiers.get(i++));
}
return identifierMap;
}
示例3: getIdentifiers
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
public Object2LongMap<ValueSpecification> getIdentifiers(final Collection<ValueSpecification> specs) {
final Object2LongMap<ValueSpecification> result = new Object2LongOpenHashMap<ValueSpecification>();
for (ValueSpecification spec : specs) {
result.put(spec, getIdentifier(spec));
}
return result;
}
示例4: testGetIdentifiers
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
public void testGetIdentifiers() {
final ValueSpecification spec1 = createValueSpec(1);
final ValueSpecification spec2 = createValueSpec(2);
final ValueSpecification spec3 = createValueSpec(3);
final Collection<ValueSpecification> spec1And2 = new LinkedList<ValueSpecification>();
spec1And2.add(spec1);
spec1And2.add(spec2);
final Object2LongMap<ValueSpecification> identifier1And2 = new Object2LongOpenHashMap<ValueSpecification>();
identifier1And2.put(spec1, 1L);
identifier1And2.put(spec2, 2L);
final IdentifierMap underlying = Mockito.mock(IdentifierMap.class);
final CachingIdentifierMap cache = new CachingIdentifierMap(underlying);
Mockito.when(underlying.getIdentifiers(spec1And2)).thenReturn(identifier1And2);
Mockito.when(underlying.getIdentifier(spec3)).thenReturn(3L);
Object2LongMap<ValueSpecification> result = cache.getIdentifiers(Arrays.asList(spec1, spec2));
assertEquals(result.size(), 2);
assertEquals((long) result.get(spec1), 1L);
assertEquals((long) result.get(spec2), 2L);
result = cache.getIdentifiers(Arrays.asList(spec1, spec2));
assertEquals(result.size(), 2);
assertEquals((long) result.get(spec1), 1L);
assertEquals((long) result.get(spec2), 2L);
Mockito.verify(underlying, Mockito.times(1)).getIdentifiers(spec1And2);
result = cache.getIdentifiers(Arrays.asList(spec2, spec3));
assertEquals(result.size(), 2);
assertEquals((long) result.get(spec2), 2L);
assertEquals((long) result.get(spec3), 3L);
result = cache.getIdentifiers(Arrays.asList(spec2, spec3));
assertEquals(result.size(), 2);
assertEquals((long) result.get(spec2), 2L);
assertEquals((long) result.get(spec3), 3L);
Mockito.verify(underlying, Mockito.times(1)).getIdentifier(spec3);
result = cache.getIdentifiers(Arrays.asList(spec1, spec2, spec3));
assertEquals(result.size(), 3);
assertEquals((long) result.get(spec1), 1L);
assertEquals((long) result.get(spec2), 2L);
assertEquals((long) result.get(spec3), 3L);
Mockito.verifyNoMoreInteractions(underlying);
}
示例5: fillProgress
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
@Override
public void fillProgress(Object2LongMap<String> progress) {
long now = -1L;
for (int i = 0; i < this.score; i++) {
progress.put(getCriterion().getIds()[i], this.achievingTime != null ? this.achievingTime.toEpochMilli() :
now == -1L ? (now = System.currentTimeMillis()) : now);
}
}
示例6: initializeLabels
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
private Object2LongMap<Node> initializeLabels() {
Object2LongMap<Node> labels = new Object2LongOpenHashMap<>();
for (Node node : GlobalGraphOperations.at(graphDatabase).getAllNodes()) {
labels.put(node, (long)node.getProperty(ID_PROPERTY));
}
return labels;
}
开发者ID:atlarge-research,项目名称:graphalytics-platforms-neo4j,代码行数:8,代码来源:CommunityDetectionLPComputation.java
示例7: markDuplicatesRedundant
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
/**
* Assigns a doubtful status to accepted names that only differ in authorship
*
* @param nodes any node iterable to check for names
*/
private void markDuplicatesRedundant(ResourceIterable<Node> nodes) {
Object2LongMap<String> names = new Object2LongOpenHashMap<>();
for (Node n : nodes) {
if (!n.hasLabel(Labels.SYNONYM)) {
NubUsage u = read(n);
String name = u.parsedName.canonicalName();
if (u.status == TaxonomicStatus.ACCEPTED && !StringUtils.isBlank(name)) {
// prefix with rank ordinal to become unique across ranks (ordinal is shorter than full name to save mem)
String indexedName = u.rank.ordinal() + name;
if (names.containsKey(indexedName)) {
// duplicate accepted canonical name. Check which has priority
Node n1 = db.getNode(names.get(indexedName));
NubUsage u1 = read(n1);
int p1 = priorities.get(u1.datasetKey);
int p2 = priorities.get(u.datasetKey);
if (p2 < p1) {
// the old usage is from a less trusted source
u1.status = TaxonomicStatus.DOUBTFUL;
db.store(u1);
names.put(indexedName, n.getId());
} else {
// the old usage is from a higher trusted source, keep it
u.status = TaxonomicStatus.DOUBTFUL;
db.store(u);
}
} else {
names.put(indexedName, n.getId());
}
}
}
}
}
示例8: fillProgress
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
@Override
public void fillProgress(Object2LongMap<String> progress) {
if (this.achievingTime != null) {
progress.put(getCriterion().getName(), this.achievingTime.toEpochMilli());
}
}
示例9: fillProgress
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
@Override
public void fillProgress(Object2LongMap<String> progress) {
final Instant achievingTime = get().orElse(null);
progress.put(getCriterion().getName(), achievingTime == null ? INVALID_TIME : achievingTime.toEpochMilli());
}
示例10: fillProgress
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入方法依赖的package包/类
@Override
public void fillProgress(Object2LongMap<String> progress) {
progress.put(getCriterion().getName(), this.now.toEpochMilli());
}