创建一个新的DataStruct
        data 默认是self.data
        🛠todo 没有这个？？ inplace 是否是对于原类的修改 ？？
775396
def new(self, data=None, dtype=None, if_fq=None):
        
        data = self.data if data is None else data

        dtype = self.type if dtype is None else dtype
        if_fq = self.if_fq if if_fq is None else if_fq

        temp = copy(self)
        temp.__init__(data, dtype, if_fq)
        return temp
705364
def update_data(new_data)
      @name = new_data[:name] || new_data['name'] || @name
      @hoist = new_data['hoist'] unless new_data['hoist'].nil?
      @hoist = new_data[:hoist] unless new_data[:hoist].nil?
      @colour = new_data[:colour] || (new_data['color'] ? ColourRGB.new(new_data['color']) : @colour)
    end
916096
def build_data(self):
        
        # pylint: disable=len-as-condition
        if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
            return self.dutinformation.get(0).build.get_data()
        return None
606361
def add_data(self, minimum_address, maximum_address, data, overwrite):
        

        if minimum_address == self.maximum_address:
            self.maximum_address = maximum_address
            self.data += data
        elif maximum_address == self.minimum_address:
            self.minimum_address = minimum_address
            self.data = data + self.data
        elif (overwrite
              and minimum_address < self.maximum_address
              and maximum_address > self.minimum_address):
            self_data_offset = minimum_address - self.minimum_address

            # Prepend data.
            if self_data_offset < 0:
                self_data_offset *= -1
                self.data = data[:self_data_offset] + self.data
                del data[:self_data_offset]
                self.minimum_address = minimum_address

            # Overwrite overlapping part.
            self_data_left = len(self.data) - self_data_offset

            if len(data) <= self_data_left:
                self.data[self_data_offset:self_data_offset + len(data)] = data
                data = bytearray()
            else:
                self.data[self_data_offset:] = data[:self_data_left]
                data = data[self_data_left:]

            # Append data.
            if len(data) > 0:
                self.data += data
                self.maximum_address = maximum_address
        else:
            raise AddDataError(
                'data added to a segment must be adjacent to or overlapping '
                'with the original segment data')
1271891
def data(self, data):
        
        self._buffer = self._buffer + data

        while self._data_handler():
            pass
1311549
private void markUsed(EtlEventData data) throws ZkNoNodeException, ZkException {
        String path = StagePathUtils.getProcess(data.getPipelineId(), data.getProcessId());
        // 序列化
        ProcessNodeEventData eventData = new ProcessNodeEventData();
        Long nid = ArbitrateConfigUtils.getCurrentNid();
        eventData.setNid(nid);
        eventData.setStatus(ProcessNodeEventData.Status.USED);// 标记为已使用
        eventData.setMode(ArbitrateMode.RPC);// 直接声明为rpc模式
        byte[] bytes = JsonUtils.marshalToByte(eventData);
        zookeeper.writeData(path, bytes);
    }
680410
function(data){
			//console.log(data);
			//丢弃data的第一行
			var res = '', i = 1, len = data.length;
			for(; i < len; i++){
				res += data[i].replace(/^[\t ]+/, '');
			}
			return res;
		}
552869
public void newDataReady(DataType data) {
		ArrayList<Runnable> list;
		synchronized (this) {
			if (end) throw new IllegalStateException("method endOfData already called, method newDataReady is not allowed anymore");
			waitingData.addLast(data);
			list = listeners;
			listeners = null;
		}
		if (list != null) {
			for (Runnable listener : list) listener.run();
		}
		// notify after listeners
		synchronized (this) {
			this.notify();
		}
	}
773864
function getStruct (type) {
  // First check if a regular name was passed in
  var rtn = structCache[type];

  if (rtn) return rtn;

  // If the struct type name has already been created, return that one
  var name = parseStructName(type);

  rtn = structCache[name];
  if (rtn) return rtn;

  if(knownStructs[name]) type = knownStructs[name];
  // Next parse the type structure
  var parsed = parseStruct(type);
  // Otherwise we need to create a new Struct constructor
  var props = [];
  parsed.props.forEach(function (prop) {
    props.push([ map(prop[1]), prop[0] ])
  });
  var z;
  try { z = Struct(props); } catch(e) { }
  return structCache[parsed.name] = z;
}
290386
public void append(byte[] data) {
        if (data.length >= (this.datas.length - size)) {
            // 扩容
            byte[] newData = new byte[this.datas.length + data.length + this.datas.length / 2];
            System.arraycopy(this.datas, 0, newData, 0, size);
            this.datas = newData;
        }
        System.arraycopy(data, 0, this.datas, size, data.length);
        this.size += data.length;
        modCount++;
    }
408370
def _update_data(self, data, update_original=False, remove_missing=False):
        
        self._data.update(dict((key, self._deserialize(key, value))
                               for key, value in data.items()))

        # In certain situations, we want to treat missing keys as removals
        if remove_missing:
            for key in set(self._data.keys()) - set(data.keys()):
                self._data[key] = None

        if update_original:
            self._original_data = copy.deepcopy(self._data)
923918
private Writer<?> build(Object data) {
        Optional<ExcelDataWriter<?>> dataBuilder = writers.values().parallelStream()
            .filter(excelData -> excelData.writeable(data)).limit(1).findFirst();

        ExcelDataWriter<?> writer = dataBuilder
            .orElseThrow(() -> new UtilsException("数据[" + data + "]没有对应的ExcelDataWriter"));
        return new Writer(writer, data);
    }
691240
def send_struct(self, fmt, *data):
        
        if self.connected:
            self.ws.send(struct.pack(fmt, *data))
997082
def _InnerAppendData(self, prev_col_values, data, col_index):
    """"""
    # We first check that col_index has not exceeded the columns size
    if col_index >= len(self.__columns):
      raise DataTableException("The data does not match description, too deep")

    # Dealing with the scalar case, the data is the last value.
    if self.__columns[col_index]["container"] == "scalar":
      prev_col_values[0][self.__columns[col_index]["id"]] = data
      self.__data.append(prev_col_values)
      return

    if self.__columns[col_index]["container"] == "iter":
      if not hasattr(data, "__iter__") or isinstance(data, dict):
        raise DataTableException("Expected iterable object, got %s" %
                                 type(data))
      # We only need to insert the rest of the columns
      # If there are less items than expected, we only add what there is.
      for value in data:
        if col_index >= len(self.__columns):
          raise DataTableException("Too many elements given in data")
        prev_col_values[0][self.__columns[col_index]["id"]] = value
        col_index += 1
      self.__data.append(prev_col_values)
      return

    # We know the current level is a dictionary, we verify the type.
    if not isinstance(data, dict):
      raise DataTableException("Expected dictionary at current level, got %s" %
                               type(data))
    # We check if this is the last level
    if self.__columns[col_index]["depth"] == self.__columns[-1]["depth"]:
      # We need to add the keys in the dictionary as they are
      for col in self.__columns[col_index:]:
        if col["id"] in data:
          prev_col_values[0][col["id"]] = data[col["id"]]
      self.__data.append(prev_col_values)
      return

    # We have a dictionary in an inner depth level.
    if not data.keys():
      # In case this is an empty dictionary, we add a record with the columns
      # filled only until this point.
      self.__data.append(prev_col_values)
    else:
      for key in sorted(data):
        col_values = dict(prev_col_values[0])
        col_values[self.__columns[col_index]["id"]] = key
        self._InnerAppendData((col_values, prev_col_values[1]),
                              data[key], col_index + 1)
586819
def update_dataset(self,dataStr,flatten=False):
        '''
        
        '''

        #Load keys and dimensions
        #########################
        dataDim = dataStr.pop('_dimensions',{})
        attrStr = dataStr.pop('_attributes',{})
        ndims = dataDim.pop('_ndims',0)
        dimensions = [dataDim.keys(),dataDim.values()]
        
        keys = dataStr.keys()
        if len(keys) == 0:
            self.warning(2, 'No data loaded')
            return
        self.message(2, 'Loaded variables : '+str(keys))
        
        #Check what is the current variable type
        isStructure = True if isinstance(dataStr[keys[0]],dict) else False
        
#        datalen = [np.size(dataStr[key]) for key in keys]
        datalen = [list(np.shape(dataStr[key]['data'])[::-1]) for key in keys] if isStructure else [list(np.shape(dataStr[key])[::-1]) for key in keys] #Shape is inverted wrt to order of dimensions to be consistent with check_variable
        if isStructure :
            varDim = [list(dataStr[key]['_dimensions'])[1:] for key in keys]
            ind = [where_list(vDim,dimensions[0]) for vDim in varDim] #Dimensions indices from actual variables' dimensions
            
            #Check dimension lengths
#             dimOk = np.array([enum[1][0] == dimensions[1][ind[enum[0]][0]] for enum in enumerate(datalen)])
            dimOk = [any([enum[1][ii] == dimensions[1][jj] for ii,jj in enumerate(ind[enum[0]])]) for enum in enumerate(datalen)]
            

            if any([not d for d in dimOk]) : 
                notOk = np.where(~np.array(dimOk))[0]
                print datalen
                
                self.Error('Problem with {0} variables : {1}'.format(len(notOk),','.join(np.array(dataStr.keys())[notOk])))
        else :
            ind = [where_list(dlen,dimensions[1]) for dlen in datalen] #Dimensions indices from variable length
            if (np.array(ind).sum() == -1)!= 0 : self.Error('At least one variable have not been properly defined')
            
        dimname = [np.array(dimensions[0])[i].tolist() for i in ind]  #Get correspondance between data structure dimensions and variables
                
        curDim, nself=self.get_currentDim()
        createDim=np.array([np.array([w == -1 for w in where_list(j, curDim[0])]) for i,j in enumerate(dimname) ])
        createDim=np.squeeze(createDim)
#        curInd = atools.where_list(dimname_reduced,curDim[0]) #Get correspondance between data structure dimensions and object dimensions
        
#        createDim = (np.array(curInd) == -1) #Get dimensions to be created   
        toCreate = np.array([not self.__dict__.has_key(key) for key in keys])
        
        updateDim=[]  
        
        self.message(2, 'Updating object with '+str(['{0}({1}:{2})'.format(i[0],i[1],i[2]) for i in zip(*(keys,dimname,datalen))]))
        
        #Update variables available in files
        for enum in enumerate(keys) :
            
            ind=enum[0]
            key=enum[1]
            
            #Load variable
            ##############
#            var=dataStr.get(key)
            dum=dataStr.get(key).pop('data') if isStructure else copy.deepcopy(dataStr.get(key)) 
            if flatten :
                if isinstance(dum,dict) :dum['data']=dum['data'].flatten()
                else : dum=dum.flatten()
            
            if not isStructure :
                dum={'_dimensions':dum._dimensions if hasattr(dum,'_dimensions') else {},
                      '_attributes':dum._attributes if hasattr(dum,'_attributes') else {},
                      'data':dum}
            else :
                dumStr=dataStr.get(key)
                dumStr.update({'data':dum})
                dum=dumStr

            dumDim=dimStr(dimname[ind],datalen[ind])

#             if dataStr[key].has_key('_attributes'):
#                 dum.update(dataStr[key]['_attributes'])
#            if isinstance(dum,np.ma.masked_array) : 
            
#            #Get associated dimensions
#            ##################################
#            datalen = datalen[ind]#[len(dataStr[key]) for key in keys]
#            ind = atools.where_list([datalen],dimensions[1])[0]
#            if (ind == -1) : self.Error('Dimensions of current variable ('+key+') have not been properly defined')
#            dimname = dimensions[
            
            #Initialize variable if required
#            if toCreate :
#            updateDim.append(self.create_Variable(key, dum, dimensions={dimname[ind]:datalen[ind]},toCreate=toCreate[ind],createDim=createDim[ind]))
            updateDim.append(self.create_Variable(key, dum, dimensions=dumDim,toCreate=toCreate[ind],createDim=createDim[ind]))

        
        #Extend missing variables
#         missing__keys = list(set(self.par_list).difference(keys))
#         for enum in enumerate(missing__keys) :
#             ind=enum[0]
#             key=enum[1]
#             updateDim.append(self.create_Variable(key, np.ma.repeat(self.dist_to_coast_leuliette.fill_value), dimensions=dumDim,toCreate=False,createDim=False))
        
        
        #Final sequence
        
        zipped_upd=zip(*(np.hstack(dimname)[~np.hstack(createDim)],np.hstack(datalen)[~np.hstack(createDim)]))
        updateDim_List = np.array(list(set(tuple(i) for i in np.array(zipped_upd,dtype='|S16').tolist()))) #2D unique
#        updateDim_List = np.unique(np.array(zipped_upd,dtype='|S16')) #[str(i) for i in datalen]
#        if updateDim_List.size > 0 : updateDim_List.resize((2,updateDim_List.size/2))
#        updateDim_List = np.unique(zip(*(np.array(dimname)[~createDim],np.array(datalen)[~createDim]))) #[str(i) for i in datalen]

        zipped_dims=zip(*(np.hstack(dimname)[np.hstack(createDim)],np.hstack(datalen)[np.hstack(createDim)]))
        createDim_list = np.array(list(set(tuple(i) for i in np.array(zipped_dims,dtype='|S16').tolist()))) #2D unique
#        clist, inv = np.unique(np.array(zipped_dims,dtype='|S16'),return_inverse=True) #RQ : THIS WILL FAIL IF NUMBERS HAVE MORE THAN 16 DIGITS #[str(i) for i in datalen]
#        if createDim_list.size > 0 : createDim_list.resize((2,createDim_list.size/2))
        
#        createDim_list = np.unique(zip(*(np.array(dimname)[createDim],np.array(datalen)[createDim]))) #[str(i) for i in datalen]
        
        for dname,dim in createDim_list :
            self.create_Dim(dname, np.int(dim))
        
        for dname,dim in updateDim_List:
            self.update_Dim(dname, np.int(dim))
594299
function(){
            var self = this,
                item0 = new DataTypes.Item(self.productions[0], 0, [self.EOF]),  //S' -> S #dotPos=0
                itemSet0 = new DataTypes.ItemSet();

            itemSet0.push(item0);

            var firstItemSet = self._closureItemSet(itemSet0),
                itemSets = this.itemSets = [],
                itemSetsHash = {},      //这个hash是为了判断项集是否已存在(在closure扩展项集之前生成key来判断)
                itemSet,
                formState,
                curIdx,
                dotSymbolHash;         //这个hash是为了基于当前项集 和 各子项的dotSymbol进行goto运算时，避免已经goto运算过的dotSymbol再次运算

            //为什么是itemSet0.key() 不是firstItemSet.key()
            //因为要用仅包含内核项的项集做KEY，下次GOTO运算的结果项集在未CLOSURE运算前，
            //就能判断是否已经存在于项集族中，如果已存在，就直接拿到ID，否则进行CLOSURE运算增加到项集族中
            //避免没必要的CLOSURE计算
            itemSetsHash[itemSet0.key()] = 0;       

            itemSets.push(firstItemSet);

            curIdx=0;

            while(curIdx !== itemSets.length){   //C0 

                itemSet = itemSets[curIdx];
                curIdx++;

                dotSymbolHash = {};

                _.each(itemSet.subItems, function(item){

                    if(item.dotSymbol && !dotSymbolHash[item.dotSymbol]){

                        dotSymbolHash[item.dotSymbol] = true;
                        var gotoItemSet = self._gotoItemSet(itemSet, item.dotSymbol);

                        if(itemSetsHash[gotoItemSet.key()]){
                            itemSet.gotos[item.dotSymbol] = itemSetsHash[gotoItemSet.key()];
                            self.gotoItemSetRepeatCount = self.gotoItemSetRepeatCount || 0;
                            self.gotoItemSetRepeatCount += 1;
                        }else{
                            itemSetsHash[gotoItemSet.key()] = itemSets.length;
                            if (gotoItemSet.subItems.length){
                                gotoItemSet = self._closureItemSet(gotoItemSet);
                            }
                            //原itemSet通过该dotSymbol，转换到的新itemSet的序号
                            itemSet.gotos[item.dotSymbol] = itemSets.length;
                            itemSets.push(gotoItemSet);
                            console.log('generate lr state:' + itemSets.length);
                        }
                    }
                });

            }

            return itemSets;
        }
799283
protected void restoreFromContinuationData(Map<String, Object> data) {
        //noinspection unchecked
        localProxyBuilder.set((FactoryBuilderSupport) data.get("proxyBuilder"));
        //noinspection unchecked
        contexts.set((LinkedList<Map<String, Object>>) data.get("contexts"));
    }