RE: CVSRoot

"Ojares Rami EINT" <[email protected]> Mon, 15 Sep 2003 17:26:35 +0300
Newsgroups gmane.comp.java.netbeans.modules.javacvs.devel
Message-ID <[email protected]>
>Well, it depends on what do you need the equal() method for. 
>You can define the
>equal() how do you wish, but it must have sense for the usage. 
>E.g. when you
>would use the equal() for searching of the cvsroot in .cvspass 
>file, you need
>to take into the account the connection method and user name as well.
>we need to define the purpose of this method. It's not 
>possible to say whether
>this is a good or bad implementation unless we have defined 
>the porpose.

You are right.
How about we implement equals the "natural" way

public boolean equals(Object root) {
   ...
   casting and stuff
   ...
   return this.cvsroot.equals(root.cvsroot);
}

public int hashCode() {
   return this.cvsroot.hashCode();
}

and rename my suggested equals method

public refersToSameRepository(CVSRoot root);

- rami