Search in sources :

Example 26 with RelIdArray

use of org.neo4j.kernel.impl.util.RelIdArray in project graphdb by neo4j-attic.

the class NodeImpl method getAllRelationships.

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;
}
Also used : RelIdArray(org.neo4j.kernel.impl.util.RelIdArray) LinkedList(java.util.LinkedList)

Aggregations

RelIdArray (org.neo4j.kernel.impl.util.RelIdArray)26 ArrayMap (org.neo4j.kernel.impl.util.ArrayMap)5 LinkedList (java.util.LinkedList)4 Map (java.util.Map)4 RelationshipType (org.neo4j.graphdb.RelationshipType)4 Test (org.junit.Test)3 RelIdIterator (org.neo4j.kernel.impl.util.RelIdArray.RelIdIterator)3 RelIdIterator (org.neo4j.kernel.impl.util.RelIdIterator)3 PropertyData (org.neo4j.kernel.impl.nioneo.store.PropertyData)2 CombinedRelIdIterator (org.neo4j.kernel.impl.util.CombinedRelIdIterator)2 RelIdArrayWithLoops (org.neo4j.kernel.impl.util.RelIdArrayWithLoops)2 HashMap (java.util.HashMap)1 RelationshipChainPosition (org.neo4j.kernel.impl.nioneo.store.RelationshipChainPosition)1 RelationshipData (org.neo4j.kernel.impl.nioneo.store.RelationshipData)1 RelationshipRecord (org.neo4j.kernel.impl.nioneo.store.RelationshipRecord)1