use of org.neo4j.kernel.impl.util.RelIdIterator 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.RelIdIterator in project neo4j-mobile-android by neo4j-contrib.
the class LockReleaser method populateCreatedNodes.
private void populateCreatedNodes(PrimitiveElement element, TransactionDataImpl result) {
RelIdArray createdNodes = nodeManager.getCreatedNodes();
for (RelIdIterator iterator = createdNodes.iterator(DirectionWrapper.BOTH); iterator.hasNext(); ) {
long nodeId = iterator.next();
if (element != null && element.nodes != null) {
CowNodeElement nodeElement = element.nodes.get(nodeId);
if (nodeElement != null && nodeElement.deleted) {
continue;
}
}
result.created(new NodeProxy(nodeId, nodeManager));
}
}
use of org.neo4j.kernel.impl.util.RelIdIterator in project neo4j-mobile-android by neo4j-contrib.
the class LockReleaser method populateNodeRelEvent.
private void populateNodeRelEvent(PrimitiveElement element, TransactionDataImpl result, long nodeId, RelIdArray createdRels) {
for (RelIdIterator iterator = createdRels.iterator(DirectionWrapper.BOTH); iterator.hasNext(); ) {
long relId = iterator.next();
CowRelElement relElement = element.relationships.get(relId);
if (relElement != null && relElement.deleted) {
continue;
}
RelationshipProxy rel = new RelationshipProxy(relId, nodeManager);
if (rel.getStartNode().getId() == nodeId) {
result.created(new RelationshipProxy(relId, nodeManager));
}
}
}
use of org.neo4j.kernel.impl.util.RelIdIterator 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