Ejemplo n.º 1
0
 protected internal PropertyAwareEntityStoreScan(StorageReader storageReader, long totalEntityCount, System.Func <int, bool> propertyKeyIdFilter, System.Func <long, Lock> lockFunction)
 {
     this._storageReader       = storageReader;
     this.EntityCursor         = AllocateCursor(storageReader);
     this._propertyCursor      = storageReader.AllocatePropertyCursor();
     this._propertyKeyIdFilter = propertyKeyIdFilter;
     this._lockFunction        = lockFunction;
     this._totalCount          = totalEntityCount;
     this._phaseTracker        = Org.Neo4j.Kernel.Impl.Api.index.PhaseTracker_Fields.NullInstance;
 }
        private Value CommittedValue(StoragePropertyCursor properties, long propertiesReference, int propertyKey)
        {
            properties.Init(propertiesReference);
            while (properties.Next())
            {
                if (properties.PropertyKey() == propertyKey)
                {
                    return(properties.PropertyValue());
                }
            }

            return(Values.NO_VALUE);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetAllNodeProperties()
        public virtual void ShouldGetAllNodeProperties()
        {
            // GIVEN
            string longString = "AlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalong";

            object[] properties = new object[] { longString, CreateNew(typeof(string)), CreateNew(typeof(long)), CreateNew(typeof(int)), CreateNew(typeof(sbyte)), CreateNew(typeof(short)), CreateNew(typeof(bool)), CreateNew(typeof(char)), CreateNew(typeof(float)), CreateNew(typeof(double)), Array(0, typeof(string)), Array(0, typeof(long)), Array(0, typeof(int)), Array(0, typeof(sbyte)), Array(0, typeof(short)), Array(0, typeof(bool)), Array(0, typeof(char)), Array(0, typeof(float)), Array(0, typeof(double)), Array(1, typeof(string)), Array(1, typeof(long)), Array(1, typeof(int)), Array(1, typeof(sbyte)), Array(1, typeof(short)), Array(1, typeof(bool)), Array(1, typeof(char)), Array(1, typeof(float)), Array(1, typeof(double)), Array(256, typeof(string)), Array(256, typeof(long)), Array(256, typeof(int)), Array(256, typeof(sbyte)), Array(256, typeof(short)), Array(256, typeof(bool)), Array(256, typeof(char)), Array(256, typeof(float)), Array(256, typeof(double)) };

            foreach (object value in properties)
            {
                // given
                long nodeId = CreateLabeledNode(Db, singletonMap("prop", value), Label1).Id;

                // when
                using (StorageNodeCursor node = StorageReader.allocateNodeCursor())
                {
                    node.Single(nodeId);
                    assertTrue(node.Next());

                    using (StoragePropertyCursor props = StorageReader.allocatePropertyCursor())
                    {
                        props.Init(node.PropertiesReference());
                        if (props.Next())
                        {
                            Value propVal = props.PropertyValue();

                            //then
                            assertTrue(propVal + ".equals(" + value + ")", propVal.Equals(Values.of(value)));
                        }
                        else
                        {
                            fail();
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 internal DefaultPropertyCursor(DefaultCursors pool, StoragePropertyCursor storeCursor)
 {
     this._pool        = pool;
     this._storeCursor = storeCursor;
 }
        private Value CommittedValue(RelationshipState relState, int property, StorageRelationshipScanCursor relationship, StoragePropertyCursor properties)
        {
            if (_state.relationshipIsAddedInThisTx(relState.Id))
            {
                return(Values.NO_VALUE);
            }

            relationship.Single(relState.Id);
            if (!relationship.Next())
            {
                return(Values.NO_VALUE);
            }

            return(CommittedValue(properties, relationship.PropertiesReference(), property));
        }
        private Value CommittedValue(NodeState nodeState, int property, StorageNodeCursor node, StoragePropertyCursor properties)
        {
            if (_state.nodeIsAddedInThisTx(nodeState.Id))
            {
                return(Values.NO_VALUE);
            }

            node.Single(nodeState.Id);
            if (!node.Next())
            {
                return(Values.NO_VALUE);
            }

            return(CommittedValue(properties, node.PropertiesReference(), property));
        }