/** 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; }
/** 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); }
public int getLength(int attrId) { int sequence = AttrDefinitionMgr.getAttrIndex(attrId); // this should be unique across all attributes return lengths.getQuick(sequence); }
/** 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; }