< prev index next >

src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JModuleDirective.java

Print this page




  77      * @param other The object to compare this {@link JModuleDirective} against.
  78      * @return {@code true} if the argument is not {@code null}
  79      *         and is a {@link JModuleDirective} object with the same type
  80      *         and equal name.
  81      */
  82     @Override
  83     public boolean equals(final Object other) {
  84         if (this == other) {
  85             return true;
  86         }
  87         if (other instanceof JModuleDirective) {
  88             final JModuleDirective otherDirective = (JModuleDirective)other;
  89             return this.getType() == otherDirective.getType() && this.name.equals(otherDirective.name);
  90         }
  91         return false;
  92     }
  93 
  94 
  95     /**
  96      * Returns a hash code for this module directive based on directive type and name.
  97      * The hash code for a module directive is computed as <blockquote><pre>
  98      * 97 * Integer.hashCode(type_ordinal_value + 1) + name.hashCode()
  99      * </pre></blockquote> using {@code int} arithmetic.



 100      * @return a hash code value for this object.
 101      */
 102     @Override
 103     public int hashCode() {
 104         return 97 * (Integer.valueOf(getType().ordinal() + 1)).hashCode() + name.hashCode();
 105     }
 106 
 107     /**
 108      * Gets the name of this module directive.
 109      * @return name of this module directive.
 110      */
 111     public String name() {
 112         return name;
 113     }
 114 
 115 }


  77      * @param other The object to compare this {@link JModuleDirective} against.
  78      * @return {@code true} if the argument is not {@code null}
  79      *         and is a {@link JModuleDirective} object with the same type
  80      *         and equal name.
  81      */
  82     @Override
  83     public boolean equals(final Object other) {
  84         if (this == other) {
  85             return true;
  86         }
  87         if (other instanceof JModuleDirective) {
  88             final JModuleDirective otherDirective = (JModuleDirective)other;
  89             return this.getType() == otherDirective.getType() && this.name.equals(otherDirective.name);
  90         }
  91         return false;
  92     }
  93 
  94 
  95     /**
  96      * Returns a hash code for this module directive based on directive type and name.
  97      * The hash code for a module directive is computed as
  98      * <blockquote><pre>
  99      *     {@code 97 * (type_ordinal_value + 1) + name.hashCode()}
 100      * </pre></blockquote>
 101      * using {@code int} arithmetic.
 102      *
 103      * @return a hash code value for this object.
 104      */
 105     @Override
 106     public int hashCode() {
 107         return 97 * (getType().ordinal() + 1) + name.hashCode();
 108     }
 109 
 110     /**
 111      * Gets the name of this module directive.
 112      * @return name of this module directive.
 113      */
 114     public String name() {
 115         return name;
 116     }
 117 
 118 }
< prev index next >