示例#1
0
 public override void Run()
 {
     for (int o = 0; o < LAPS; o++)
     {
         for (long i = 0; i < COUNT; i++)
         {
             Array.set(i, i);
             assertEquals(i, Array.get(i));
         }
     }
 }
示例#2
0
 public override void Run()
 {
     for (int o = 0; o < LAPS; o++)
     {
         for (long i = Contestant; i < COUNT; i += CONTESTANTS)
         {
             long value = outerInstance.Random.nextLong();
             Array.set(i, value);
             assertEquals(value, Array.get(i));
         }
     }
 }
示例#3
0
        /// <summary>
        /// Caches a relationship group into this cache, it will be cached if the
        /// <seealso cref="RelationshipGroupRecord.getOwningNode() owner"/> is within the <seealso cref="prepare(long) prepared"/> range,
        /// where {@code true} will be returned, otherwise {@code false}.
        /// </summary>
        /// <param name="groupRecord"> <seealso cref="RelationshipGroupRecord"/> to cache. </param>
        /// <returns> whether or not the group was cached, i.e. whether or not it was within the prepared range. </returns>
        public virtual bool Put(RelationshipGroupRecord groupRecord)
        {
            long nodeId = groupRecord.OwningNode;

            Debug.Assert(nodeId < _highNodeId);
            if (nodeId < _fromNodeId || nodeId >= _toNodeId)
            {
                return(false);
            }

            long baseIndex = _offsets.get(Rebase(nodeId));
            // grouCount is extra validation, really
            int  groupCount = groupCount(nodeId);
            long index      = ScanForFreeFrom(baseIndex, groupCount, groupRecord.Type, nodeId);

            // Put the group at this index
            _cache.setByte(index, 0, ( sbyte )1);
            _cache.set3ByteInt(index, 1, groupRecord.Type);
            _cache.set6ByteLong(index, 1 + 3, groupRecord.FirstOut);
            _cache.set6ByteLong(index, 1 + 3 + 6, groupRecord.FirstIn);
            _cache.set6ByteLong(index, 1 + 3 + 6 + 6, groupRecord.FirstLoop);
            return(true);
        }
示例#4
0
 public override object Get(long offset)
 {
     return(_cache.get(offset));
 }