Пример #1
0
  /** 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;
  }
Пример #2
0
 public int getLength(int attrId) {
   int sequence =
       AttrDefinitionMgr.getAttrIndex(attrId); // this should be unique across all attributes
   return lengths.getQuick(sequence);
 }
Пример #3
0
 /** 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;
 }