/** * Deletes the attributes with the given name from the given array of * attributes, returning the new number of attributes. */ private int deleteAttribute(int attributesCount, Attribute[] attributes, String attributeName) { // Find the attribute. int index = findAttributeIndex(attributesCount, attributes, attributeName); if (index < 0) { return attributesCount; } // Shift the other attributes in the array. System.arraycopy(attributes, index + 1, attributes, index, attributesCount - index - 1); // Clear the last entry in the array. attributes[--attributesCount] = null; return attributesCount; }
/** * Deletes the attributes with the given name from the given array of * attributes, returning the new number of attributes. */ private int deleteAttribute(int attributesCount, Attribute[] attributes, String attributeName) { // Find the attribute. int index = findAttributeIndex(attributesCount, attributes, attributeName); if (index < 0) { return attributesCount; } // Shift the other attributes in the array. System.arraycopy(attributes, index + 1, attributes, index, attributesCount - index - 1); // Clear the last entry in the array. attributes[--attributesCount] = null; return attributesCount; }
/** * Deletes the attributes with the given name from the given array of * attributes, returning the new number of attributes. */ private int deleteAttribute(int attributesCount, Attribute[] attributes, String attributeName) { // Find the attribute. int index = findAttributeIndex(attributesCount, attributes, attributeName); if (index < 0) { return attributesCount; } // Shift the other attributes in the array. System.arraycopy(attributes, index + 1, attributes, index, attributesCount - index - 1); // Clear the last entry in the array. attributes[--attributesCount] = null; return attributesCount; }
/** * Tries to put the given attribute in place of an existing attribute of * the same name, returning whether it was present. */ private boolean replaceAttribute(int attributesCount, Attribute[] attributes, Attribute attribute) { // Find the attribute with the same name. int index = findAttributeIndex(attributesCount, attributes, attribute.getAttributeName(targetClass)); if (index < 0) { return false; } attributes[index] = attribute; return true; }
/** * Tries to put the given attribute in place of an existing attribute of * the same name, returning whether it was present. */ private boolean replaceAttribute(int attributesCount, Attribute[] attributes, Attribute attribute) { // Find the attribute with the same name. int index = findAttributeIndex(attributesCount, attributes, attribute.getAttributeName(targetClass)); if (index < 0) { return false; } attributes[index] = attribute; return true; }
/** * Tries to put the given attribute in place of an existing attribute of * the same name, returning whether it was present. */ private boolean replaceAttribute(int attributesCount, Attribute[] attributes, Attribute attribute) { // Find the attribute with the same name. int index = findAttributeIndex(attributesCount, attributes, attribute.getAttributeName(targetClass)); if (index < 0) { return false; } attributes[index] = attribute; return true; }