use of org.neo4j.kernel.impl.util.RelIdArray in project neo4j-mobile-android by neo4j-contrib.
the class NodeImpl method getAllRelationships.
List<RelIdIterator> getAllRelationships(NodeManager nodeManager, DirectionWrapper direction) {
ensureRelationshipMapNotNull(nodeManager);
List<RelIdIterator> relTypeList = new LinkedList<RelIdIterator>();
boolean hasModifications = nodeManager.getLockReleaser().hasRelationshipModifications(this);
ArrayMap<String, RelIdArray> addMap = null;
if (hasModifications) {
addMap = nodeManager.getCowRelationshipAddMap(this);
}
for (RelIdArray src : relationships) {
String type = src.getType();
Collection<Long> remove = null;
RelIdArray add = null;
RelIdIterator iterator = null;
if (hasModifications) {
remove = nodeManager.getCowRelationshipRemoveMap(this, type);
if (addMap != null) {
add = addMap.get(type);
}
iterator = new CombinedRelIdIterator(type, direction, src, add, remove);
} else {
iterator = src.iterator(direction);
}
relTypeList.add(iterator);
}
if (addMap != null) {
for (String type : addMap.keySet()) {
if (getRelIdArray(type) == null) {
Collection<Long> remove = nodeManager.getCowRelationshipRemoveMap(this, type);
RelIdArray add = addMap.get(type);
relTypeList.add(new CombinedRelIdIterator(type, direction, null, add, remove));
}
}
}
return relTypeList;
}
use of org.neo4j.kernel.impl.util.RelIdArray in project neo4j-mobile-android by neo4j-contrib.
the class NodeImpl method toRelIdArray.
private RelIdArray[] toRelIdArray(ArrayMap<String, RelIdArray> tmpRelMap) {
if (tmpRelMap == null || tmpRelMap.size() == 0) {
return NO_RELATIONSHIPS;
}
RelIdArray[] result = new RelIdArray[tmpRelMap.size()];
int i = 0;
for (RelIdArray array : tmpRelMap.values()) {
result[i++] = array;
}
return result;
}
use of org.neo4j.kernel.impl.util.RelIdArray in project graphdb by neo4j-attic.
the class NodeImpl method addRelationship.
// caller is responsible for acquiring lock
// this method is only called when a relationship is created or
// a relationship delete is undone or when the full node is loaded
void addRelationship(NodeManager nodeManager, RelationshipType type, long relId) {
RelIdArray relationshipSet = nodeManager.getCowRelationshipAddMap(this, type.name(), true);
relationshipSet.add(relId);
}
use of org.neo4j.kernel.impl.util.RelIdArray in project graphdb by neo4j-attic.
the class NodeImpl method removeRelationship.
// caller is responsible for acquiring lock
// this method is only called when a undo create relationship or
// a relationship delete is invoked.
void removeRelationship(NodeManager nodeManager, RelationshipType type, long relId) {
RelIdArray relationshipSet = nodeManager.getCowRelationshipRemoveMap(this, type.name(), true);
relationshipSet.add(relId);
}
use of org.neo4j.kernel.impl.util.RelIdArray in project graphdb by neo4j-attic.
the class NodeImpl method getMoreRelationships.
private Map<Long, RelationshipImpl> getMoreRelationships(NodeManager nodeManager, ArrayMap<String, RelIdArray> tmpRelMap) {
if (!relChainPosition.hasMore()) {
return null;
}
Pair<ArrayMap<String, RelIdArray>, Map<Long, RelationshipImpl>> pair = nodeManager.getMoreRelationships(this);
ArrayMap<String, RelIdArray> addMap = pair.first();
if (addMap.size() == 0) {
return null;
}
for (String type : addMap.keySet()) {
RelIdArray addRels = addMap.get(type);
RelIdArray srcRels = tmpRelMap.get(type);
if (srcRels == null) {
tmpRelMap.put(type, addRels);
} else {
srcRels.addAll(addRels);
}
}
return pair.other();
// nodeManager.putAllInRelCache( pair.other() );
}
Aggregations