@Override public Object getOrCreateAt(int index, byte type) { final NodeState preciseState = this._resolver.alignState(this); if (preciseState != null) { return preciseState.getOrCreate(index, type); } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } }
@Override public final Object getOrCreate(String propertyName, byte propertyType) { final NodeState preciseState = this._resolver.alignState(this); if (preciseState != null) { return preciseState.getOrCreate(this._resolver.stringToHash(propertyName, true), propertyType); } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } }
@Override public Node addToRelationAt(int relationIndex, Node relatedNode, String... attributes) { if (relatedNode != null) { NodeState preciseState = this._resolver.alignState(this); if (preciseState != null) { boolean attributesNotEmpty = (attributes != null && attributes.length > 0); if (attributesNotEmpty) { RelationIndexed indexedRel = (RelationIndexed) preciseState.getOrCreate(relationIndex, Type.RELATION_INDEXED); indexedRel.add(relatedNode, attributes); } else { Relation relationArray = (Relation) preciseState.getOrCreate(relationIndex, Type.RELATION); relationArray.add(relatedNode.id()); } } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } } return this; }
@Override public Node removeFromRelationAt(int relationIndex, Node relatedNode, String... attributes) { if (relatedNode != null) { final NodeState preciseState = this._resolver.alignState(this); if (preciseState != null) { boolean attributesNotEmpty = (attributes != null && attributes.length > 0); if (attributesNotEmpty) { RelationIndexed indexedRel = (RelationIndexed) preciseState.getOrCreate(relationIndex, Type.RELATION_INDEXED); indexedRel.remove(relatedNode, attributes); } else { Relation relationArray = (Relation) preciseState.getOrCreate(relationIndex, Type.RELATION); relationArray.remove(relatedNode.id()); } } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } } return this; }
@Override public final void add(String relationName, Node relatedNode) { if (relatedNode != null) { NodeState preciseState = this._resolver.alignState(this); final long relHash = this._resolver.stringToHash(relationName, true); if (preciseState != null) { Relationship relationArray = (Relationship) preciseState.getOrCreate(relHash, Type.RELATION); relationArray.add(relatedNode.id()); } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } } }
throw new RuntimeException(Constants.CACHE_MISS_ERROR); LongLongArrayMap indexMap = (LongLongArrayMap) currentNodeState.getOrCreate(hashName, Type.LONG_TO_LONG_ARRAY_MAP); indexMap.put(flatQuery.hash(), nodeToIndex.id());