Author: gscokart Date: Thu Aug 7 04:33:18 2008 New Revision: 683589 URL: http://svn.apache.org/viewvc?rev=683589&view=rev Log: optimize setStandardAttribute by not storing it in a separate map. A side effect is that the getStandardAttribute has to be removed (it is not use, when code want a standard attribute, it use the specific get method)
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/DefaultExtendableItem.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/ExtendableItem.java ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java?rev=683589&r1=683588&r2=683589&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java Thu Aug 7 04:33:18 2008 @@ -79,12 +79,5 @@ return getId().getQualifiedExtraAttributes(); } - public String getStandardAttribute(String attName) { - return getId().getStandardAttribute(attName); - } - - public Map getStandardAttributes() { - return getId().getStandardAttributes(); - } } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java?rev=683589&r1=683588&r2=683589&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java Thu Aug 7 04:33:18 2008 @@ -535,14 +535,6 @@ return revId.getQualifiedExtraAttributes(); } - public String getStandardAttribute(String attName) { - return revId.getStandardAttribute(attName); - } - - public Map getStandardAttributes() { - return revId.getStandardAttributes(); - } - public DependencyDescriptor asSystem() { return asSystem; } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java?rev=683589&r1=683588&r2=683589&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java Thu Aug 7 04:33:18 2008 @@ -594,13 +594,7 @@ return resolvedRevId.getQualifiedExtraAttributes(); } - public String getStandardAttribute(String attName) { - return resolvedRevId.getStandardAttribute(attName); - } - public Map getStandardAttributes() { - return resolvedRevId.getStandardAttributes(); - } public ModuleDescriptorParser getParser() { return parser; Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/DefaultExtendableItem.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/DefaultExtendableItem.java?rev=683589&r1=683588&r2=683589&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/DefaultExtendableItem.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/DefaultExtendableItem.java Thu Aug 7 04:33:18 2008 @@ -35,11 +35,5 @@ super.setExtraAttribute(attName, attValue); } - public void setStandardAttribute(String attName, String attValue) { - super.setStandardAttribute(attName, attValue); - } - public void setAttribute(String attName, String attValue, boolean extra) { - super.setAttribute(attName, attValue, extra); - } } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/ExtendableItem.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/ExtendableItem.java?rev=683589&r1=683588&r2=683589&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/ExtendableItem.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/ExtendableItem.java Thu Aug 7 04:33:18 2008 @@ -30,15 +30,6 @@ */ String getAttribute(String attName); - /** - * Gets the value of a standard attribute Can be used only to access the value of a standard - * attribute (like organisation, revision), not an extra one - * - * @param attName - * the name of the standard attribute to get - * @return the value of the attribute, null if the attribute doesn't exist - */ - String getStandardAttribute(String attName); /** * Gets the value of an extra attribute Can be used only to access the value of an extra @@ -60,14 +51,7 @@ */ Map getAttributes(); - /** - * Returns a Map of all standard attributes of this extendable item. The Map keys are attribute - * names as Strings, and values are corresponding attribute values (as String too) - * - * @return A Map instance containing all the standard attributes and their values. - */ - Map getStandardAttributes(); - + /** * Returns a Map of all extra attributes of this extendable item. The Map keys are * <b>unqualified</b> attribute names as Strings, and values are corresponding attribute values Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java?rev=683589&r1=683588&r2=683589&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java Thu Aug 7 04:33:18 2008 @@ -28,10 +28,6 @@ private final Map unmodifiableAttributesView = Collections.unmodifiableMap(attributes); - private final Map stdAttributes = new HashMap(); - - private final Map unmodifiableStdAttributesView = Collections.unmodifiableMap(stdAttributes); - private final Map extraAttributes = new HashMap(); private final Map unmodifiableExtraAttributesView = @@ -49,7 +45,6 @@ public UnmodifiableExtendableItem(Map stdAttributes, Map extraAttributes) { if (stdAttributes != null) { this.attributes.putAll(stdAttributes); - this.stdAttributes.putAll(stdAttributes); } if (extraAttributes != null) { for (Iterator iter = extraAttributes.entrySet().iterator(); iter.hasNext();) { @@ -71,31 +66,20 @@ return v; } - public String getStandardAttribute(String attName) { - return (String) stdAttributes.get(attName); - } protected void setExtraAttribute(String attName, String attValue) { - setAttribute(attName, attValue, true); + qualifiedExtraAttributes.put(attName, attValue); + + // unqualify att name if required + int index = attName.indexOf(':'); + if (index != -1) { + attName = attName.substring(index + 1); + } + extraAttributes.put(attName, attValue); + attributes.put(attName, attValue); } protected void setStandardAttribute(String attName, String attValue) { - setAttribute(attName, attValue, false); - } - - protected void setAttribute(String attName, String attValue, boolean extra) { - if (extra) { - qualifiedExtraAttributes.put(attName, attValue); - - // unqualify att name if required - int index = attName.indexOf(':'); - if (index != -1) { - attName = attName.substring(index + 1); - } - extraAttributes.put(attName, attValue); - } else { - stdAttributes.put(attName, attValue); - } attributes.put(attName, attValue); } @@ -103,9 +87,6 @@ return unmodifiableAttributesView; } - public Map getStandardAttributes() { - return unmodifiableStdAttributesView; - } public Map getExtraAttributes() { return unmodifiableExtraAttributesView;