Package org.neo4j.collections.btree

Examples of org.neo4j.collections.btree.KeyEntry


    }
    Transaction tx = graphDb.beginTx();
    try
    {
      int hashCode = key.hashCode();
      KeyEntry entry = bTree.addIfAbsent( hashCode, value );
      if ( entry != null )
      {
        entry.setKeyValue( key );
      }
      else
      {
        entry = bTree.getAsKeyEntry( hashCode );
        Object goOtherNode = entry.getKeyValue();
        Node bucketNode = null;
        if ( !goOtherNode.equals( GOTO_NODE ) )
        {
          Object prevValue = entry.getValue();
          Object prevKey = entry.getKeyValue();
          if ( prevKey.equals( key ) )
          {
            Object oldValue = entry.getValue();
            entry.setValue( value );
            tx.success();
            return (V) oldValue;
          }
          entry.setKeyValue( GOTO_NODE );
          bucketNode = graphDb.createNode();
          entry.setValue( bucketNode.getId() );
          Node prevEntry = graphDb.createNode();
          bucketNode.createRelationshipTo( prevEntry,
            RelTypes.MAP_ENTRY );
          prevEntry.setProperty( MAP_KEY, prevKey );
          prevEntry.setProperty( MAP_VALUE, prevValue );
          Node newEntry = graphDb.createNode();
          bucketNode.createRelationshipTo( newEntry,
            RelTypes.MAP_ENTRY );
          newEntry.setProperty( MAP_KEY, key );
          newEntry.setProperty( MAP_VALUE, value );
        }
        else
        {
          bucketNode = graphDb.getNodeById( (Long) entry.getValue() );
          for ( Relationship rel : bucketNode.getRelationships(
            RelTypes.MAP_ENTRY, Direction.OUTGOING ) )
          {
            Node entryNode = rel.getEndNode();
            if ( entryNode.getProperty( MAP_KEY ).equals( key ) )
View Full Code Here


  {
    Transaction tx = graphDb.beginTx();
    try
    {
      int hashCode = key.hashCode();
      KeyEntry entry = bTree.getAsKeyEntry( hashCode );
      if ( entry != null )
      {
        Object goOtherNode = entry.getKeyValue();
        if ( !goOtherNode.equals( GOTO_NODE ) )
        {
          if ( goOtherNode.equals( key ) )
          {
            Object value = entry.getValue();
            entry.remove();
            tx.success();
            return (V) value;
          }
        }
        else
        {
          Node bucketNode = graphDb.getNodeById(
            (Long) entry.getValue() );
          for ( Relationship rel : bucketNode.getRelationships(
            RelTypes.MAP_ENTRY, Direction.OUTGOING ) )
          {
            Node entryNode = rel.getEndNode();
            if ( entryNode.getProperty( MAP_KEY ).equals( key ) )
View Full Code Here

  {
    Transaction tx = graphDb.beginTx();
    try
    {
      int hashCode = key.hashCode();
      KeyEntry entry = bTree.getAsKeyEntry( hashCode );
      if ( entry != null )
      {
        Object goOtherNode = entry.getKeyValue();
        if ( !goOtherNode.equals( GOTO_NODE ) )
        {
          if ( goOtherNode.equals( key ) )
          {
            tx.success();
            return (V) entry.getValue();
          }
        }
        else
        {
          Node bucketNode = graphDb.getNodeById(
            (Long) entry.getValue() );
          for ( Relationship rel : bucketNode.getRelationships(
            RelTypes.MAP_ENTRY, Direction.OUTGOING ) )
          {
            Node entryNode = rel.getEndNode();
            if ( entryNode.getProperty( MAP_KEY ).equals( key ) )
View Full Code Here

TOP

Related Classes of org.neo4j.collections.btree.KeyEntry

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.