class PropertyValueRecordSizeCalculator implements ToIntFunction<Value[]> {

    @Override
    public int applyAsInt( Value[] values )
    {
        stringRecordIds.reset();
        arrayRecordIds.reset();

        int propertyRecordsUsed = 0;
        int freeBlocksInCurrentRecord = 0;
        for ( Value value : values )
        {
            PropertyBlock block = new PropertyBlock();
            PropertyStore.encodeValue( block, 0 /*doesn't matter*/, value, stringRecordCounter, arrayRecordCounter, true );
            if ( block.getValueBlocks().length > freeBlocksInCurrentRecord )
            {
                propertyRecordsUsed++;
                freeBlocksInCurrentRecord = PropertyType.getPayloadSizeLongs();
            }
            freeBlocksInCurrentRecord -= block.getValueBlocks().length;
        }

        int size = propertyRecordsUsed * propertyRecordSize;
        size += toIntExact( stringRecordIds.peek() ) * stringRecordSize;
        size += toIntExact( arrayRecordIds.peek() ) * arrayRecordSize;
        return size;
    }

    public  PropertyValueRecordSizeCalculator( PropertyStore propertyStore );
    public  PropertyValueRecordSizeCalculator( int propertyRecordSize,
            int stringRecordSize, int stringRecordDataSize,
            int arrayRecordSize, int arrayRecordDataSize );

}