本文整理汇总了Java中it.unimi.dsi.fastutil.objects.Object2LongMap类的典型用法代码示例。如果您正苦于以下问题:Java Object2LongMap类的具体用法?Java Object2LongMap怎么用?Java Object2LongMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Object2LongMap类属于it.unimi.dsi.fastutil.objects包,在下文中一共展示了Object2LongMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertValueSpecifications
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
@Override
public void convertValueSpecifications(final Object2LongMap<ValueSpecification> valueSpecifications) {
if (_inputIdentifiers == null) {
if (_inputSpecifications.length > 0) {
_inputIdentifiers = new long[_inputSpecifications.length];
for (int i = 0; i < _inputSpecifications.length; i++) {
_inputIdentifiers[i] = valueSpecifications.getLong(_inputSpecifications[i]);
}
} else {
_inputIdentifiers = EMPTY_LONG;
}
}
if (_outputIdentifiers == null) {
if (_outputSpecifications.length > 0) {
_outputIdentifiers = new long[_outputSpecifications.length];
for (int i = 0; i < _outputSpecifications.length; i++) {
_outputIdentifiers[i] = valueSpecifications.getLong(_outputSpecifications[i]);
}
} else {
_outputIdentifiers = EMPTY_LONG;
}
}
}
示例2: convertValueSpecifications
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
@Override
public void convertValueSpecifications(final Object2LongMap<ValueSpecification> valueSpecifications) {
if (_valueIdentifiers == null) {
_valueIdentifiers = new long[_valueSpecifications.size()];
int i = 0;
for (final ValueSpecification specification : _valueSpecifications) {
_valueIdentifiers[i++] = valueSpecifications.getLong(specification);
}
}
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: convertValueSpecifications
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
@Override
public void convertValueSpecifications(final Object2LongMap<ValueSpecification> valueSpecifications) {
_cacheSelect.convertValueSpecifications(valueSpecifications);
for (CalculationJobItem item : _jobItems) {
item.convertValueSpecifications(valueSpecifications);
}
}
示例7: 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);
}
示例8: MessagePlayOutAdvancements
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
public MessagePlayOutAdvancements(boolean clear, List<AdvStruct> addedAdvStructs, List<String> removedAdvs,
Map<String, Object2LongMap<String>> progress) {
this.addedAdvStructs = addedAdvStructs;
this.removedAdvs = removedAdvs;
this.progress = progress;
this.clear = clear;
}
示例9: 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);
}
}
示例10: 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
示例11: 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());
}
}
}
}
}
示例12: getResult
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
@Override
public Object2LongMap<String> getResult() {
return result;
}
示例13: testTriangles
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
@Test
public void testTriangles() {
OrientGraphNoTx graph = getGraph();
Vertex a = graph.addVertex(null), b = graph.addVertex(null), c = graph.addVertex(null);
Vertex d = graph.addVertex(null), e = graph.addVertex(null), f = graph.addVertex(null);
Vertex g = graph.addVertex(null), h = graph.addVertex(null), i = graph.addVertex(null), j = graph.addVertex(null);
a.addEdge(EDGE_LABEL, b);
b.addEdge(EDGE_LABEL, c);
c.addEdge(EDGE_LABEL, a);
d.addEdge(EDGE_LABEL, e);
d.addEdge(EDGE_LABEL, f);
g.addEdge(EDGE_LABEL, h);
h.addEdge(EDGE_LABEL, i);
i.addEdge(EDGE_LABEL, j);
j.addEdge(EDGE_LABEL, g);
h.addEdge(EDGE_LABEL, j);
graph.commit();
graph.shutdown();
TriangleCount tc = new TriangleCount();
GraphAlgoEngine engine = new ParallelGraphEngine(getFactory());
engine.execute(tc);
Object2LongMap<String> node2tc = tc.getResult();
Assert.assertEquals(2L, node2tc.getLong(a.getId().toString()));
Assert.assertEquals(2L, node2tc.getLong(b.getId().toString()));
Assert.assertEquals(2L, node2tc.getLong(c.getId().toString()));
Assert.assertEquals(0L, node2tc.getLong(d.getId().toString()));
Assert.assertEquals(0L, node2tc.getLong(e.getId().toString()));
Assert.assertEquals(0L, node2tc.getLong(f.getId().toString()));
Assert.assertEquals(2L, node2tc.getLong(g.getId().toString()));
Assert.assertEquals(2L, node2tc.getLong(i.getId().toString()));
Assert.assertEquals(4L, node2tc.getLong(h.getId().toString()));
Assert.assertEquals(4L, node2tc.getLong(j.getId().toString()));
}
示例14: run
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
public Object2LongMap<ValueSpecification> run(final Queue<Worker.Request> requests) {
requests.add(this);
waitFor();
return _result;
}
示例15: convertValueSpecifications
import it.unimi.dsi.fastutil.objects.Object2LongMap; //导入依赖的package包/类
@Override
public void convertValueSpecifications(final Object2LongMap<ValueSpecification> valueSpecifications) {
for (CalculationJobResultItem item : _resultItems) {
item.convertValueSpecifications(valueSpecifications);
}
}