加载特征模板

@param br
@return
@throws IOException
555596
private Map<String, Integer> loadConfig(BufferedReader br) throws IOException {

		Map<String, Integer> featureIndex = new HashMap<String, Integer>();

		String temp = br.readLine();// #rdr#8/0/0

		int featureNum = ObjConver.getIntValue(StringUtil.matcherFirst("\\d+", temp)); // 找到特征个数

		List<int[]> list = new ArrayList<int[]>();

		for (int i = 0; i < featureNum; i++) {
			temp = br.readLine();

			List<String> matcherAll = StringUtil.matcherAll("\\[.*?\\]", temp);

			if (matcherAll.size() == 0) {
				continue;
			}

			int[] is = new int[matcherAll.size()];
			for (int j = 0; j < is.length; j++) {
				is[j] = ObjConver.getIntValue(StringUtil.matcherFirst("[-\\d]+", matcherAll.get(j)));
			}

			featureIndex.put(temp.split(":")[1], list.size());

			list.add(is);
		}

		int[][] template = new int[list.size()][0]; // 构建特征模板

		for (int i = 0; i < template.length; i++) {
			template[i] = list.get(i);
		}

		config = new Config(template);

		return featureIndex;
	}
880898
public void add(final T o, final long value) throws IOException {
		final long[] triple = new long[3];
		Hashes.spooky4(transform.toBitVector(o), seed, triple);
		add(triple, value);
	}
960939
@Override
    protected HashMap readFile(HashMap brMap) throws IOException {

        HashMap ret = new HashMap();
        ArrayList<HashMap> expArr = new ArrayList<HashMap>();
        HashMap<String, HashMap> files = readObvData(brMap);
//        compressData(file);
        ArrayList<HashMap> obvData;
        HashMap obv;
        HashMap expData;

        for (String exname : files.keySet()) {
            obvData = (ArrayList) files.get(exname).get(obvDataKey);
            for (HashMap obvSub : obvData) {
                expData = new HashMap();
                obv = new HashMap();
                copyItem(expData, files.get(exname), "exname");
                copyItem(expData, files.get(exname), "crid");
                copyItem(expData, files.get(exname), "local_name");
                expData.put(jsonKey, obv);
                obv.put(obvFileKey, obvSub.get(obvDataKey));
                expArr.add(expData);
            }
        }

        // remove index variables
        ArrayList idNames = new ArrayList();
        idNames.add("trno_t");
        removeIndex(expArr, idNames);
        ret.put("experiments", expArr);

        return ret;
    }
576846
private void fill()
        throws IOException
    {
        // if the mark is in the middle of the buffer
        if (_mark > 0)
        {
            // moved saved bytes to start of buffer
            int saved=_contents - _mark;
            System.arraycopy(_buf, _mark, _buf, 0, saved);
            _pos-=_mark;
            _avail-=_mark;
            _contents=saved;
            _mark=0;
        }
        else if (_mark<0 && _pos>0)
        {
            // move remaining bytes to start of buffer
            int saved=_contents-_pos;
            System.arraycopy(_buf,_pos, _buf, 0, saved);
            _avail-=_pos;
            _contents=saved;
            _pos=0;
        }
        else if (_mark==0 && _pos>0 && _contents==_buf.length)
        {
            // Discard the mark as we need the space.
            _mark=-1;
            fill();
            return;
        }

        // Get ready to top up the buffer
        int n=0;
        _eof=false;

        // Handle byte limited EOF
        if (_byteLimit==0)
            _eof=true;
        // else loop until something is read.
        else while (!_eof && n==0 && _buf.length>_contents)
        {
            // try to read as much as will fit.
            int space=_buf.length-_contents;

            n=in.read(_buf,_contents,space);

            if (n<=0)
            {
                // If no bytes - we could be NBIO, so we want to avoid
                // a busy loop.
                if (n==0)
                {
                    // Yield to give a chance for some bytes to turn up
                    Thread.yield();

                    // Do a byte read as that is blocking
                    int b = in.read();
                    if (b>=0)
                    {
                        n=1;
                        _buf[_contents++]=(byte)b;
                    }
                    else
                        _eof=true;
                }
                else
                    _eof=true;
            }
            else
                _contents+=n;
            _avail=_contents;

            // If we have a byte limit
            if (_byteLimit>0)
            {
                // adjust the bytes available
                if (_contents-_pos >=_byteLimit)
                    _avail=_byteLimit+_pos;
                
                if (n>_byteLimit)
                    _byteLimit=0;
                else if (n>=0)
                    _byteLimit-=n;
                else if (n==-1)
                    throw new IOException("Premature EOF");
            }
        }
        
        // If we have some characters and the last read was a CR and
        // the first char is a LF, skip it
        if (_avail-_pos>0 && _lastCr && _buf[_pos]==LF)
        {
            _seenCrLf=true;
            _pos++;
            if (_mark>=0)
                _mark++;
            _lastCr=false;

            // If the byte limit has just been imposed, dont count
            // LF as content.
            if(_byteLimit>=0 && _newByteLimit)
            {
                if (_avail<_contents)
                    _avail++;
                else
                    _byteLimit++;
            }
            // If we ate all that ws filled, fill some more
            if (_pos==_avail)
                fill();
        }
        _newByteLimit=false;
    }
1091480
public void write(byte[] b) throws IOException {
	if (b != null && b.length > 0) {
	    pos += blob.write(b, 0, pos, b.length);
	}
    }
308069
def addbr(name):
    '''  '''
    fcntl.ioctl(ifconfig.sockfd, SIOCBRADDBR, name)
    return Bridge(name)
499466
private void fillBuf() throws IOException {
		int result = in.read(buf, 0, buf.length);
		if (result == -1) {
			throw new EOFException();
		}
		pos = 0;
		end = result;
	}
799942
public JBBPOut Byte(final int... value) throws IOException {
    assertNotEnded();
    assertArrayNotNull(value);
    if (this.processCommands) {
      for (final int v : value) {
        _writeByte(v);
      }
    }
    return this;
  }
622579
@Override
    protected HashMap readFile(HashMap brMap) throws IOException {
        HashMap ret = new HashMap();
        ArrayList<HashMap> sites = readSoilSites(brMap, new HashMap());
//        compressData(sites);
        ret.put("soils", sites);

        return ret;
    }
255471
public static br_broker add(nitro_service client, br_broker resource) throws Exception
	{
		resource.validate("add");
		return ((br_broker[]) resource.perform_operation(client, "add"))[0];
	}
1098745
public Jar addEntry(String path, byte[] content) throws IOException {
        beginWriting();
        addEntry(jos, path, content);
        return this;
    }
904936
public static List<String> getList(BufferedReader br) throws ParserException {
		final List<String> list = new ArrayList<String>();
		processReader(br, new ReaderProcessor() {
			@Override
			public void process(String line) {
				list.add(line);
			}
		});
		return list;
	}
421153
private void _fill () throws IOException
  {
    byte [] buffer = _getBufIfOpen ();
    if (m_nMarkPos < 0)
      m_nPos = 0; /* no mark: throw away the buffer */
    else
      if (m_nPos >= buffer.length) /* no room left in buffer */
        if (m_nMarkPos > 0)
        {
          /* can throw away early part of the buffer */
          final int sz = m_nPos - m_nMarkPos;
          System.arraycopy (buffer, m_nMarkPos, buffer, 0, sz);
          m_nPos = sz;
          m_nMarkPos = 0;
        }
        else
          if (buffer.length >= m_nMarkLimit)
          {
            /* buffer got too big, invalidate mark */
            m_nMarkPos = -1;
            /* drop buffer contents */
            m_nPos = 0;
          }
          else
          {
            /* grow buffer */
            int nsz = m_nPos * 2;
            if (nsz > m_nMarkLimit)
              nsz = m_nMarkLimit;
            final byte [] nbuf = new byte [nsz];
            System.arraycopy (buffer, 0, nbuf, 0, m_nPos);
            if (!s_aBufUpdater.compareAndSet (this, buffer, nbuf))
            {
              // Can't replace buf if there was an async close.
              // Note: This would need to be changed if fill()
              // is ever made accessible to multiple threads.
              // But for now, the only way CAS can fail is via close.
              // assert buf == null;
              throw new IOException ("Stream closed");
            }
            buffer = nbuf;
          }
    m_nCount = m_nPos;
    // Potentially blocking read
    final int n = _getInIfOpen ().read (buffer, m_nPos, buffer.length - m_nPos);
    if (n > 0)
      m_nCount = n + m_nPos;
  }
680713
private void fillIn() throws IOException {

		BufferedReader br = null;
		InputStream in = null;
		try {
			in = new FileInputStream( this.definitionFile.getEditedFile());
			br = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ));

			String line;
			while(( line = nextLine( br )) != null ) {

				int code = recognizeBlankLine( line, this.definitionFile.getBlocks());
				if( code == P_CODE_YES )
					continue;

				code = recognizeComment( line, this.definitionFile.getBlocks());
				if( code == P_CODE_YES )
					continue;

				code = recognizeImport( line );
				if( code == P_CODE_CANCEL )
					break;
				else if( code == P_CODE_YES )
					continue;

				code = recognizeFacet( line, br );
				if( code == P_CODE_CANCEL )
					break;
				else if( code == P_CODE_YES )
					continue;

				code = recognizeInstanceOf( line, br, null );
				if( code == P_CODE_CANCEL )
					break;
				else if( code == P_CODE_YES )
					continue;

				// "recognizeComponent" is the last attempt to identify the line.
				code = recognizeComponent( line, br );

				// So, eventually, we add the line as an unknown block.
				if( code != P_CODE_YES )
					this.definitionFile.getBlocks().add( new BlockUnknown( this.definitionFile, line ));

				// Deal with the error codes.
				// Cancel: break the loop.
				// No: try to process the next line.
				if( code == P_CODE_CANCEL )
					break;

				if( code == P_CODE_NO )
					addModelError( ErrorCode.P_UNRECOGNIZED_BLOCK );
			}

			if( line == null
					&& this.lastLineEndedWithLineBreak )
				this.definitionFile.getBlocks().add( new BlockBlank( this.definitionFile, "" ));

		} finally {
			Utils.closeQuietly( br );
			Utils.closeQuietly( in );
		}
	}
1260435
@Override
    protected HashMap readFile(HashMap brMap) throws IOException {
        HashMap ret = new HashMap();
        ArrayList<HashMap> files = readDailyData(brMap, new HashMap());
//        compressData(files);
        ret.put("weathers", files);

        return ret;
    }
1148482
private void fillReadBuffer() throws IOException {
		// special case for compressed files.
		if(splitLength == FileInputFormat.READ_WHOLE_SPLIT_FLAG) {
			int read = this.stream.read(this.readBuffer, 0, this.readBufferSize);
			if (read == -1) {
				exhausted = true;
			} else {
				this.streamPos += read;
				this.readBufferPos = 0;
				this.readBufferLimit = read;
			}
			return;
		}
		
		int toRead = (int) Math.min(this.streamEnd - this.streamPos, this.readBufferSize);
		if (toRead <= 0) {
			this.exhausted = true;
			return;
		}
		
		// fill read buffer
		int read = this.stream.read(this.readBuffer, 0, toRead);
		
		if (read <= 0) {
			this.exhausted = true;
		} else {
			this.streamPos += read;
			this.readBufferPos = 0;
			this.readBufferLimit = read;
		}
	}
939515
def addbr(self, name):
        
        _runshell([brctlexe, 'addbr', name],
            "Could not create bridge %s." % name)
        _runshell([ipexe, 'link', 'set', 'dev', name, 'up'],
            "Could not set link up for %s." % name)
        return Bridge(name)