Skip to contentMethod: RefResState(NamedVariableType)
      1: package model.type;
2: 
3: /**
4:  * A state that represents that a reference is resolved.
5:  * 
6:  * @author HFW410RA - Philipp Rammos
7:  * 
8:  */
9: public class RefResState extends AbstractRefState {
10:         /**
11:          * Represents the resolved type.
12:          */
13:         private final NamedVariableType type;
14: 
15:         /**
16:          * Constructor, tries to set the field. Checks if it would be a cycle.
17:          * 
18:          * @param type
19:          *            The type to set.
20:          */
21:         public RefResState(final NamedVariableType type) {
22:                 super(type.getName());
23:                 this.type = type;
24:         }
25: 
26:         @Override
27:         public boolean equals(final Object obj) {
28:                 return obj instanceof RefResState && ((RefResState) obj).getType().equals(this.getType())
29:                                 && ((RefResState) obj).getValue().equals(this.getValue());
30:         }
31: 
32:         @Override
33:         public int hashCode() {
34:                 return this.getType().hashCode() + this.getValue().hashCode();
35:         }
36: 
37:         /**
38:          * Returns the field type. No side effects.
39:          * 
40:          * @return this.type
41:          */
42:         @Override
43:         public NamedVariableType getType() {
44:                 return this.type;
45:         }
46: 
47:         @Override
48:         public void accept(final RefStateVisitor vis) {
49:                 vis.visit(this);
50:         }
51: 
52: }