use of org.neo4j.kernel.impl.util.RelIdArrayWithLoops in project neo4j-mobile-android by neo4j-contrib.
the class NodeManager method receiveRelationships.
private void receiveRelationships(Iterable<RelationshipRecord> rels, ArrayMap<String, RelIdArray> newRelationshipMap, Map<Long, RelationshipImpl> relsMap, DirectionWrapper dir, boolean hasLoops) {
for (RelationshipRecord rel : rels) {
long relId = rel.getId();
RelationshipImpl relImpl = relCache.get(relId);
RelationshipType type = null;
if (relImpl == null) {
type = getRelationshipTypeById(rel.getType());
assert type != null;
relImpl = newRelationshipImpl(relId, rel.getFirstNode(), rel.getSecondNode(), type, rel.getType(), false);
relsMap.put(relId, relImpl);
// relCache.put( relId, relImpl );
} else {
type = relImpl.getType(this);
}
RelIdArray relationshipSet = newRelationshipMap.get(type.name());
if (relationshipSet == null) {
relationshipSet = hasLoops ? new RelIdArrayWithLoops(type.name()) : new RelIdArray(type.name());
newRelationshipMap.put(type.name(), relationshipSet);
}
relationshipSet.add(relId, dir);
}
}
use of org.neo4j.kernel.impl.util.RelIdArrayWithLoops in project neo4j-mobile-android by neo4j-contrib.
the class LockReleaser method getCowRelationshipAddMap.
public RelIdArray getCowRelationshipAddMap(NodeImpl node, String type, boolean create) {
PrimitiveElement primitiveElement = getAndSetupPrimitiveElement();
ArrayMap<Long, CowNodeElement> cowElements = primitiveElement.nodes;
CowNodeElement element = cowElements.get(node.getId());
if (element == null) {
element = new CowNodeElement();
cowElements.put(node.getId(), element);
}
if (element.relationshipAddMap == null) {
element.relationshipAddMap = new ArrayMap<String, RelIdArray>();
}
RelIdArray set = element.relationshipAddMap.get(type);
if (set == null) {
set = new RelIdArrayWithLoops(type);
element.relationshipAddMap.put(type, set);
}
return set;
}
Aggregations