コード例 #1
0
ファイル: DynamicNodeLabels.cs プロジェクト: Neo4Net/Neo4Net
        public static ICollection <DynamicRecord> AllocateRecordsForDynamicLabels(long nodeId, long[] labels, DynamicRecordAllocator allocator)
        {
            long[] storedLongs = LabelIdArray.PrependNodeId(nodeId, labels);
            ICollection <DynamicRecord> records = new List <DynamicRecord>();

            // since we can't store points in long array we passing false as possibility to store points
            DynamicArrayStore.AllocateRecords(records, storedLongs, allocator, false);
            return(records);
        }
コード例 #2
0
        private long Create(DynamicArrayStore store, object arrayToStore)
        {
            ICollection <DynamicRecord> records = new List <DynamicRecord>();

            store.AllocateRecords(records, arrayToStore);
            foreach (DynamicRecord record in records)
            {
                store.UpdateRecord(record);
            }
            return(Iterables.first(records).Id);
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRandomTest()
        public virtual void TestRandomTest()
        {
            Random                      random   = new Random(DateTimeHelper.CurrentUnixTimeMillis());
            DynamicArrayStore           store    = CreateDynamicArrayStore();
            List <long>                 idsTaken = new List <long>();
            IDictionary <long, sbyte[]> byteData = new Dictionary <long, sbyte[]>();
            float       deleteIndex  = 0.2f;
            float       closeIndex   = 0.1f;
            int         currentCount = 0;
            int         maxCount     = 128;
            ISet <long> set          = new HashSet <long>();

            while (currentCount < maxCount)
            {
                float rIndex = random.nextFloat();
                if (rIndex < deleteIndex && currentCount > 0)
                {
                    long blockId = idsTaken.Remove(random.Next(currentCount));
                    store.GetRecords(blockId, NORMAL);
                    sbyte[] bytes = ( sbyte[] )store.GetArrayFor(store.GetRecords(blockId, NORMAL));
                    ValidateData(bytes, byteData.Remove(blockId));
                    ICollection <DynamicRecord> records = store.GetRecords(blockId, NORMAL);
                    foreach (DynamicRecord record in records)
                    {
                        record.InUse = false;
                        store.UpdateRecord(record);
                        set.remove(record.Id);
                    }
                    currentCount--;
                }
                else
                {
                    sbyte[] bytes = CreateRandomBytes(random);
                    ICollection <DynamicRecord> records = new List <DynamicRecord>();
                    store.AllocateRecords(records, bytes);
                    foreach (DynamicRecord record in records)
                    {
                        Debug.Assert(!set.Contains(record.Id));
                        store.UpdateRecord(record);
                        set.Add(record.Id);
                    }
                    long blockId = Iterables.first(records).Id;
                    idsTaken.Add(blockId);
                    byteData[blockId] = bytes;
                    currentCount++;
                }
                if (rIndex > (1.0f - closeIndex) || rIndex < closeIndex)
                {
                    _neoStores.close();
                    store = CreateDynamicArrayStore();
                }
            }
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testStoreGetCharsFromString()
        public virtual void TestStoreGetCharsFromString()
        {
            const string      str   = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
            DynamicArrayStore store = CreateDynamicArrayStore();

            char[] chars = new char[str.Length];
            str.CopyTo(0, chars, 0, str.Length - 0);
            ICollection <DynamicRecord> records = new List <DynamicRecord>();

            store.AllocateRecords(records, chars);
            foreach (DynamicRecord record in records)
            {
                store.UpdateRecord(record);
            }
            // assertEquals( STR, new String( store.getChars( blockId ) ) );
        }
コード例 #5
0
 private static void AllocateArrayRecords(ICollection <DynamicRecord> target, object array, DynamicRecordAllocator allocator, bool allowStorePoints)
 {
     DynamicArrayStore.AllocateRecords(target, array, allocator, allowStorePoints);
 }