public void deleteAttributeAt(int position) { int index = locateIndex(position); this.numberAttributes--; if ((index >= 0) && (indexValues[index] == position)) { int[] tempIndices = new int[indexValues.length - 1]; Attribute[] tempValues = new Attribute[attributes.length - 1]; System.arraycopy(indexValues, 0, tempIndices, 0, index); System.arraycopy(attributes, 0, tempValues, 0, index); for (int i = index; i < indexValues.length - 1; i++) { tempIndices[i] = indexValues[i + 1] - 1; tempValues[i] = attributes[i + 1]; } indexValues = tempIndices; attributes = tempValues; } else { int[] tempIndices = new int[indexValues.length]; Attribute[] tempValues = new Attribute[attributes.length]; System.arraycopy(indexValues, 0, tempIndices, 0, index + 1); System.arraycopy(attributes, 0, tempValues, 0, index + 1); for (int i = index + 1; i < indexValues.length; i++) { tempIndices[i] = indexValues[i] - 1; tempValues[i] = attributes[i]; } indexValues = tempIndices; attributes = tempValues; } }
+ "of range"); int index = locateIndex(position);
/** * Attribute. * * @param indexAttribute the index Attribute * @return the attribute */ public Attribute attribute(int indexAttribute) { if (this.attributes == null) { //All attributes are numeric return defaultNumericAttribute(); } int location = locateIndex(indexAttribute); if (location == -1) { //if there is not attribute information, it is numeric return defaultNumericAttribute(); } return attributes[location]; }