@Override public Object getByIndex(long propIndex) { return _resolver.resolveState(this).get(propIndex); }
@Override public Node setAt(int index, byte type, Object value) { final NodeState unPhasedState = this._resolver.resolveState(this); boolean isDiff = (type != unPhasedState.getType(index)); if (!isDiff) { isDiff = !isEquals(unPhasedState.get(index), value, type); } if (isDiff) { final NodeState preciseState = this._resolver.alignState(this); if (preciseState != null) { preciseState.set(index, type, value); } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } } return this; }
@Override public void unindex(String indexName, org.mwg.Node nodeToIndex, String flatKeyAttributes, Callback<Boolean> callback) { final String[] keyAttributes = flatKeyAttributes.split(Constants.QUERY_SEP + ""); final NodeState currentNodeState = this._resolver.alignState(this); if (currentNodeState == null) { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } LongLongArrayMap indexMap = (LongLongArrayMap) currentNodeState.get(this._resolver.stringToHash(indexName, false)); if (indexMap != null) { Query flatQuery = _graph.newQuery(); final NodeState toIndexNodeState = this._resolver.resolveState(nodeToIndex); for (int i = 0; i < keyAttributes.length; i++) { String attKey = keyAttributes[i]; Object attValue = toIndexNodeState.getFromKey(attKey); if (attValue != null) { flatQuery.add(attKey, attValue.toString()); } else { flatQuery.add(attKey, null); } } //TODO AUTOMATIC UPDATE indexMap.remove(flatQuery.hash(), nodeToIndex.id()); } if (Constants.isDefined(callback)) { callback.on(true); } }
final NodeState previousState = this._resolver.resolveState(this); if (previousState != null) { LongLongArrayMap previousMap = (LongLongArrayMap) previousState.get(hashName); if (previousMap != null) { alreadyIndexed = previousMap.contains(flatQuery.hash(), nodeToIndex.id());
@Override public void setProperty(String propertyName, byte propertyType, Object propertyValue) { //hash the property a single time final long hashed = this._resolver.stringToHash(propertyName, true); final NodeState unPhasedState = this._resolver.resolveState(this); boolean isDiff = (propertyType != unPhasedState.getType(hashed)); if (!isDiff) { isDiff = !isEquals(unPhasedState.get(hashed), propertyValue, propertyType); } if (isDiff) { final NodeState preciseState = this._resolver.alignState(this); if (preciseState != null) { preciseState.set(hashed, propertyType, propertyValue); } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } } }
@Override public Object getAt(int propIndex) { return _resolver.resolveState(this).get(propIndex); }
switch (resolved.getType(relationIndex)) { case Type.RELATION: final Relation relation = (Relation) resolved.get(relationIndex); if (relation == null || relation.size() == 0) { callback.on(new Node[0]); final RelationIndexed relation_indexed = (RelationIndexed) resolved.get(relationIndex); if (relation_indexed == null || relation_indexed.size() == 0) { callback.on(new Node[0]);
@Override public Object get(String propertyName) { final NodeState resolved = this._resolver.resolveState(this); if (resolved != null) { return resolved.get(this._resolver.stringToHash(propertyName, false)); } return null; }
@Override public Object get(String name) { final NodeState resolved = this._resolver.resolveState(this); if (resolved != null) { return resolved.get(this._resolver.stringToHash(name, false)); } return null; }
@Override public final void remove(String relationName, Node relatedNode) { if (relatedNode != null) { final NodeState preciseState = this._resolver.alignState(this); final long relHash = this._resolver.stringToHash(relationName, false); if (preciseState != null) { Relationship relationArray = (Relationship) preciseState.get(relHash); if (relationArray != null) { relationArray.remove(relatedNode.id()); } } else { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } } }
boolean exact = true; for (int j = 0; j < query.attributes().length; j++) { Object obj = resolvedState.get(query.attributes()[j]); if (query.values()[j] == null) { if (obj != null) {
@Override public void findAll(final String indexName, final Callback<Node[]> callback) { final NodeState currentNodeState = this._resolver.resolveState(this); if (currentNodeState == null) { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } final LongLongArrayMap indexMap = (LongLongArrayMap) currentNodeState.get(this._resolver.stringToHash(indexName, false)); if (indexMap != null) { final long[] ids = new long[(int) indexMap.size()]; final int[] idIndex = {0}; indexMap.each(new LongLongArrayMapCallBack() { @Override public void on(final long hash, final long nodeId) { ids[idIndex[0]] = nodeId; idIndex[0]++; } }); _resolver.lookupAll(world(), time(), ids, new Callback<Node[]>() { @Override public void on(Node[] result) { //TODO shrink result callback.on(result); } }); } else { callback.on(new org.mwg.plugin.AbstractNode[0]); } }
boolean exact = true; for (int j = 0; j < query.attributes().length; j++) { Object obj = resolvedState.get(query.attributes()[j]); if (query.values()[j] == null) { if (obj != null) {
final Relationship relationArray = (Relationship) resolved.get(relationIndex); if (relationArray == null || relationArray.size() == 0) { callback.on(new Node[0]);
queryTime = time(); final LongLongArrayMap indexMap = (LongLongArrayMap) currentNodeState.get(this._resolver.stringToHash(indexName, false)); if (indexMap != null) { final AbstractNode selfPointer = this;