• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IncidenceSetRef类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.hypergraphdb.IncidenceSetRef的典型用法代码示例。如果您正苦于以下问题:Java IncidenceSetRef类的具体用法?Java IncidenceSetRef怎么用?Java IncidenceSetRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

IncidenceSetRef类属于org.hypergraphdb包,在下文中一共展示了IncidenceSetRef类的31个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle,
                       LazyRef<HGHandle[]> targetSet,
                       IncidenceSetRef incidenceSet)
    {
        HGHandle [] targets = targetSet.deref();
        Json A = Json.array();
        for (int i = 0; i < targets.length; i++)
        {
            Object x = graph.get(targets[i]);
            if (x instanceof HGValueLink)
            {
                Json value = (Json)((HGValueLink)x).getValue();
                if (value.isObject() && node.getEntityInterface().isEntity(value))
                	value = node.getEntityInterface().createEntityReference(node, targets[i]);
//                if (value.isObject())
//                    value.set("hghandle", targets[i].getPersistent().toString());
                A.add(value);
            }
            else
                A.add(x);
        }
        return A;
    }
 

开发者ID:hypergraphdb,
项目名称:mjson,
代码行数:24,
代码来源:ArrayTypeJson.java

示例2: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	MapType result = null;
	String className = new String(hg.getStore().getData(handle));
	try
	{
		Class clazz = Class.forName(className);
		GenericObjectFactory factory = new GenericObjectFactory(clazz);
		result = new MapType(factory);
	}
	catch (Throwable t)
	{
		throw new HGException(t);
	}
	return result;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:17,
代码来源:MapTypeConstructor.java

示例3: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@SuppressWarnings("unchecked")
   public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	CollectionType result = null;
	String className = new String(graph.getStore().getData(handle));
	try
	{
		Class<?> clazz = Class.forName(className);
		GenericObjectFactory factory = new GenericObjectFactory(clazz);
		result = new CollectionType(factory);
	}
	catch (Throwable t)
	{
		throw new HGException(t);
	}
	return result;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:18,
代码来源:CollectionTypeConstructor.java

示例4: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	Collection<Object> result;
	if (targetSet == null || targetSet.deref().length == 0)
		result = factory.make();
	else
		result = factory.make(targetSet.deref());
	TypeUtils.setValueFor(graph, handle, result);
	HGPersistentHandle [] layout = graph.getStore().getLink(handle);
	for (int i = 0; i < layout.length; i += 2)
	{
		Object current = null;			
		HGPersistentHandle typeHandle = layout[i];
		HGPersistentHandle valueHandle = layout[i+1];
		if (!typeHandle.equals(graph.getHandleFactory().nullHandle()))
		{
			HGAtomType type = graph.getTypeSystem().getType(typeHandle); 
			current = TypeUtils.makeValue(graph, valueHandle, type);
		}
		result.add(current);
	}
	return result;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:24,
代码来源:CollectionType.java

示例5: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	if (targetSet != null && targetSet.deref().length > 0)
		throw new HGException("A HGAbstractType cannot be a link, " +
				"attempt to create an atom instance with a non-empty target set.");
	HGPersistentHandle [] layout = graph.getStore().getLink(handle);
	if (layout.length == 1)
		return new HGAbstractType();
	else
	{
		HGAbstractCompositeType type = new HGAbstractCompositeType();
		HGAtomType stringType = graph.getTypeSystem().getAtomType(String.class);			
		for (int i = 0; i < layout.length; i += 2)
		{
			String name = (String)stringType.make(layout[i], null, null);
			HGHandle typeHandle = graph.refreshHandle(layout[i+1]);
			type.addProjection(new HGAbstractCompositeType.Projection(name, typeHandle));
		}
		return type;
	}
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:22,
代码来源:AbstractTypeConstructor.java

示例6: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	byte [] data = hg.getStore().getData(handle);
	if (data == null)
		throw new HGException("Could not find value for long array, handle=" + handle.toString());
	long [] result = new long[(data.length - 1)/ 8];
	for (int i = 0; i < result.length; i++)
	{
		int l = 8 * i + 1;
		long lv = ((long)data[l] << 56) +
           		  ((long)(data[l+1] & 255) << 48) +
           		  ((long)(data[l+2] & 255) << 40) +
           		  ((long)(data[l+3] & 255) << 32) +
           		  ((long)(data[l+4] & 255) << 24) +
           		  ((data[l+5] & 255) << 16) + 
           		  ((data[l+6] & 255) <<  8) + 
           		  ((data[l+7] & 255) <<  0);
		result[i] = lv;			
	}
	return result;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:22,
代码来源:LongPrimitiveArrayType.java

示例7: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	byte [] data = hg.getStore().getData(handle);
	if (data == null)
		throw new HGException("Could not find value for int array, handle=" + handle.toString());
	int [] A = new int[(data.length - 1)/ 4];
	for (int i = 0; i < A.length; i++)
	{
		int offset = i*4 + 1;
        int ch1 = data[offset];
        int ch2 = data[offset + 1];
        int ch3 = data[offset + 2];
        int ch4 = data[offset + 3];
        A[i] = ((ch1 & 0xFF) << 24) | ((ch2 & 0xFF) << 16) | ((ch3 & 0xFF) << 8) | (ch4 & 0xFF);						
	}
	return A;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:18,
代码来源:IntPrimitiveArrayType.java

示例8: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	byte [] data = hg.getStore().getData(handle);
	if (data == null)
		throw new HGException("Could not find value for double array, handle=" + handle.toString());		
	double [] result = new double[(data.length - 1) / 8];
	for (int i = 0; i < result.length; i++)
	{
		int l = 8 * i + 1;
		long lv = ((long)data[l] << 56) +
           		  ((long)(data[l+1] & 255) << 48) +
           		  ((long)(data[l+2] & 255) << 40) +
           		  ((long)(data[l+3] & 255) << 32) +
           		  ((long)(data[l+4] & 255) << 24) +
           		  ((data[l+5] & 255) << 16) + 
           		  ((data[l+6] & 255) <<  8) + 
           		  ((data[l+7] & 255) <<  0);
		result[i] = Double.longBitsToDouble(lv);			
	}
	return result;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:22,
代码来源:DoublePrimitiveArrayType.java

示例9: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	byte [] data = hg.getStore().getData(handle);
	if (data == null)
		throw new HGException("Could not find value for float array, handle=" + handle.toString());		
	float [] result = new float[(data.length - 1)/ 4];
	for (int i = 0; i < result.length; i++)
	{
        int j = 4 * i + 1;
        int fi = ((data[j + 3] & 0xFF) << 0) +
				 ((data[j + 2] & 0xFF) << 8) +
				 ((data[j + 1] & 0xFF) << 16) +
				 ((data[j + 0]) << 24);
	    result[i] = Float.intBitsToFloat(fi);
	}		
	return result;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:18,
代码来源:FloatPrimitiveArrayType.java

示例10: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@SuppressWarnings("unchecked")
	public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet)
	{
		EnumType result = new EnumType();
		result.setHyperGraph(graph);
		
		// We are pretty sure that this is an atom, so we can find its handle with the by value
		// index. And we use that to get Java class of the enum, instead of the stored one
		// so we can gracefully handle class name changes.
		HGPersistentHandle typeHandle = (HGPersistentHandle)graph.getIndexManager().getIndexByValue().findFirst(handle);
		Class<Enum<?>> cl = (Class<Enum<?>>)graph.getTypeSystem().getClassForType(typeHandle);
		result.setEnumType(cl);		
//		HGPersistentHandle [] layout = graph.getStore().getLink(handle);		
//		HGAtomType stringType = graph.getTypeSystem().getAtomType(String.class);		
//		String classname = (String)stringType.make(layout[0], null, null);
//		try
//		{
//			cl = HGUtils.loadClass(getHyperGraph(), classname);
//			result.setEnumType(cl);
//		}
//		catch (ClassNotFoundException ex)
//		{
//			throw new HGException("Unable to load enum class " + classname, ex);
//		}
		return result;
	}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:27,
代码来源:EnumTypeConstructor.java

示例11: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	S fac = graph.get( layout[ 0 ] );
	U dim = graph.get( layout[ 1 ] );
	A ord = graph.get( layout[ 2 ] );
	Map<HashSet<BigInteger>,R> map = graph.get( layout[ 3 ] );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( dim == null )
		throw( new RuntimeException( "Failed" ) );
	if( ord == null )
		throw( new RuntimeException( "Failed" ) );
	if( map == null )
		throw( new RuntimeException( "Failed" ) );
	final GeometricAlgebraMultivectorElem<U,A,R,S> ga = new GeometricAlgebraMultivectorElem<U,A,R,S>( fac , dim , ord );
	for( final Entry<HashSet<BigInteger>, R> ii : map.entrySet() )
	{
		HashSet<BigInteger> key = ii.getKey();
		R val = ii.getValue();
		ga.setVal( key , val );
	}
	return( ga );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:26,
代码来源:GeometricAlgebraMultivectorElemType.java

示例12: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	GeometricAlgebraMultivectorElemFactory<U,A, SymbolicElem<R, S>, SymbolicElemFactory<R, S>> fac = graph.get( layout[ 0 ] );
	U dim = graph.get( layout[ 1 ] );
	A ord = graph.get( layout[ 2 ] );
	DirectionalDerivativePartialFactory<R,S,K> dfac = graph.get( layout[ 3 ] );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( dim == null )
		throw( new RuntimeException( "Failed" ) );
	if( ord == null )
		throw( new RuntimeException( "Failed" ) );
	if( dfac == null )
		throw( new RuntimeException( "Failed" ) );
	final DirectionalDerivative<U,A,R,S,K> et = new DirectionalDerivative<U,A,R,S,K>( fac , dim , ord , dfac );
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:20,
代码来源:DirectionalDerivativeType.java

示例13: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	EinsteinTensorElemFactory<Z, SymbolicElem<R, S>, SymbolicElemFactory<R, S>> fac = graph.get( layout[ 0 ] );
	Z index = graph.get( layout[ 1 ] );
	U dim = graph.get( layout[ 2 ] );
	FlowVectorFactory<R,S,K> dfac = graph.get( layout[ 3 ] );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( index == null )
		throw( new RuntimeException( "Failed" ) );
	if( dim == null )
		throw( new RuntimeException( "Failed" ) );
	if( dfac == null )
		throw( new RuntimeException( "Failed" ) );
	final FlowVectorTensor<Z,U,R,S,K> et = new FlowVectorTensor<Z,U,R,S,K>( fac , index , dim , dfac );
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:20,
代码来源:FlowVectorTensorType.java

示例14: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	SymbolicElem<EinsteinTensorElem<Z,R,S>,EinsteinTensorElemFactory<Z,R,S>> elem = graph.get( layout[ 0 ] );
	EinsteinTensorElemFactory<Z,R,S> fac = graph.get( layout[ 1 ] );
	HashSet<Z> contravariantReduce = graph.get( layout[ 2 ] );
	HashSet<Z> covariantReduce = graph.get( layout[ 2 ] );
	if( elem == null )
		throw( new RuntimeException( "Failed" ) );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( contravariantReduce == null )
		throw( new RuntimeException( "Failed" ) );
	if( covariantReduce == null )
		throw( new RuntimeException( "Failed" ) );
	final SymbolicIndexReduction<Z,R,S> et = new SymbolicIndexReduction<Z,R,S>( elem , fac , contravariantReduce , covariantReduce );
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:20,
代码来源:SymbolicIndexReductionType.java

示例15: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	EinsteinTensorElemFactory<Z, SymbolicElem<R, S>, SymbolicElemFactory<R, S>> fac = graph.get( layout[ 0 ] );
	Z index = graph.get( layout[ 1 ] );
	U dim = graph.get( layout[ 2 ] );
	DirectionalDerivativePartialFactory<R,S,K> dfac = graph.get( layout[ 3 ] );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( index == null )
		throw( new RuntimeException( "Failed" ) );
	if( dim == null )
		throw( new RuntimeException( "Failed" ) );
	if( dfac == null )
		throw( new RuntimeException( "Failed" ) );
	final OrdinaryDerivative<Z,U,R,S,K> et = new OrdinaryDerivative<Z,U,R,S,K>( fac , index , dim , dfac );
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:20,
代码来源:OrdinaryDerivativeType.java

示例16: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	SymbolicElem<EinsteinTensorElem<Z,R,S>,EinsteinTensorElemFactory<Z,R,S>> elem = graph.get( layout[ 0 ] );
	EinsteinTensorElemFactory<Z,R,S> fac = graph.get( layout[ 1 ] );
	ArrayList<Z> newContravar = graph.get( layout[ 2 ] );
	if( elem == null )
		throw( new RuntimeException( "Failed" ) );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( newContravar == null )
		throw( new RuntimeException( "Failed" ) );
	final SymbolicRegenCovar<Z,R,S> et = new SymbolicRegenCovar<Z,R,S>( elem , fac , newContravar );
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:17,
代码来源:SymbolicRegenCovarType.java

示例17: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	SymbolicElem<EinsteinTensorElem<Z,R,S>,EinsteinTensorElemFactory<Z,R,S>> elem = graph.get( layout[ 0 ] );
	EinsteinTensorElemFactory<Z,R,S> fac = graph.get( layout[ 1 ] );
	ArrayList<Z> newContravar = graph.get( layout[ 2 ] );
	if( elem == null )
		throw( new RuntimeException( "Failed" ) );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( newContravar == null )
		throw( new RuntimeException( "Failed" ) );
	final SymbolicRegenContravar<Z,R,S> et = new SymbolicRegenContravar<Z,R,S>( elem , fac , newContravar );
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:17,
代码来源:SymbolicRegenContravarType.java

示例18: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	ArrayList<Z> contravar = graph.get( layout[ 0 ] );
	ArrayList<Z> covar = graph.get( layout[ 1 ] );
	S fac = graph.get( layout[ 2 ] );
	Map<ArrayList<BigInteger>,R> map = graph.get( layout[ 3 ] );
	if( contravar == null )
		throw( new RuntimeException( "Failed" ) );
	if( covar == null )
		throw( new RuntimeException( "Failed" ) );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( map == null )
		throw( new RuntimeException( "Failed" ) );
	final EinsteinTensorElem<Z,R,S> et = new EinsteinTensorElem<Z,R,S>( fac , contravar , covar );
	for( final Entry<ArrayList<BigInteger>, R> ii : map.entrySet() )
	{
		ArrayList<BigInteger> key = ii.getKey();
		R val = ii.getValue();
		et.setVal( key , val );
	}
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:26,
代码来源:EinsteinTensorElemType.java

示例19: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	SymbolicElem<EinsteinTensorElem<Z,R,S>,EinsteinTensorElemFactory<Z,R,S>> elem = graph.get( layout[ 0 ] );
	EinsteinTensorElemFactory<Z,R,S> fac = graph.get( layout[ 1 ] );
	SymbolicTensorResym.ResymType reSym = graph.get( layout[ 2 ] );
	U dim = graph.get( layout[ 3 ] );
	if( elem == null )
		throw( new RuntimeException( "Failed" ) );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( reSym == null )
		throw( new RuntimeException( "Failed" ) );
	if( dim == null )
		throw( new RuntimeException( "Failed" ) );
	final SymbolicTensorResym<Z,U,R,S> et = new SymbolicTensorResym<Z,U,R,S>( elem , fac , reSym , dim );
	return( et );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:20,
代码来源:SymbolicTensorResymType.java

示例20: make

点赞 3

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@Override
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet,
		IncidenceSetRef incidenceSet) {
	HGHandle[] layout = graph.getStore().getLink( handle );
	S fac = graph.get( layout[ 0 ] );
	U dim = graph.get( layout[ 1 ] );
	Map<ArrayList<BigInteger>,R> map = graph.get( layout[ 2 ] );
	if( fac == null )
		throw( new RuntimeException( "Failed" ) );
	if( dim == null )
		throw( new RuntimeException( "Failed" ) );
	if( map == null )
		throw( new RuntimeException( "Failed" ) );
	final SquareMatrixElem<U,R,S> mat = new SquareMatrixElem<U,R,S>( fac , dim );
	for( final Map.Entry<ArrayList<BigInteger>, R> ite : map.entrySet() )
	{
		ArrayList<BigInteger> key = ite.getKey();
		R val = ite.getValue();
		final BigInteger row = key.get( 0 );
		final BigInteger col = key.get( 1 );
		mat.setVal( row , col , val );
	}
	return( mat );
}
 

开发者ID:viridian1138,
项目名称:SimpleAlgebra_V2,
代码行数:25,
代码来源:SquareMatrixElemType.java

示例21: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Object make(HGPersistentHandle valueHandle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
   {
       HGPersistentHandle [] layout = graph.getStore().getLink(valueHandle);
       HGAtomType stype = graph.getTypeSystem().getAtomType(String.class);
       HGAtomType collType = graph.getTypeSystem().getAtomType(ArrayList.class);  
       HyperGraph db = HGEnvironment.get((String) stype.make(layout[0], null, null));
       Collection<FNode> nodes = (Collection<FNode>)collType.make(layout[1], null, null);
       Collection<FEdge> edges = (Collection<FEdge>)collType.make(layout[2], null, null);
      
       return new HGViewer(db, nodes, edges);
   }
 

开发者ID:hypergraphdb,
项目名称:viewer,
代码行数:13,
代码来源:HGViewerType.java

示例22: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
/**
 * This will eagerly construct a full Json object graph regardless
 * of what is being nested into what. There are options to introduce
 * laziness here: (1) whenever a property value is not a primitive
 * or (2) whenever a property value is recognized as an entity by
 * the user provided entityPredicate in the HyperNodeJson instance. 
 * A similar laziness could be implemented for array as well, except
 * it makes a little less sense there. 
 *
 *
 * The reason everything is eagerly initialized here is that most JSON
 * business structures are comparatively small and there's a lot of caching
 * of JSON properties.
 */
public Object make(HGPersistentHandle handle,
                   LazyRef<HGHandle[]> targetSet,
                   IncidenceSetRef incidenceSet)
{
    HGHandle [] targets = targetSet.deref();
    if (targets.length == 0)
    	// HyperGraph itself will not wrap unless it sees some targets, since there is nothing the type
    	// interface to expect a link.
    	return new HGValueLink(Json.object());
    Json j = Json.object();
    for (HGHandle t : targets)
    {
        JsonProperty prop = graph.get(t);
        String name = graph.get(prop.getName());
        Json value = null;            
        Object x = graph.get(prop.getValue());
        if (x instanceof HGValueLink)
            value = (Json)((HGValueLink)x).getValue();
        else
            value = (Json)x;         
        if (value.isObject() && node.getEntityInterface().isEntity(value))
        	value = node.getEntityInterface().createEntityReference(node, prop.getValue());
            //value.set("hghandle", prop.getValue().getPersistent().toString());
        j.set(name, value);
    }
    return j;
}
 

开发者ID:hypergraphdb,
项目名称:mjson,
代码行数:42,
代码来源:ObjectTypeJson.java

示例23: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle,
        LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet)
{
    byte[] B = graph.getStore().getData(handle);
    String s = new String(B);
    return Integer.parseInt(s);
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:8,
代码来源:PredefinedReplacement.java

示例24: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	if (targetSet == null)
	{
		if (targetTypes != null && targetTypes.length > 0)
			throw new HGException("HGRelType.make: expected a target set of size " + 
					targetTypes.length +  " but got a null.");
	}
	else if (targetSet.deref().length != targetTypes.length)
		throw new HGException("HGRelType.make: expected a target set of size " + 
				targetTypes.length + " but got size " + targetSet.deref().length);		
	return new HGRel(name, targetSet.deref());
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:14,
代码来源:HGRelType.java

示例25: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	byte [] data = hg.getStore().getData(handle);
	HGAtomStack stack = new HGAtomStack();
	for (int i = 0; i < data.length; i += 16)
	{
		stack.push(hg.getHandleFactory().makeHandle(data, i));			
	}
	return stack;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:11,
代码来源:AtomStackType.java

示例26: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	HGAtomQueue queue = new HGAtomQueue();
	byte [] data = hg.getStore().getData(handle);
	for (int i = 0; i < data.length; i += 16)
	{
		queue.enqueue(hg.getHandleFactory().makeHandle(data, i));			
	}		
	return queue;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:11,
代码来源:AtomQueueType.java

示例27: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	byte [] data = graph.getStore().getData(handle);
	HGAtomSet set = new HGAtomSet();
	for (int  pos = 0; pos < data.length; pos += 16)
		set.add(graph.getHandleFactory().makeHandle(data, pos));
	return set;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:9,
代码来源:AtomSetType.java

示例28: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle,
				   LazyRef<HGHandle[]> targetSet, 
				   IncidenceSetRef incidenceSet)
{
	HGPersistentHandle[] layout = graph.getStore().getLink(handle);
	Object result;
	if (targetSet == null || targetSet.deref().length == 0)
		result = Array.newInstance(clazz, layout.length / 2);
	else
	{
		if (linkConstructor == null)
			throw new HGException(
					"Unable to construct a link of type "
							+ clazz.getName()
							+ ", the class doesn't have a HGHandle [] based constructor.");
		try
		{
			result = linkConstructor.newInstance(new Object[] { targetSet });
		} 
		catch (Throwable t)
		{
			throw new HGException(t);
		}
	}
	TypeUtils.setValueFor(graph, handle, result);
	for (int i = 0; i < layout.length; i += 2)
	{
		Object current = null;
		HGPersistentHandle typeHandle = layout[i];
		HGPersistentHandle valueHandle = layout[i + 1];
		if (!typeHandle.equals(graph.getHandleFactory().nullHandle()))
		{
			HGAtomType type = graph.getTypeSystem().getType(typeHandle);
			current = TypeUtils.makeValue(graph, valueHandle, type);
		}
		((Object[])result)[i / 2] = current;
	}
	return result;
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:40,
代码来源:ArrayType.java

示例29: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	byte [] data = graph.getStore().getData(handle);
	HGAtomRef.Mode mode = HGAtomRef.Mode.get(data[MODE_OFFSET]);
	HGPersistentHandle atomHandle = graph.getHandleFactory().makeHandle(data, ATOM_HANDLE_OFFSET);
	return new HGAtomRef(atomHandle, mode);
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:8,
代码来源:AtomRefType.java

示例30: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet) 
{
	if (graph.getHandleFactory().nullHandle().equals(handle))
		return null;
	byte [] bytes = graph.getStore().getData(handle); 
	return new String(bytes);
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:8,
代码来源:TextType.java

示例31: make

点赞 2

import org.hypergraphdb.IncidenceSetRef; //导入依赖的package包/类
public Object make(HGPersistentHandle handle, LazyRef<HGHandle[]> targetSet, IncidenceSetRef incidenceSet)
{
    HGPersistentHandle [] layout = hg.getStore().getLink(handle);
    HGAtomType labelType = hg.getTypeSystem().getAtomType(String.class);
    String label = (String)labelType.make(layout[1], null, null);        
    return new Slot(label, layout[0]);
}
 

开发者ID:hypergraphdb,
项目名称:hypergraphdb,
代码行数:8,
代码来源:SlotType.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)