Creates a new StoredBlock, calculating the additional fields by adding to the values in this block.
331274
public StoredBlock build(Block block) throws VerificationException {
        // Stored blocks track total work done in this chain, because the canonical chain is the one that represents
        // the largest amount of work done not the tallest.
        BigInteger chainWork = this.chainWork.add(block.getWork());
        int height = this.height + 1;
        return new StoredBlock(block, chainWork, height);
    }
748277
def _init_fields(self):
        """"""
        if self.opts.fields:
            available_field_names = self.set_class(self.opts.fields)
        else:
            available_field_names = self.set_class(self.declared_fields.keys())
            if self.opts.additional:
                available_field_names |= self.set_class(self.opts.additional)

        invalid_fields = self.set_class()

        if self.only is not None:
            # Return only fields specified in only option
            field_names = self.set_class(self.only)

            invalid_fields |= field_names - available_field_names
        else:
            field_names = available_field_names

        # If "exclude" option or param is specified, remove those fields.
        exclude_field_names = set(self.opts.exclude) | set(self.exclude)
        if exclude_field_names:
            # Note that this isn't available_field_names, since we want to
            # apply "only" for the actual calculation.
            field_names = field_names - exclude_field_names

            invalid_fields |= exclude_field_names - available_field_names

        if invalid_fields:
            message = 'Invalid fields for {}: {}.'.format(self, invalid_fields)
            raise ValueError(message)

        fields_dict = self.dict_class()
        for field_name in field_names:
            field_obj = self.declared_fields.get(field_name, ma_fields.Inferred())
            self._bind_field(field_name, field_obj)
            fields_dict[field_name] = field_obj

        dump_data_keys = [
            obj.data_key or name for name, obj in iteritems(fields_dict) if not obj.load_only
        ]
        if len(dump_data_keys) != len(set(dump_data_keys)):
            data_keys_duplicates = {x for x in dump_data_keys if dump_data_keys.count(x) > 1}
            raise ValueError(
                'The data_key argument for one or more fields collides '
                "with another field's name or data_key argument. "
                'Check the following field names and '
                'data_key arguments: {}'.format(list(data_keys_duplicates)),
            )

        load_attributes = [
            obj.attribute or name for name, obj in iteritems(fields_dict) if not obj.dump_only
        ]
        if len(load_attributes) != len(set(load_attributes)):
            attributes_duplicates = {x for x in load_attributes if load_attributes.count(x) > 1}
            raise ValueError(
                'The attribute argument for one or more fields collides '
                "with another field's name or attribute argument. "
                'Check the following field names and '
                'attribute arguments: {}'.format(list(attributes_duplicates)),
            )

        return fields_dict
312519
public void add(Rec fieldList) throws DBException
    {
        Record record = (Record)fieldList;
        boolean bRefreshed = true;
        if ((this.getRecord().getOpenMode() & DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY) == DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY)
            bRefreshed = record.isRefreshedRecord();    // Only do this on the second write
        super.add(record);
        if (bRefreshed)
        {   // On second only
            Iterator<BaseTable> iterator = this.getTables();
            while (iterator.hasNext())
            {
                BaseTable table = iterator.next();
                if ((table != null) && (table != this.getNextTable()))
                {
                    if (table.getRecord().getEditMode() == Constants.EDIT_ADD)
                    {   // Should have been in sync, but it is now!
                        Record record2 = table.getRecord();
                        boolean bIsAutoSequence = record2.setAutoSequence(false);
                        this.copyRecord(record2, record);
                        try {
                            table.add(record2);
                        } catch (DBException ex) {
                            throw ex;
                        } finally {
                            record2.setAutoSequence(bIsAutoSequence);
                        }
                    }
                }
            }
        }
    }
1156675
static ArrayBlock createArrayBlockInternal(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
    {
        validateConstructorArguments(arrayOffset, positionCount, valueIsNull, offsets, values);
        return new ArrayBlock(arrayOffset, positionCount, valueIsNull, offsets, values);
    }
461676
def AddBlock(self, block):
        
        if isinstance(block, Block):
            self.blocks.append(block)
            self.max_order = max(self.max_order, block.max_input_order-1)
            self.max_order = max(self.max_order, block.max_output_order)
            for variable in block.inputs+block.outputs:
                self._AddVariable(variable)
        else:
            print(block)
            raise TypeError
        self._utd_graph = False
162079
def extend(self, values):
        """"""
        if self.asserted:
            raise RuntimeError("Fact already asserted")

        self._multifield.extend(values)
178803
def add(self, key, value):
        '''
        
        '''
        if key in self.reserved_keys:
            raise Exception('You cannot add the key %s directly, use %s' % (key, self.reserved_keys[key]))
        if isinstance(value, Report):
            self._sub_reports[key] = value
            self._data_fields['sub_reports'].append(key)
        else:
            self._data_fields[key] = value
31559
def create(self):
        """"""
        pk = CRTPPacket()
        pk.set_header(5, CHAN_SETTINGS)
        if self.useV2:
            pk.data = (CMD_CREATE_BLOCK_V2, self.id)
        else:
            pk.data = (CMD_CREATE_BLOCK, self.id)
        for var in self.variables:
            if (var.is_toc_variable() is False):  # Memory location
                logger.debug('Logging to raw memory %d, 0x%04X',
                             var.get_storage_and_fetch_byte(), var.address)
                pk.data.append(struct.pack('<B',
                                           var.get_storage_and_fetch_byte()))
                pk.data.append(struct.pack('<I', var.address))
            else:  # Item in TOC
                logger.debug('Adding %s with id=%d and type=0x%02X',
                             var.name,
                             self.cf.log.toc.get_element_id(
                                 var.name), var.get_storage_and_fetch_byte())
                pk.data.append(var.get_storage_and_fetch_byte())
                if self.useV2:
                    ident = self.cf.log.toc.get_element_id(var.name)
                    pk.data.append(ident & 0x0ff)
                    pk.data.append((ident >> 8) & 0x0ff)
                else:
                    pk.data.append(self.cf.log.toc.get_element_id(var.name))
        logger.debug('Adding log block id {}'.format(self.id))
        if self.useV2:
            self.cf.send_packet(pk, expected_reply=(
                CMD_CREATE_BLOCK_V2, self.id))
        else:
            self.cf.send_packet(pk, expected_reply=(CMD_CREATE_BLOCK, self.id))
1355592
def addfield(self, pkt, s, val):
        """"""
        if self.adjust(pkt, self.length_of) == 2:
            return s + struct.pack(self.fmt[0] + "H", val)
        elif self.adjust(pkt, self.length_of) == 8:
            return s + struct.pack(self.fmt[0] + "Q", val)
        else:
            return s
1312765
private void createImpl()
  {
    _systemSegment = allocateSegment(new byte[32], 1);
    
    _segmentList.add(_systemSegment);
    
    TempBuffer tBuf = TempBuffer.createLarge();
    byte []buffer = tBuf.buffer();
    
    Arrays.fill(buffer, (byte) 0);
    
    int offset = 0;
    
    BitsUtil.writeLong(buffer, offset, JOURNAL_MAGIC);
    offset += 8;
    
    BitsUtil.writeLong(buffer, offset, _segmentSize);
    offset += 8;
    
    BitsUtil.writeLong(buffer, offset, _tailAddress);
    offset += 8;
    
    BitsUtil.writeInt(buffer, offset, KEY_LENGTH);
    offset += 4;
    
    try (OutStore os = _store.openWrite(0, buffer.length)) {
      os.write(0, buffer, 0, buffer.length);
    }
    
    tBuf.free();
  }
575692
def stored_fields(field_name, dynamic_field_name = nil)
      @stored_field_factories_cache[field_name.to_sym].map do |field_factory|
        if dynamic_field_name
          field_factory.build(dynamic_field_name)
        else
          field_factory.build
        end
      end
    end
612392
public void setupSFields()
    {
        Record record = this.getMainRecord();
        BaseField field = record.getField(DBConstants.MAIN_FIELD);
        if (field == record.getCounterField())
            this.addColumn(field);
        super.setupSFields();
    }
577574
public function addExisting()
    {
        $classes = $this->blockManager->getBlockClasses();

        $this->addComponent($add = new GridFieldAddExistingSearchButton());
        $add->setSearchList(Block::get()->filter(array(
            'ClassName' => array_keys($classes),
        )));

        return $this;
    }
639002
def append(self, data):
        """"""
        index = self.n_blocks # note off by one so use as index
        self[index] = data
        self.refs.append(data)
133981
def add_new_fields(data, data_to_add):
        
        for key, value in data_to_add.items():
            if not data.get(key):
                data[key] = value

        return data
932490
def add_fields(self, fields):
        
        for field in fields:
            cls = field.__class__
            try:
                container = FieldsContainer.class_container[cls]
            except KeyError:
                raise ValueError('Object of type %s is an invalid field' % cls)
            getattr(self, container).append(field)
805038
public void extendStore( int blockSize , int oldBlockCount , int newBlockCount ) throws JournalException
    {
        // Refuse any further operation in case of previous failure
        if (failing)
            throw new JournalException("Store journal is failing");
        
        synchronized (journalWriteQueue)
        {
            if (traceEnabled)
                log.trace("["+baseName+"] #"+currentTransactionId+" Queueing store extend : blockSize="+blockSize+" blockCount="+oldBlockCount+" -> "+newBlockCount+" / queueSize="+(journalWriteQueue.size()+1));
            
            StoreExtendOperation op = new StoreExtendOperation(currentTransactionId,blockSize,oldBlockCount,newBlockCount);

            unflushedJournalSize += op.size();
            journalWriteQueue.addLast(op);
            totalPendingOperations++;
        }
    }