private RecordSet <RelationshipRecord> ExpandChain(RelationshipRecord record, long nodeId, RelationshipChainDirection direction)
        {
            RecordSet <RelationshipRecord> chain = new RecordSet <RelationshipRecord>();

            chain.Add(record);
            RelationshipRecord currentRecord = record;
            long nextRelId = direction.fieldFor(nodeId, currentRecord).relOf(currentRecord);

            while (currentRecord.InUse() && !direction.fieldFor(nodeId, currentRecord).endOfChain(currentRecord))
            {
                currentRecord = _recordStore.getRecord(nextRelId, _recordStore.newRecord(), FORCE);
                chain.Add(currentRecord);
                nextRelId = direction.fieldFor(nodeId, currentRecord).relOf(currentRecord);
            }
            return(chain);
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void toStringShouldPlaceEachRecordOnItsOwnLine()
        internal virtual void ToStringShouldPlaceEachRecordOnItsOwnLine()
        {
            // given
            NodeRecord             record1 = new NodeRecord(1, false, 1, 1);
            NodeRecord             record2 = new NodeRecord(2, false, 2, 2);
            RecordSet <NodeRecord> set     = new RecordSet <NodeRecord>();

            set.Add(record1);
            set.Add(record2);

            // when
            string @string = set.ToString();

            // then
            string[] lines = @string.Split("\n", true);
            assertEquals(4, lines.Length);
            assertEquals("[", lines[0]);
            assertEquals(record1.ToString() + ",", lines[1]);
            assertEquals(record2.ToString() + ",", lines[2]);
            assertEquals("]", lines[3]);
        }