Ejemplo n.º 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;
  }
Ejemplo n.º 2
0
  /** Get (and allocate if necessary) the index for this attribute id. */
  public int getIndex(int attrId) {
    AttrType type = AttrDefinitionMgr.getAttrType(attrId);

    if (key.intValue() == ATTRIBUTE_KEY_INT) {
      return getAttrIndex(attrId, type);
    }
    return getConstraintIndex(attrId, type);
  }
Ejemplo n.º 3
0
 public int getLength(int attrId) {
   int sequence =
       AttrDefinitionMgr.getAttrIndex(attrId); // this should be unique across all attributes
   return lengths.getQuick(sequence);
 }
Ejemplo n.º 4
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;
 }