List<RelTypeElementIterator> getAllRelationships(NodeManager nodeManager) { ensureRelationshipMapNotNull(nodeManager); List<RelTypeElementIterator> relTypeList = new LinkedList<RelTypeElementIterator>(); boolean hasModifications = nodeManager.getLockReleaser().hasRelationshipModifications(this); ArrayMap<String, RelIdArray> addMap = null; if (hasModifications) { addMap = nodeManager.getCowRelationshipAddMap(this); } for (String type : relationshipMap.keySet()) { RelIdArray src = relationshipMap.get(type); RelIdArray remove = null; RelIdArray add = null; if (hasModifications) { remove = nodeManager.getCowRelationshipRemoveMap(this, type); if (addMap != null) { add = addMap.get(type); } } // if ( src != null || add != null ) // { relTypeList.add(RelTypeElement.create(type, this, src, add, remove)); // } } if (addMap != null) { for (String type : addMap.keySet()) { if (relationshipMap.get(type) == null) { RelIdArray remove = nodeManager.getCowRelationshipRemoveMap(this, type); RelIdArray add = addMap.get(type); relTypeList.add(RelTypeElement.create(type, this, null, add, remove)); } } } return relTypeList; }
List<RelTypeElementIterator> getAllRelationships(NodeManager nodeManager) { ensureRelationshipMapNotNull(nodeManager); List<RelTypeElementIterator> relTypeList = new LinkedList<RelTypeElementIterator>(); ArrayMap<String, IntArray> addMap = nodeManager.getCowRelationshipAddMap(this); for (String type : relationshipMap.keySet()) { IntArray src = relationshipMap.get(type); IntArray remove = nodeManager.getCowRelationshipRemoveMap(this, type); IntArray add = null; if (addMap != null) { add = addMap.get(type); } if (src != null || add != null) { relTypeList.add(RelTypeElement.create(type, this, src, add, remove)); } } if (addMap != null) { for (String type : addMap.keySet()) { if (relationshipMap.get(type) == null) { IntArray remove = nodeManager.getCowRelationshipRemoveMap(this, type); IntArray add = addMap.get(type); relTypeList.add(RelTypeElement.create(type, this, null, add, remove)); } } } return relTypeList; }
List<RelTypeElementIterator> getAllRelationshipsOfType( NodeManager nodeManager, RelationshipType... types) { ensureRelationshipMapNotNull(nodeManager); List<RelTypeElementIterator> relTypeList = new LinkedList<RelTypeElementIterator>(); for (RelationshipType type : types) { IntArray src = relationshipMap.get(type.name()); IntArray remove = nodeManager.getCowRelationshipRemoveMap(this, type.name()); IntArray add = nodeManager.getCowRelationshipAddMap(this, type.name()); if (src != null || add != null) { relTypeList.add(RelTypeElement.create(type.name(), this, src, add, remove)); } } return relTypeList; }
List<RelTypeElementIterator> getAllRelationshipsOfType( NodeManager nodeManager, RelationshipType... types) { ensureRelationshipMapNotNull(nodeManager); List<RelTypeElementIterator> relTypeList = new LinkedList<RelTypeElementIterator>(); boolean hasModifications = nodeManager.getLockReleaser().hasRelationshipModifications(this); for (RelationshipType type : types) { RelIdArray src = relationshipMap.get(type.name()); RelIdArray remove = null; RelIdArray add = null; if (hasModifications) { remove = nodeManager.getCowRelationshipRemoveMap(this, type.name()); add = nodeManager.getCowRelationshipAddMap(this, type.name()); } // if ( src != null || add != null ) // { relTypeList.add(RelTypeElement.create(type.name(), this, src, add, remove)); // } } return relTypeList; }
// 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); }