Skip to contentMethod: equals(Object)
      1: package model.type;
2: 
3: /**
4:  * Represents a string part of a regular expression.
5:  * 
6:  * @author HFW410RA - Philipp Rammos
7:  * 
8:  */
9: public class RegExStringPart implements RegExPart {
10:         /**
11:          * The string part of the regular expression.
12:          */
13:         private final String value;
14: 
15:         /**
16:          * Constructor, just sets the field. No side effects.
17:          * 
18:          * @param value
19:          *            string part to set.
20:          */
21:         public RegExStringPart(final String value) {
22:                 this.value = value;
23: 
24:         }
25: 
26:         @Override
27:         public boolean equals(final Object obj) {
28:•                return obj instanceof RegExStringPart
29:•                                && ((RegExStringPart) obj).getValue().equals(this.getValue());
30:         }
31: 
32:         @Override
33:         public int hashCode() {
34:                 return this.getValue().hashCode();
35:         }
36: 
37:         /**
38:          * Returns the field value. No side effects.
39:          * 
40:          * @return this.value
41:          */
42:         public String getValue() {
43:                 return this.value;
44:         }
45: 
46:         @Override
47:         public String toStringResolved() {
48:                 return this.getValue();
49:         }
50: 
51:         @Override
52:         public String toStringUnresolved() {
53:                 return this.getValue();
54:         }
55: 
56:         @Override
57:         public void accept(final RegExPartVisitor vis) {
58:                 vis.visit(this);
59:         }
60: 
61: }