public int getTypeValue() { return type.type(); }
public static boolean isInline(NodeId nodeId) { return NodeIdType.isInline(nodeId.type); }
public static final boolean isConcrete(NodeId nodeId) { return ! NodeIdType.isSpecial(nodeId.type); } }
private static NodeId create(int v1, long v2) { if ( !BitsInt.isSet(v1, 32) ) return createPtrLong(v1, v2); int t = v1 >> 24; NodeIdType type = NodeIdType.intToEnum(t); if ( type == NodeIdType.SPECIAL ) throw new TDBException(String.format("Attempt to create a special from a long: 0x%016", v2)); return createNew(type, 0, v2); }
public boolean isValue() { return type != PTR && NodeIdType.isStorable(type); }
public static NodeIdType intToEnum(int x) { if ( x >= 0x80 ) throw new IllegalArgumentException("Value '"+x+"' not legal: too large"); if ( x != 0 ) x = TYPES.enc(x); NodeIdType t = intToEnum$(x); if ( t == INVALID$ ) throw new IllegalArgumentException("Value '"+x+"' not legal for "+NodeIdType.class.getSimpleName()); return t ; }
static boolean isStorable(NodeIdType type) { return !isSpecial(type); }
private static NodeId create64(long value2) { if ( !BitsLong.isSet(value2, 63) ) return createPtr(value2); // Inline. long v2 = value2; if ( BitsLong.isSet(v2, 62) ) { // XSD_DOUBLE v2 = DoubleNode62.removeType(v2); return NodeId.createRaw(NodeIdType.XSD_DOUBLE, v2); } int t = (int)BitsLong.unpack(v2, 56, 63); // 7 bits v2 = BitsLong.clear(v2, 56, 64); NodeIdType type = NodeIdType.intToEnum(t); if ( type == NodeIdType.SPECIAL ) throw new TDBException(String.format("Attempt to create a special from a long: 0x%016", v2)); return NodeId.createRaw(type, v2); }
@Test public void nodeId_ptr_03() { NodeId nodeId = NodeIdFactory.createPtr(39); // 64 bit long x = nodeId.getValue2(); long t = BitsLong.unpack(x, 56, 64); assertEquals(0, t); assertEquals(NodeIdType.PTR.type(), t); }
private static NodeId create(NodeIdType type, int v1, long v2) { if ( isSpecial(type) ) { if ( NodeId.equals(NodeId.NodeDoesNotExist, v1, v2) ) return NodeId.NodeDoesNotExist; if ( NodeId.equals(NodeId.NodeIdAny, v1, v2) ) return NodeId.NodeIdAny; if ( NodeId.equals(NodeId.NodeIdDefined, v1, v2) ) return NodeId.NodeIdDefined; if ( NodeId.equals(NodeId.NodeIdDefined, v1, v2) ) return NodeId.NodeIdDefined; if ( NodeId.equals(NodeId.NodeIdUndefined, v1, v2) ) return NodeId.NodeIdUndefined; //throw new IllegalArgumentException("Special not recognized"); } return createNew(type, v1, v2); }
@Test public void nodeId_ptr_03() { NodeId nodeId = NodeIdFactory.createPtr(39); // 64 bit long x = nodeId.getValue2(); long t = BitsLong.unpack(x, 56, 64); assertEquals(0, t); assertEquals(NodeIdType.PTR.type(), t); }