com.carrotsearch.hppc.cursors.LongObjectCursor Java Examples

The following examples show how to use com.carrotsearch.hppc.cursors.LongObjectCursor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RelationCacheTest.java    From titan1withtp3.1 with Apache License 2.0 6 votes vote down vote up
@Test
public void testPerformance() {
    int trials = 10;
    int iterations = 100000;
    for (int k = 0; k < iterations; k++) {
        int len = random.nextInt(10);
        LongObjectHashMap<Object> map = new LongObjectHashMap<Object>();
        for (int i = 1; i <= len; i++) {
            map.put(i * 1000, "TestValue " + i);
        }
        for (int t = 0; t < trials; t++) {
            for (int i = 1; i <= len; i++) {
                assertEquals("TestValue " + i, map.get(i * 1000));
            }
            assertEquals(len, map.size());
            for (LongObjectCursor<Object> entry : map) {
            }
        }
    }
}
 
Example #2
Source File: MizoTitanHBaseRelationParser.java    From mizo with Apache License 2.0 5 votes vote down vote up
@Override
public String readPropertyName() {
    if (isProperty()) {
        return relationType.name();
    }

    LongObjectCursor<Object> next = propertiesIterator.next();
    nextPropertyValue = next.value;
    return relationTypes.get(next.key).name();

}
 
Example #3
Source File: CacheVertexProperty.java    From titan1withtp3.1 with Apache License 2.0 5 votes vote down vote up
private void copyProperties(InternalRelation to) {
    for (LongObjectCursor<Object> entry : getPropertyMap()) {
        PropertyKey type = tx().getExistingPropertyKey(entry.key);
        if (!(type instanceof ImplicitKey))
            to.setPropertyDirect(type, entry.value);
    }
}
 
Example #4
Source File: CacheVertexProperty.java    From titan1withtp3.1 with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<PropertyKey> getPropertyKeysDirect() {
    RelationCache map = getPropertyMap();
    List<PropertyKey> types = new ArrayList<>(map.numProperties());

    for (LongObjectCursor<Object> entry : map) {
        types.add(tx().getExistingPropertyKey(entry.key));
    }
    return types;
}
 
Example #5
Source File: CacheEdge.java    From titan1withtp3.1 with Apache License 2.0 5 votes vote down vote up
private void copyProperties(InternalRelation to) {
    for (LongObjectCursor<Object> entry : getPropertyMap()) {
        PropertyKey type = tx().getExistingPropertyKey(entry.key);
        if (!(type instanceof ImplicitKey))
            to.setPropertyDirect(type, entry.value);
    }
}
 
Example #6
Source File: CacheEdge.java    From titan1withtp3.1 with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<PropertyKey> getPropertyKeysDirect() {
    RelationCache map = getPropertyMap();
    List<PropertyKey> types = new ArrayList<>(map.numProperties());

    for (LongObjectCursor<Object> entry : map) {
        types.add(tx().getExistingPropertyKey(entry.key));
    }

    return types;
}
 
Example #7
Source File: RelationCache.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
public Iterator<LongObjectCursor<Object>> propertyIterator() {
    return properties.iterator();
}
 
Example #8
Source File: RelationCache.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Override
public Iterator<LongObjectCursor<Object>> iterator() {
    return propertyIterator();
}