本文整理汇总了Java中org.hypergraphdb.HGHandleFactory类的典型用法代码示例。如果您正苦于以下问题:Java HGHandleFactory类的具体用法?Java HGHandleFactory怎么用?Java HGHandleFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HGHandleFactory类属于org.hypergraphdb包,在下文中一共展示了HGHandleFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: singleValueUUID
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public void singleValueUUID(int count)
{
HGStore store = graph.getStore();
ByteArrayConverter<HGPersistentHandle> conv = BAtoHandle.getInstance(graph.getHandleFactory());
if (store.getIndex("benchUUIDs", conv, conv, null, null, false) != null)
store.removeIndex("benchUUIDs");
HGIndex<HGPersistentHandle, HGPersistentHandle> idx = store.getIndex("benchUUIDs",
BAtoHandle.getInstance(graph.getHandleFactory()),
BAtoHandle.getInstance(graph.getHandleFactory()),
null,
null,
true);
HGHandleFactory hFactory = graph.getHandleFactory();
long start = System.currentTimeMillis();
for (int i = 0; i < count; i++)
{
idx.addEntry(hFactory.makeHandle(), hFactory.makeHandle());
}
System.out.println("" + count + "," + (System.currentTimeMillis() - start)/1000.0);
}
示例2: lookupAll
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
private static double lookupAll(HGHandleFactory handleFactory, Set<HGPersistentHandle> baseSet, HGAtomSet destination)
{
long start = System.currentTimeMillis();
// int cnt = 0;
for (int i = 0; i < 30; i++)
for (HGHandle x : baseSet)
{
destination.contains(x);
destination.contains(handleFactory.makeHandle());
/* System.out.println(x);
if (cnt % 100 == 0)
System.out.println("cnt=" + cnt);
cnt++; */
}
return (System.currentTimeMillis() - start)/1000.0;
}
示例3: main
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public static void main(String []argv)
{
HashSet<HGPersistentHandle> baseSet = new HashSet<HGPersistentHandle>();
HGHandleFactory handleFactory = new UUIDHandleFactory();
for (int i = 0; i < 10000; i++)
{
HGPersistentHandle h = handleFactory.makeHandle();
baseSet.add(h);
}
SortedSet<HGHandle> tset = Collections.synchronizedSortedSet(new TreeSet<HGHandle>());
System.out.println("treeset add:" + addAll(baseSet, tset));
System.out.println("treeset lookup:" + lookupAll(handleFactory, baseSet, tset));
HGAtomSet set = new HGAtomSet();
System.out.println("atomset add:" + addAll(baseSet, set));
System.out.println("atomset lookup:" + lookupAll(handleFactory, baseSet, set));
}
示例4: deserializePersistentHandle
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public static HGPersistentHandle deserializePersistentHandle(InputStream in)
{
// TODO: we need to get the actual handle factory here, but it's annoying
// to have to pass the parameter everywhere.
HGHandleFactory handleFactory = new UUIDHandleFactory();
byte[] data = new byte[handleFactory.anyHandle().toByteArray().length];
try
{
for (int i = 0; i < data.length;)
i += in.read(data, i, data.length - i);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
return handleFactory.makeHandle(data);
}
示例5: convertStringToHandleArray
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public static HGPersistentHandle[] convertStringToHandleArray( String inputString, int handlesize, HGHandleFactory hghandlefactory)
{
HGPersistentHandle[] handles;
byte[] input = HGConverter.convertStringtoByteArray(inputString);
int size = input.length;
if (input == null)
return HyperGraph.EMPTY_PERSISTENT_HANDLE_SET;
else if (size == 0)
return HyperGraph.EMPTY_PERSISTENT_HANDLE_SET;
else if (size % handleSize != 0)
throw new HGException("While reading link tuple: the value buffer size is not a multiple of the handle size.");
else
{ int handle_count = size / handleSize;
handles = new HGPersistentHandle[handle_count];
for (int i = 0; i < handle_count; i++)
handles[i] = hghandlefactory.makeHandle(input, i*handleSize); // in LinkBinding.readHandle calls is called makeHandle with buffer, "offset + i*handleSize", whereas offset comes from entryToObject which is just 0
}
return handles;
}
示例6: convertByteArrayToHandleArray
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public static HGPersistentHandle[] convertByteArrayToHandleArray( byte[] input, HGHandleFactory hghandlefactory)
{
if (input == null)
return null;
int size = input.length;
if (size == 0)
return HyperGraph.EMPTY_PERSISTENT_HANDLE_SET;
if (size % handleSize != 0)
throw new HGException("While reading link tuple: the value buffer size is not a multiple of the handle size.");
int handle_count = size / handleSize;
HGPersistentHandle[] handles = new HGPersistentHandle[handle_count];
for (int i = 0; i < handle_count; i++)
handles[i] = hghandlefactory.makeHandle(input, i*handleSize); // in LinkBinding.readHandle calls is called makeHandle with buffer, "offset + i*handleSize", whereas offset comes from entryToObject which is just 0 ?
return handles;
}
示例7: loadFromResource
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public static PredefinedTypesConfig loadFromResource(HGHandleFactory handleFactory, String resource)
{
InputStream in = PredefinedTypesConfig.class.getResourceAsStream(resource);
try
{
PredefinedTypesConfig config = new PredefinedTypesConfig();
config.loadTypes(handleFactory, readIt(in));
return config;
}
catch (Exception ex)
{
throw new HGException(ex);
}
finally
{
try {in.close();}catch (Throwable t) {}
}
}
示例8: loadFromFile
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public static PredefinedTypesConfig loadFromFile(HGHandleFactory handleFactory, File file)
{
InputStream in = null;
try
{
in = new FileInputStream(file);
PredefinedTypesConfig config = new PredefinedTypesConfig();
config.loadTypes(handleFactory, readIt(in));
return config;
}
catch (Exception ex)
{
throw new HGException(ex);
}
finally
{
try {if (in != null) in.close();}catch (Throwable t) {}
}
}
示例9: TransactionLmdbImpl
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public TransactionLmdbImpl(LmdbStorageImplementation storeImpl,
HGHandleFactory handleFactory, Transaction t, Env env,
boolean readOnly)
{
this.storeImpl = storeImpl;
this.handleFactory = handleFactory;
this.env = env;
this.t = t;
this.readOnly = readOnly;
if (storeImpl != null)
{
syncFrequency = storeImpl.getConfiguration().getSyncFrequency();
syncForce = storeImpl.getConfiguration().isSyncForce();
}
}
示例10: getInstance
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public synchronized static ByteArrayConverter<HGPersistentHandle> getInstance(HGHandleFactory handleFactory)
{
BAtoHandle instance = M.get(handleFactory);
if (instance == null)
{
instance = new BAtoHandle();
instance.handleFactory = handleFactory;
M.put(handleFactory, instance);
}
return instance;
}
示例11: LinkBinding
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public LinkBinding(HGStore store, HGHandleFactory handleFactory)
{
this.handleFactory = handleFactory;
handleSize = handleFactory.nullHandle().toByteArray().length;
assert handleSize > 0;
}
示例12: hfactory
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public HGHandleFactory hfactory()
{
return config().getHandleFactory();
}
示例13: LinkBinding
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public LinkBinding(HGHandleFactory handleFactory) {
this.handleFactory = handleFactory;
handleSize = handleFactory.nullHandle().toByteArray().length;
}
示例14: LinkBinding
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public LinkBinding(HGHandleFactory handleFactory)
{
this.handleFactory = handleFactory;
handleSize = handleFactory.nullHandle().toByteArray().length;
}
示例15: HandleConverter
import org.hypergraphdb.HGHandleFactory; //导入依赖的package包/类
public HandleConverter(HGHandleFactory hf) {
this.hf = hf;
}