コード例 #1
0
 @Override
 public void save(@NotNull DataOutput out, TIntArrayList list) throws IOException {
   if (list.size() == 2) {
     DataInputOutputUtil.writeINT(out, list.getQuick(0));
     DataInputOutputUtil.writeINT(out, list.getQuick(1));
   } else {
     DataInputOutputUtil.writeINT(out, -list.size());
     int prev = 0;
     for (int i = 0, len = list.size(); i < len; i += 2) {
       int value = list.getQuick(i);
       DataInputOutputUtil.writeINT(out, value - prev);
       prev = value;
       DataInputOutputUtil.writeINT(out, list.getQuick(i + 1));
     }
   }
 }
コード例 #2
0
ファイル: LayoutMapConfig.java プロジェクト: anodynos/fuzzydb
  /** Get/allocate spaceNeeded entries for the designated float-based attribute */
  private int getFloatSpace(int attrId, int spaceNeeded) {
    int sequence =
        AttrDefinitionMgr.getAttrIndex(attrId); // this should be unique across all attributes

    if (sequence < indicesPlusOne.size()) {
      int indexPlusOne = indicesPlusOne.getQuick(sequence);
      if (indexPlusOne > 0) {
        Assert.state(
            getLength(attrId) == spaceNeeded,
            "getLength = "
                + getLength(attrId)
                + ", requested = "
                + spaceNeeded); // dumbo check to ensure not asking for diff size
        return indexPlusOne - 1;
      }
    } else {
      padSpace(indicesPlusOne, sequence);
    }

    // okay, it's not been allocated so ...
    int index = nextFloatsIndex;
    nextFloatsIndex += spaceNeeded;

    indicesPlusOne.set(sequence, index + 1);

    // Add to list of attrIds for iterator
    Assert.state(attrIds.contains(attrId) == false);
    attrIds.add(attrId);

    setLength(sequence, spaceNeeded);

    syncToStore(); // we sync here as we've modified
    return index;
  }
コード例 #3
0
ファイル: LayoutMapConfig.java プロジェクト: anodynos/fuzzydb
 public int getLength(int attrId) {
   int sequence =
       AttrDefinitionMgr.getAttrIndex(attrId); // this should be unique across all attributes
   return lengths.getQuick(sequence);
 }
コード例 #4
0
ファイル: LayoutMapConfig.java プロジェクト: anodynos/fuzzydb
 /** version of getIndex for when we're decoding, and therefore space has already been allocated */
 public int getIndexQuick(int attrId) {
   int sequence =
       AttrDefinitionMgr.getAttrIndex(attrId); // this should be unique across all attributes
   int indexPlusOne = indicesPlusOne.getQuick(sequence);
   return indexPlusOne - 1;
 }