use of org.neo4j.kernel.impl.util.CombinedRelIdIterator in project neo4j-mobile-android by neo4j-contrib.
the class NodeImpl method getAllRelationshipsOfType.
List<RelIdIterator> getAllRelationshipsOfType(NodeManager nodeManager, DirectionWrapper direction, RelationshipType... types) {
ensureRelationshipMapNotNull(nodeManager);
List<RelIdIterator> relTypeList = new LinkedList<RelIdIterator>();
boolean hasModifications = nodeManager.getLockReleaser().hasRelationshipModifications(this);
for (RelationshipType type : types) {
String typeName = type.name();
RelIdArray src = getRelIdArray(typeName);
Collection<Long> remove = null;
RelIdArray add = null;
RelIdIterator iterator = null;
if (hasModifications) {
remove = nodeManager.getCowRelationshipRemoveMap(this, typeName);
add = nodeManager.getCowRelationshipAddMap(this, typeName);
iterator = new CombinedRelIdIterator(typeName, direction, src, add, remove);
} else {
iterator = src != null ? src.iterator(direction) : empty(typeName).iterator(direction);
}
relTypeList.add(iterator);
}
return relTypeList;
}
use of org.neo4j.kernel.impl.util.CombinedRelIdIterator 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;
}
Aggregations