Adds a chunk to the chunk layer
        @type chunk_obj: L{Cchunk}
        @param chunk_obj: the chunk object
357789
def add_chunk(self,chunk_obj):
        
        if self.chunk_layer is None:
            self.chunk_layer = Cchunks(type=self.type)
            self.root.append(self.chunk_layer.get_node())
        self.chunk_layer.add_chunk(chunk_obj)
316163
synchronized void addChunk(SegmentChunk segmentChunk, SegmentHandle activeChunkHandle) {
        Preconditions.checkState(!this.sealed, "Cannot add SegmentChunks for a Sealed Handle.");
        if (this.segmentChunks.size() > 0) {
            long expectedOffset = this.segmentChunks.get(this.segmentChunks.size() - 1).getLastOffset();
            Preconditions.checkArgument(segmentChunk.getStartOffset() == expectedOffset,
                    "Invalid SegmentChunk StartOffset. Expected %s, given %s.", expectedOffset, segmentChunk.getStartOffset());
        }

        // Update the SegmentChunk and its Handle atomically.
        Preconditions.checkNotNull(activeChunkHandle, "activeChunkHandle");
        Preconditions.checkArgument(!activeChunkHandle.isReadOnly(), "Active SegmentChunk handle cannot be readonly.");
        Preconditions.checkArgument(activeChunkHandle.getSegmentName().equals(segmentChunk.getName()),
                "Active SegmentChunk handle must be for the last SegmentChunk.");
        this.activeChunkHandle = activeChunkHandle;
        this.segmentChunks.add(segmentChunk);
    }
1099154
function(self, chunkNumber, options, callback) {
  if (typeof options === 'function') {
    callback = options;
    options = {};
  }

  options = options || self.writeConcern;
  options.readPreference = self.readPreference;
  // Get the nth chunk
  self
    .chunkCollection()
    .findOne({ files_id: self.fileId, n: chunkNumber }, options, function(err, chunk) {
      if (err) return callback(err);

      var finalChunk = chunk == null ? {} : chunk;
      callback(null, new Chunk(self, finalChunk, self.writeConcern));
    });
}
122722
public void sendToPlayersWatchingChunk(IMessage message, Chunk chunk)
	{
		EntityUtils.getPlayersWatchingChunk(chunk).forEach(p -> sendTo(message, p));
	}
1012810
def add_object(self, obj):
        ''''''
        state = self.state
        if not obj.layer in state.layers:
            # its a new layer
            state.layers[obj.layer] = {}
        state.layers[obj.layer][obj.key] = obj
        state.need_redraw = True
537407
def add_object(self, obj):
        ''''''
        state = self.state
        if not obj.layer in state.layers:
            # its a new layer
            state.layers[obj.layer] = {}
        state.layers[obj.layer][obj.key] = obj
        state.need_redraw = True
        if (not self.legend_checkbox_menuitem_added and
            isinstance(obj, SlipFlightModeLegend)):
            self.add_legend_checkbox_menuitem()
            self.legend_checkbox_menuitem_added = True
            self.SetMenuBar(self.menu.wx_menu())
556160
def fwd_chunk(self):
        
        raise NotImplementedError("%s not implemented for %s" % (self.fwd_chunk.__func__.__name__,
                                                                 self.__class__.__name__))
827126
def _send_chunk(self, chunk, chunk_num):
        
        url_info = self.upload_operations.create_file_chunk_url(self.upload_id, chunk_num, chunk)
        self.upload_operations.send_file_external(url_info, chunk)
386195
def get_chunk(self, chunk_id):
        
        if chunk_id in self.idx:
            return Cchunk(self.idx[chunk_id], self.type)
        else:
            return None
10224
def remove_chunk_layer(self):
        
        if self.chunk_layer is not None:
            this_node = self.chunk_layer.get_node()
            self.root.remove(this_node)
            self.chunk_layer = None

        if self.header is not None:
            self.header.remove_lp('chunks')
675405
protected boolean addChunk(Chunk chunk) {
    	Font f = chunk.getFont();
    	String c = chunk.getContent();
        if (font != null && !font.isStandardFont()) {
            f = font.difference(chunk.getFont());
        }
        if (size() > 0 && !chunk.hasAttributes()) {
            try {
                Chunk previous = (Chunk) get(size() - 1);
                if (!previous.hasAttributes()
                		&& (f == null
                		|| f.compareTo(previous.getFont()) == 0)
                		&& !"".equals(previous.getContent().trim())
                		&& !"".equals(c.trim())) {
                    previous.append(c);
                    return true;
                }
            }
            catch(ClassCastException cce) {
            }
        }
        Chunk newChunk = new Chunk(c, f);
        newChunk.setAttributes(chunk.getAttributes());
        if (hyphenation != null && newChunk.getHyphenation() == null && !newChunk.isEmpty()) {
        	newChunk.setHyphenation(hyphenation);
        }
        return super.add(newChunk);
    }
175058
def add(self, si):
        '''

        '''
        if self.o_chunk is None:
            if os.path.exists(self.t_path):
                os.remove(self.t_path)
            self.o_chunk = streamcorpus.Chunk(self.t_path, mode='wb')
        self.o_chunk.add(si)
        logger.debug('added %d-th item to chunk', len(self.o_chunk))
        if len(self.o_chunk) == self.chunk_max:
            self.close()
277665
def prev_chunk(self):
        
        raise NotImplementedError("%s not implemented for %s" % (self.prev_chunk.__func__.__name__,
                                                                 self.__class__.__name__))
976870
def add_function(self, func):
        
        for block in func.blocks:
            self.add_obj(block.addr, block)
981541
def add_object(self, obj):
        

        # delegate to SchemaType object
        schema_generator = self._get_generator_for_object(obj)
        schema_generator.add_object(obj)

        # return self for easy method chaining
        return self
655124
function createChunkCache(chunks, capacity)
{
  var chunkCache;
  var onLoadComplete;
  var index;
  var length;

  // create a chunk cache
  chunkCache = new ChunkCache(capacity);

  // every time a chunk is loaded, add it to the cache
  // TODO: should the caching be based on most recently 'used' or most recently
  // 'loaded'?
  onLoadComplete = function(err, chunk)
  {
    if (!err)
    {
      chunkCache.put(chunk);
    }
  };

  // subscribe to the 'loadcomplete' event on all the chunks
  for (index = 0, length = chunks.length; index < length; index++)
  {
    chunks[index].on('loadcomplete', onLoadComplete);
  }

  // TODO: do we need to unsubscribe from the loadcomplete event at some point?

  return chunkCache;
}
37628
def allocated_chunks(self):
        
        raise NotImplementedError("%s not implemented for %s" % (self.allocated_chunks.__func__.__name__,
                                                                 self.__class__.__name__))