Package org.neo4j.kernel.impl.util

Examples of org.neo4j.kernel.impl.util.RelIdArray


    }
   
    @Test
    public void testWithAddRemove() throws Exception
    {
        RelIdArray source = new RelIdArray();
        source.add( 1 );
        source.add( 2 );
        source.add( 3 );
        source.add( 4 );
        RelIdArray add = new RelIdArray();
        add.add( 5 );
        add.add( 6 );
        add.add( 7 );
        RelIdArray remove = new RelIdArray();
        remove.add( 2 );
        remove.add( 6 );
        List<Long> allIds = asList( RelIdArray.from( source, add, remove ) );
        Collections.sort( allIds );
        assertEquals( Arrays.asList( 1L, 3L, 4L, 5L, 7L ), allIds );
    }
View Full Code Here


    }
   
    @Test
    public void testDifferentBlocks() throws Exception
    {
        RelIdArray array = new RelIdArray();
        long justUnderIntMax = (long) Math.pow( 2, 32 )-3;
        array.add( justUnderIntMax );
        array.add( justUnderIntMax+1 );
        long justOverIntMax = (long) Math.pow( 2, 32 )+3;
        array.add( justOverIntMax );
        array.add( justOverIntMax+1 );
        long aBitOverIntMax = (long) Math.pow( 2, 33 );
        array.add( aBitOverIntMax );
        array.add( aBitOverIntMax+1 );
        long verySmall = 1000;
        array.add( verySmall );
        array.add( verySmall+1 );
       
        List<Long> allIds = asList( array );
        assertEquals( Arrays.asList(
                justUnderIntMax, justUnderIntMax+1,
                justOverIntMax, justOverIntMax+1,
View Full Code Here

                    for ( RelTypeElementIterator itr : rels )
                    {
                        RelTypeElementIterator newItr = itr;
                        if ( itr.isSrcEmpty() )
                        {
                            RelIdArray newSrc = fromNode.getRelationshipIds( itr.getType() );
                            if ( newSrc != null )
                            {
                                newItr = itr.setSrc( newSrc );
                            }
                        }
View Full Code Here

        }
        if ( element.relationshipRemoveMap == null )
        {
            element.relationshipRemoveMap = new ArrayMap<String,RelIdArray>();
        }
        RelIdArray set = element.relationshipRemoveMap.get( type );
        if ( set == null )
        {
            set = new RelIdArray();
            element.relationshipRemoveMap.put( type, set );
        }
        return set;
    }
View Full Code Here

        }
        if ( element.relationshipAddMap == null )
        {
            element.relationshipAddMap = new ArrayMap<String,RelIdArray>();
        }
        RelIdArray set = element.relationshipAddMap.get( type );
        if ( set == null )
        {
            set = new RelIdArray();
            element.relationshipAddMap.put( type, set );
        }
        return set;
    }
View Full Code Here

            }
            if ( nodeElement.relationshipAddMap != null && !nodeElement.deleted )
            {
                for ( String type : nodeElement.relationshipAddMap.keySet() )
                {
                    RelIdArray createdRels =
                        nodeElement.relationshipAddMap.get( type );
                    for ( RelIdIterator iterator = createdRels.iterator(); 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 ) );
                        }
                    }
                }
            }
            if ( nodeElement.relationshipRemoveMap != null )
            {
                for ( String type : nodeElement.relationshipRemoveMap.keySet() )
                {
                    RelIdArray deletedRels =
                        nodeElement.relationshipRemoveMap.get( type );
                    for ( RelIdIterator iterator = deletedRels.iterator(); iterator.hasNext(); )
                    {
                        long relId = iterator.next();
                        if ( nodeManager.relCreated( relId ) )
                        {
                            continue;
View Full Code Here

    }

    private void populateCreatedNodes( PrimitiveElement element,
            TransactionDataImpl result )
    {
        RelIdArray createdNodes = nodeManager.getCreatedNodes();
        for ( RelIdIterator iterator = createdNodes.iterator(); iterator.hasNext(); )
        {
            long nodeId = iterator.next();
            if ( element != null && element.nodes != null )
            {
                CowNodeElement nodeElement = element.nodes.get( nodeId );
View Full Code Here

        }
    }
   
    public RelIdArray getCreatedNodes()
    {
        RelIdArray createdNodes = new RelIdArray();
        for ( NodeRecord record : nodeRecords.values() )
        {
            if ( record.isCreated() )
            {
                createdNodes.add( record.getId() );
            }
        }
        return createdNodes;
    }
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.impl.util.RelIdArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.