Skip to contentMethod: hashCode()
      1: package model.definition;
2: 
3: /**
4:  * Representation for definitions with an Opt.
5:  * 
6:  * @author HFW410RA - Philipp Rammos
7:  * 
8:  */
9: public class HasOpt implements VariableOptReference {
10:         /**
11:          * Represents the Opt.
12:          */
13:         private final Opt opt;
14: 
15:         /**
16:          * Constructor, just sets the field. No side effects.
17:          * 
18:          * @param opt
19:          *            The Opt to set.
20:          */
21:         public HasOpt(final Opt opt) {
22:                 this.opt = opt;
23:         }
24: 
25:         @Override
26:         public boolean equals(final Object obj) {
27:                 return obj instanceof HasOpt && ((HasOpt) obj).getOpt().equals(this.getOpt());
28:         }
29: 
30:         @Override
31:         public int hashCode() {
32:                 return this.getOpt().hashCode();
33:         }
34: 
35:         @Override
36:         public String toString() {
37:                 return this.opt.getOptVariable().getName();
38:         }
39: 
40:         /**
41:          * Returns the field opt. No side effects.
42:          * 
43:          * @return this.opt
44:          */
45:         protected Opt getOpt() {
46:                 return this.opt;
47:         }
48: }