mbenson     2004/06/16 08:41:51

  Modified:    src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Code cleanup.
  
  Revision  Changes    Path
  1.37      +12 -27    ant/src/main/org/apache/tools/ant/ComponentHelper.java
  
  Index: ComponentHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/ComponentHelper.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ComponentHelper.java      14 Apr 2004 15:42:06 -0000      1.36
  +++ ComponentHelper.java      16 Jun 2004 15:41:51 -0000      1.37
  @@ -200,10 +200,7 @@
        */
       public Object createComponent(String componentName) {
           AntTypeDefinition def = getDefinition(componentName);
  -        if (def == null) {
  -            return null;
  -        }
  -        return def.create(project);
  +        return (def == null) ? null : def.create(project);
       }
   
       /**
  @@ -229,9 +226,7 @@
        */
       public AntTypeDefinition getDefinition(String componentName) {
           checkNamespace(componentName);
  -        AntTypeDefinition ret = null;
  -        ret = antTypeTable.getDefinition(componentName);
  -        return ret;
  +        return antTypeTable.getDefinition(componentName);
       }
   
       /**
  @@ -803,8 +798,7 @@
           }
   
           public AntTypeDefinition getDefinition(String key) {
  -            AntTypeDefinition ret = (AntTypeDefinition) super.get(key);
  -            return ret;
  +            return (AntTypeDefinition)(super.get(key));
           }
   
           /** Equivalent to getTypeType */
  @@ -814,37 +808,28 @@
   
           public Object create(String name) {
               AntTypeDefinition def = getDefinition(name);
  -            if (def == null) {
  -                return null;
  -            }
  -            return def.create(project);
  +            return (def == null) ? null : def.create(project);
           }
   
           public Class getTypeClass(String name) {
               AntTypeDefinition def = getDefinition(name);
  -            if (def == null) {
  -                return null;
  -            }
  -            return def.getTypeClass(project);
  +            return (def == null) ? null : def.getTypeClass(project);
           }
   
           public Class getExposedClass(String name) {
               AntTypeDefinition def = getDefinition(name);
  -            if (def == null) {
  -                return null;
  -            }
  -            return def.getExposedClass(project);
  +            return (def == null) ? null : def.getExposedClass(project);
           }
   
           public boolean contains(Object clazz) {
  -            for (Iterator i = values().iterator(); i.hasNext();) {
  -                AntTypeDefinition def = (AntTypeDefinition) i.next();
  -                Class c = def.getExposedClass(project);
  -                if (c == clazz) {
  -                    return true;
  +            boolean found = false;
  +            if (clazz instanceof Class) {
  +                for (Iterator i = values().iterator(); i.hasNext() && 
!found;) {
  +                    found |= 
(((AntTypeDefinition)(i.next())).getExposedClass(
  +                        project) == clazz);
                   }
               }
  -            return false;
  +            return found;
           }
   
           public boolean containsValue(Object value) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to