From d995649e3bab94002b439aebcc93e7d3f16b13fc Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 15 Jul 2016 23:14:08 +0100 Subject: Remove Identifiers in favour of instance methods --- .../couscous/ast/identifiers/IdentifierPart.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/main/java/org/zwobble/couscous/ast/identifiers/IdentifierPart.java') diff --git a/src/main/java/org/zwobble/couscous/ast/identifiers/IdentifierPart.java b/src/main/java/org/zwobble/couscous/ast/identifiers/IdentifierPart.java index 5aedcf0..ef1f83c 100644 --- a/src/main/java/org/zwobble/couscous/ast/identifiers/IdentifierPart.java +++ b/src/main/java/org/zwobble/couscous/ast/identifiers/IdentifierPart.java @@ -16,4 +16,31 @@ public class IdentifierPart { public IdentifierType getType() { return type; } + + @Override + public String toString() { + return "IdentifierPart(" + + "name='" + name + '\'' + + ", type=" + type + + ')'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + IdentifierPart that = (IdentifierPart) o; + + if (!name.equals(that.name)) return false; + return type == that.type; + + } + + @Override + public int hashCode() { + int result = name.hashCode(); + result = 31 * result + type.hashCode(); + return result; + } } -- cgit v1.2.3