ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant Location.java
Date Tue, 15 Mar 2005 13:18:45 GMT
peterreilly    2005/03/15 05:18:45

  Modified:    src/main/org/apache/tools/ant Location.java
  Log:
  add equals and hashcode to Location
  
  Revision  Changes    Path
  1.23      +27 -1     ant/src/main/org/apache/tools/ant/Location.java
  
  Index: Location.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Location.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Location.java	3 Mar 2005 14:00:08 -0000	1.22
  +++ Location.java	15 Mar 2005 13:18:45 -0000	1.23
  @@ -117,7 +117,7 @@
       public int getColumnNumber() {
           return columnNumber;
       }
  -    
  +
       /**
        * Returns the file name, line number, a colon and a trailing space.
        * An error message can be appended easily. For unknown locations, an
  @@ -145,4 +145,30 @@
           return buf.toString();
       }
   
  +    /**
  +     * Equality operation.
  +     * @param other the object to compare to.
  +     * @return true if the other object contains the same information
  +     *              as this object.
  +     */
  +    public boolean equals(Object other) {
  +        if (this == other) {
  +            return true;
  +        }
  +        if (other == null) {
  +            return false;
  +        }
  +        if (!(other.getClass() == getClass())) {
  +            return false;
  +        }
  +        return toString().equals(other.toString());
  +    }
  +
  +    /**
  +     * Hash operation.
  +     * @return a hash code value for this location.
  +     */
  +    public int hashCode() {
  +        return toString().hashCode();
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message