User: ara_e_w 
  Date: 02/05/23 15:26:12

  Modified:    src/xjavadoc XPackage.java
  Log:
  fixed incorrect hashcode()
  
  Revision  Changes    Path
  1.11      +64 -95    xjavadoc/src/xjavadoc/XPackage.java
  
  Index: XPackage.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XPackage.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -r1.10 -r1.11
  --- XPackage.java     4 Apr 2002 10:59:52 -0000       1.10
  +++ XPackage.java     23 May 2002 22:26:12 -0000      1.11
  @@ -1,37 +1,6 @@
   /*
  - * Copyright (c) 2001, Aslak Hellesøy, BEKK Consulting
  + * Copyright (c) 2001,2002 The XDoclet team
    * All rights reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without modification,
  - * are permitted provided that the following conditions are met:
  - *
  - * - Redistributions of source code must retain the above copyright notice,
  - *   this list of conditions and the following disclaimer.
  - *
  - * - Redistributions in binary form must reproduce the above copyright
  - *   notice, this list of conditions and the following disclaimer in the
  - *   documentation and/or other materials provided with the distribution.
  - *
  - * - Neither the name of BEKK Consulting nor the names of its
  - *   contributors may be used to endorse or promote products derived from
  - *   this software without specific prior written permission.
  - *
  - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
  - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  - * DAMAGE.
  - */
  -
  -/*
  - * Change log
  - *
    */
   package xjavadoc;
   
  @@ -44,7 +13,8 @@
    * @created 3. januar 2002
    * @todo-javadoc Write javadocs
    */
  -public final class XPackage implements Comparable {
  +public final class XPackage implements Comparable
  +{
        /**
         * @todo-javadoc Describe the field
         */
  @@ -59,7 +29,6 @@
         */
        private int hash = Integer.MIN_VALUE;
   
  -
   //    private ArrayList _sourceClasses = new ArrayList();
   
        /**
  @@ -69,21 +38,21 @@
         * @todo-javadoc Write javadocs for constructor
         * @todo-javadoc Write javadocs for method parameter
         */
  -     public XPackage(String name) {
  +     public XPackage( String name )
  +     {
                _name = name;
        }
   
  -
        /**
         * Gets the DefaultPackage attribute of the XPackage object
         *
         * @return The DefaultPackage value
         */
  -     public final boolean isDefaultPackage() {
  +     public final boolean isDefaultPackage()
  +     {
                return name().equals("");
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -91,11 +60,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public final String name() {
  +     public final String name()
  +     {
                return _name;
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -103,12 +72,13 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public XClass[] classes() {
  +     public XClass[] classes()
  +     {
                XClass[] result = new XClass[_classes.size()];
  +
                return (XClass[])_classes.toArray(result);
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -116,11 +86,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public String toString() {
  +     public String toString()
  +     {
                return name();
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -128,13 +98,10 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public int hashCode() {
  -             if (hash == Integer.MIN_VALUE) {
  -                     hash += name().hashCode();
  +     public int hashCode()
  +     {
  +             return name().hashCode();
                }
  -             return hashCode();
  -     }
  -
   
        /**
         * Describe what the method does
  @@ -145,12 +112,13 @@
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for return value
         */
  -     public int compareTo(Object o) {
  +     public int compareTo( Object o )
  +     {
                XPackage other = (XPackage)o;
  +
                return name().compareTo(other.name());
        }
   
  -
        /**
         * Describe the method
         *
  @@ -159,7 +127,8 @@
         * @todo-javadoc Describe the method
         * @todo-javadoc Describe the method parameter
         */
  -     void addClass(XClass clazz) {
  +     void addClass( XClass clazz )
  +     {
                // This is to avoid dupes. There might be a proxy already in there. 
Remove it
                // if a real class comes after..
                _classes.remove(clazz);
  
  
  

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to