本文整理汇总了Java中com.carrotsearch.hppc.LongObjectHashMap类的典型用法代码示例。如果您正苦于以下问题:Java LongObjectHashMap类的具体用法?Java LongObjectHashMap怎么用?Java LongObjectHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongObjectHashMap类属于com.carrotsearch.hppc包,在下文中一共展示了LongObjectHashMap类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SafeController
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
public SafeController(CyServiceRegistrar registrar,
CySwingApplication application,
CyApplicationManager applicationManager,
ImportPanelController importPanel,
AttributeBrowserController attributeBrowser,
CompositeMapController compositeMapPanel,
DomainBrowserController domainBrowser,
EventService eventService,
SafeSessionSerializer serializer,
SelectionTracker selectionTracker) {
this.registrar = registrar;
this.application = application;
this.applicationManager = applicationManager;
this.importPanel = importPanel;
this.attributeBrowser = attributeBrowser;
this.compositeMapPanel = compositeMapPanel;
this.domainBrowser = domainBrowser;
this.eventService = eventService;
this.serializer = serializer;
this.selectionTracker = selectionTracker;
sessionsBySuid = new LongObjectHashMap<>();
}
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:26,代码来源:SafeController.java
示例2: loadFromSession
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
public LongObjectMap<SafeSession> loadFromSession(CySession cySession) throws IOException {
CyTable dataTable = cySession.getTables()
.stream()
.map(metadata -> metadata.getTable())
.filter(table -> DATA_TABLE_TITLE.equals(table.getTitle()))
.findFirst()
.orElse(null);
LongObjectMap<SafeSession> sessions = new LongObjectHashMap<>();
if (dataTable == null) {
return sessions;
}
for (CyRow row : dataTable.getAllRows()) {
String json = row.get(SAFE_DATA_COLUMN, String.class);
SafeSession session = parseSession(json);
Long oldSuid = row.get(CyIdentifiable.SUID, Long.class);
CyNetworkView view = cySession.getObject(oldSuid, CyNetworkView.class);
session.setNetworkView(view);
sessions.put(view.getSUID(), session);
}
return sessions;
}
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:26,代码来源:SafeSessionSerializer.java
示例3: testPerformance
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
@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) {
}
}
}
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:21,代码来源:RelationCacheTest.java
示例4: testDuel
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
public void testDuel() {
final LongObjectHashMap<Object> map1 = new LongObjectHashMap<>();
final LongObjectPagedHashMap<Object> map2 = new LongObjectPagedHashMap<>(randomInt(42), 0.6f + randomFloat() * 0.39f, randombigArrays());
final int maxKey = randomIntBetween(1, 10000);
final int iters = scaledRandomIntBetween(10000, 100000);
for (int i = 0; i < iters; ++i) {
final boolean put = randomBoolean();
final int iters2 = randomIntBetween(1, 100);
for (int j = 0; j < iters2; ++j) {
final long key = randomInt(maxKey);
if (put) {
final Object value = new Object();
assertSame(map1.put(key, value), map2.put(key, value));
} else {
assertSame(map1.remove(key), map2.remove(key));
}
assertEquals(map1.size(), map2.size());
}
}
for (int i = 0; i <= maxKey; ++i) {
assertSame(map1.get(i), map2.get(i));
}
final LongObjectHashMap<Object> copy = new LongObjectHashMap<>();
for (LongObjectPagedHashMap.Cursor<Object> cursor : map2) {
copy.put(cursor.key, cursor.value);
}
map2.close();
assertEquals(map1, copy);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:30,代码来源:LongObjectHashMapTests.java
示例5: testByte
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
private static long testByte() {
LongObjectMap<ConcurrentSkipListSet<ByteEntry>> tx = new LongObjectHashMap<ConcurrentSkipListSet<ByteEntry>>(NUM);
for (int i = 0; i < NUM; i++) {
tx.put(i, new ConcurrentSkipListSet<ByteEntry>());
}
for (int i = 0; i < NUM; i++) {
for (int j = 0; j < NUM; j++) {
if (i == j) continue;
if (Math.random() < FRACTION) {
ByteBuffer key = ByteBuffer.allocate(16);
key.putLong(5).putLong(j).flip();
ByteBuffer value = ByteBuffer.allocate(4);
value.putInt(random.nextInt(ROUNDSIZE)).flip();
tx.get(i).add(new ByteEntry(key, value));
}
}
}
long time = System.currentTimeMillis();
long sum = 0;
for (int t = 0; t < TRIALS; t++) {
for (int i = 0; i < NUM; i++) {
for (Vertex v : (new ByteVertex(i, tx)).getNeighbors(0)) {
sum += v.getId();
}
}
}
time = System.currentTimeMillis() - time;
return time;
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:30,代码来源:TestByteBuffer.java
示例6: readInlineTypes
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
private void readInlineTypes(long[] keyIds, LongObjectHashMap properties, ReadBuffer in, TypeInspector tx, InlineType inlineType) {
for (long keyId : keyIds) {
PropertyKey keyType = tx.getExistingPropertyKey(keyId);
Object value = readInline(in, keyType, inlineType);
if (value != null) properties.put(keyId, value);
}
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:EdgeSerializer.java
示例7: RelationCache
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
public RelationCache(final Direction direction, final long typeId, final long relationId,
final Object other, final LongObjectHashMap<Object> properties) {
this.direction = direction;
this.typeId = typeId;
this.relationId = relationId;
this.other = other;
this.properties = (properties == null || properties.size() > 0) ? properties : EMPTY;
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:9,代码来源:RelationCache.java
示例8: testEmpty
import com.carrotsearch.hppc.LongObjectHashMap; //导入依赖的package包/类
@Test
public void testEmpty() {
LongObjectHashMap<Object> map = new LongObjectHashMap<Object>();
assertEquals(0, map.size());
assertEquals(0, Iterables.size(map));
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:7,代码来源:RelationCacheTest.java
注:本文中的com.carrotsearch.hppc.LongObjectHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论