// JAVADOC COMMENT ELIDED public void removeValue(int field, int index) { PIMField pimField = getField(field, false, true); if (pimField == null) { throw new IndexOutOfBoundsException("Empty field: " + field); } int currentValues = pimField.getValueCount(); if (index < 0 || index >= currentValues) { throw new IndexOutOfBoundsException( "0 <= index < " + currentValues + ", " + index + " not in range"); } checkReadOnlyFields(field); pimField.removeValue(index); currentValues--; if (currentValues == 0) { removeField(field); } else if (currentValues == 1) { // downgrade field Object value = pimField.getValue(0); int attributes = pimField.getAttributes(0); pimField = new ScalarPIMField(); pimField.addValue(attributes, value); putField(field, pimField); } modified = true; }