avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info CategoryDescriptor.java ContextDescriptor.java DependencyDescriptor.java Descriptor.java EntryDescriptor.java ExtensionDescriptor.java InfoDescriptor.java ReferenceDescriptor.java Service.java ServiceDescriptor.java StageDescriptor.java Type.java
Date Sat, 12 Jul 2003 13:34:28 GMT
mcconnell    2003/07/12 06:34:28

  Modified:    meta/api/src/java/org/apache/avalon/meta/info
                        CategoryDescriptor.java ContextDescriptor.java
                        DependencyDescriptor.java Descriptor.java
                        EntryDescriptor.java ExtensionDescriptor.java
                        InfoDescriptor.java ReferenceDescriptor.java
                        Service.java ServiceDescriptor.java
                        StageDescriptor.java Type.java
  Log:
  Housekeeping - javadoc and a couple of additional equals() and hashCodes().
  
  Revision  Changes    Path
  1.4       +27 -1     avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/CategoryDescriptor.java
  
  Index: CategoryDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/CategoryDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CategoryDescriptor.java	11 Jul 2003 13:02:27 -0000	1.3
  +++ CategoryDescriptor.java	12 Jul 2003 13:34:27 -0000	1.4
  @@ -107,4 +107,30 @@
       {
           return m_name;
       }
  +
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
  +    public boolean equals( Object other )
  +    {
  +        boolean isEqual = other instanceof CategoryDescriptor;
  +        if ( isEqual )
  +        {
  +            isEqual = isEqual && m_name.equals( ((CategoryDescriptor)other).m_name
);
  +        }
  +        return isEqual;
  +    }
  +
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
  +    public int hashCode()
  +    {
  +        int hash = super.hashCode();
  +        hash >>>= 13;
  +        hash ^= m_name.hashCode();
  +        return hash;
  +    }
   }
  
  
  
  1.5       +25 -1     avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ContextDescriptor.java
  
  Index: ContextDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ContextDescriptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContextDescriptor.java	12 Jul 2003 13:09:25 -0000	1.4
  +++ ContextDescriptor.java	12 Jul 2003 13:34:27 -0000	1.5
  @@ -208,6 +208,30 @@
           return (EntryDescriptor[]) list.toArray( new EntryDescriptor[0] );
       }
   
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
  +    public boolean equals( Object other )
  +    {
  +        boolean isEqual = super.equals( other );
  +        if( isEqual ) isEqual = other instanceof ContextDescriptor;
  +        if( isEqual )
  +        {
  +            ContextDescriptor entity = (ContextDescriptor) other;
  +            isEqual = isEqual && m_reference.equals( entity.m_reference );
  +            for( int i=0; i<m_entries.length; i++ )
  +            {
  +                isEqual = isEqual && m_entries[i].equals( entity.m_entries[i] );
  +            }
  +        }
  +        return isEqual;
  +    }
  +
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
       public int hashCode()
       {
           int hash = super.hashCode();
  
  
  
  1.3       +5 -1      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/DependencyDescriptor.java
  
  Index: DependencyDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/DependencyDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DependencyDescriptor.java	10 Jul 2003 21:01:08 -0000	1.2
  +++ DependencyDescriptor.java	12 Jul 2003 13:34:27 -0000	1.3
  @@ -240,6 +240,10 @@
           return isEqual;
       }
   
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
       public int hashCode()
       {
           int hash = super.hashCode();
  
  
  
  1.4       +9 -6      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Descriptor.java
  
  Index: Descriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Descriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Descriptor.java	12 Jul 2003 13:10:13 -0000	1.3
  +++ Descriptor.java	12 Jul 2003 13:34:27 -0000	1.4
  @@ -150,9 +150,10 @@
           return false;
       }
   
  -    /**
  -     * Return the hashcode for this object.
  -     */
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
       public int hashCode()
       {
           if( m_attributes != null )
  @@ -167,8 +168,10 @@
   
       /**
        * Returns the property set.
  -     *
  -     * @return the dproperty set.
  +     * TODO: check necessity for this operationi and if really needed return 
  +     * a cloned equivalent (i.e. disable modification)
  +     * 
  +     * @return the property set.
        */
       protected Properties getProperties()
       {
  
  
  
  1.5       +12 -2     avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/EntryDescriptor.java
  
  Index: EntryDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/EntryDescriptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EntryDescriptor.java	11 Jul 2003 04:49:33 -0000	1.4
  +++ EntryDescriptor.java	12 Jul 2003 13:34:27 -0000	1.5
  @@ -225,6 +225,10 @@
           return m_volatile;
       }
   
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
       public boolean equals( Object other )
       {
           boolean isEqual = other instanceof EntryDescriptor;
  @@ -250,9 +254,15 @@
           return isEqual;
       }
   
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
       public int hashCode()
       {
  -        int hash = m_key.hashCode();
  +        int hash = super.hashCode();
  +        hash >>>= 13;
  +        hash ^= m_key.hashCode();
           hash >>>= 13;
           hash ^= m_classname.hashCode();
           hash >>>= 13;
  
  
  
  1.4       +9 -1      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ExtensionDescriptor.java
  
  Index: ExtensionDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ExtensionDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ExtensionDescriptor.java	11 Jul 2003 16:19:45 -0000	1.3
  +++ ExtensionDescriptor.java	12 Jul 2003 13:34:27 -0000	1.4
  @@ -117,6 +117,10 @@
           return m_reference;
       }
   
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
       public boolean equals(Object other)
       {
           boolean isEqual = super.equals(other) && other instanceof ExtensionDescriptor;
  @@ -126,6 +130,10 @@
           return isEqual;
       }
   
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
       public int hashCode()
       {
           int hash = super.hashCode();
  
  
  
  1.6       +9 -1      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/InfoDescriptor.java
  
  Index: InfoDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/InfoDescriptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- InfoDescriptor.java	12 Jul 2003 13:11:06 -0000	1.5
  +++ InfoDescriptor.java	12 Jul 2003 13:34:27 -0000	1.6
  @@ -244,6 +244,10 @@
           return "[" + getName() + "] " + getClassname() + ":" + getVersion();
       }
   
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
       public boolean equals(Object other)
       {
           boolean isEqual = super.equals(other) && other instanceof InfoDescriptor;
  @@ -268,6 +272,10 @@
           return isEqual;
       }
   
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
       public int hashCode()
       {
           int hash = super.hashCode();
  
  
  
  1.7       +10 -10    avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java
  
  Index: ReferenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ReferenceDescriptor.java	12 Jul 2003 08:40:32 -0000	1.6
  +++ ReferenceDescriptor.java	12 Jul 2003 13:34:27 -0000	1.7
  @@ -159,15 +159,6 @@
       }
   
       /**
  -     * Returns the cashcode.
  -     * @return the hascode value
  -     */
  -    public int hashCode()
  -    {
  -        return getClassname().hashCode() ^ getVersion().hashCode();
  -    }
  -
  -    /**
        * Compare this object with another for equality.
        * @param other the object to compare this object with
        * @return TRUE if the supplied object is a reference, service, or service
  @@ -191,6 +182,15 @@
           }
   
           return match;
  +    }
  +
  +    /**
  +     * Returns the cashcode.
  +     * @return the hascode value
  +     */
  +    public int hashCode()
  +    {
  +        return getClassname().hashCode() ^ getVersion().hashCode();
       }
   
       private static final String parseClassname( final String type )
  
  
  
  1.4       +3 -3      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Service.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Service.java	11 Jul 2003 20:03:22 -0000	1.3
  +++ Service.java	12 Jul 2003 13:34:27 -0000	1.4
  @@ -203,8 +203,8 @@
       }
   
       /**
  -     * Return the hascode for this service defintion.
  -     * @return the hascode value
  +     * Return the hashcode for this service defintion.
  +     * @return the hashcode value
        */
       public int hashCode()
       {
  
  
  
  1.4       +5 -1      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ServiceDescriptor.java
  
  Index: ServiceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ServiceDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServiceDescriptor.java	11 Jul 2003 20:22:54 -0000	1.3
  +++ ServiceDescriptor.java	12 Jul 2003 13:34:27 -0000	1.4
  @@ -147,6 +147,10 @@
           return m_designator.hashCode();
       }
   
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
       public boolean equals(Object other)
       {
           boolean isEqual = super.equals( other ) && other instanceof ServiceDescriptor;
  
  
  
  1.4       +9 -1      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/StageDescriptor.java
  
  Index: StageDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/StageDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StageDescriptor.java	11 Jul 2003 20:22:54 -0000	1.3
  +++ StageDescriptor.java	12 Jul 2003 13:34:27 -0000	1.4
  @@ -126,6 +126,10 @@
           return m_reference.hashCode();
       }
   
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
       public boolean equals(Object other)
       {
           boolean isEqual = super.equals(other) && other instanceof StageDescriptor;
  @@ -133,6 +137,10 @@
           return isEqual;
       }
   
  +   /**
  +    * Return a stringified representation of the instance.
  +    * @return the string representation
  +    */
       public String toString()
       {
           return "[stage " + getReference() + "]";
  
  
  
  1.9       +9 -1      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Type.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Type.java	12 Jul 2003 13:11:55 -0000	1.8
  +++ Type.java	12 Jul 2003 13:34:27 -0000	1.9
  @@ -376,6 +376,10 @@
           return getInfo().toString();
       }
   
  +   /**
  +    * Test is the supplied object is equal to this object.
  +    * @return true if the object are equivalent
  +    */
       public boolean equals(Object other)
       {
           boolean isEqual = other instanceof Type;
  @@ -405,6 +409,10 @@
           return isEqual;
       }
   
  +   /**
  +    * Return the hashcode for the object.
  +    * @return the hashcode value
  +    */
       public int hashCode()
       {
           int hash = m_descriptor.hashCode();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message