Exemplo n.º 1
0
        public override int ApplyAsInt(Value[] values)
        {
            _stringRecordIds.reset();
            _arrayRecordIds.reset();

            int propertyRecordsUsed       = 0;
            int freeBlocksInCurrentRecord = 0;

            foreach (Value value in values)
            {
                PropertyBlock block = new PropertyBlock();
                PropertyStore.EncodeValue(block, 0, value, _stringRecordCounter, _arrayRecordCounter, true);
                if (block.ValueBlocks.Length > freeBlocksInCurrentRecord)
                {
                    propertyRecordsUsed++;
                    freeBlocksInCurrentRecord = PropertyType.PayloadSizeLongs;
                }
                freeBlocksInCurrentRecord -= block.ValueBlocks.Length;
            }

            int size = propertyRecordsUsed * _propertyRecordSize;

            size += toIntExact(_stringRecordIds.peek()) * _stringRecordSize;
            size += toIntExact(_arrayRecordIds.peek()) * _arrayRecordSize;
            return(size);
        }
Exemplo n.º 2
0
        private static void AddBlock(PropertyRecord record, int key, int value)
        {
            PropertyBlock block = new PropertyBlock();

            PropertyStore.EncodeValue(block, key, Values.of(value), null, null, true);
            foreach (long valueBlock in block.ValueBlocks)
            {
                record.AddLoadedBlock(valueBlock);
            }
        }