Skip to content

Method: equals(Object)

1: package parser.nodes;
2:
3: import java.util.ArrayList;
4: import java.util.Iterator;
5: import java.util.List;
6:
7: import basic.PruefskriptConstants;
8:
9: public class IDSplitNode extends AbstractNode {
10:
11:         private final ArrayList<DefinitionSegmentNode> defNodes;
12:
13:         public IDSplitNode(final AbstractNode node) {
14:                 super();
15:                 this.defNodes = new ArrayList<DefinitionSegmentNode>();
16:         }
17:
18:         @Override
19:         public String toString() {
20:                 final StringBuffer returnString = new StringBuffer();
21:                 returnString.append(basic.PruefskriptConstants.IDSETARRAYNODETITLE);
22:                 returnString.append(PruefskriptConstants.BRACKET_OPEN);
23:                 final Iterator<DefinitionSegmentNode> it = this.defNodes.iterator();
24:                 while (it.hasNext()) {
25:                         returnString.append(it.next().toString());
26:                 }
27:                 returnString.append(PruefskriptConstants.BRACKET_CLOSE);
28:                 return returnString.toString();
29:         }
30:
31:         @Override
32:         public boolean equals(Object obj) {
33:•                return obj instanceof IDSplitNode
34:•                                && ((IDSplitNode) obj).getDefinitionSegments().equals(this.defNodes);
35:         }
36:
37:         @Override
38:         public int hashCode() {
39:                 // TODO Auto-generated method stub
40:                 return 0;
41:         }
42:
43:         @Override
44:         public AbstractReturnValue interpret(CommunicationManager mgr) throws PruefscriptException {
45:                 return this.getDefinitionSegments().get(0).interpret(mgr);
46:         }
47:
48:         public List<DefinitionSegmentNode> getDefinitionSegments() {
49:                 return this.defNodes;
50:         }
51:
52: }