summaryrefslogtreecommitdiff
path: root/heat/TypeBundle.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-26 18:23:59 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-26 18:23:59 -0600
commit289a419681bfde1edd91a695ca97116a57d62433 (patch)
tree2eb1c3918e6f3da4249bbf31d4abd0b31018b008 /heat/TypeBundle.java
parent7c6c79a437a4c1e7cf85964d005a3cdeb59809f1 (diff)
Implemented some basic HeatVisitor rules
Diffstat (limited to 'heat/TypeBundle.java')
-rw-r--r--heat/TypeBundle.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/heat/TypeBundle.java b/heat/TypeBundle.java
index d5f8121..44e3749 100644
--- a/heat/TypeBundle.java
+++ b/heat/TypeBundle.java
@@ -18,24 +18,35 @@ class TypeBundle {
}
@Override public String toString() {
- return String.format("%s (%s)",
- type,
- instance);
+ String cls = (this.instance != null) ? String.format(" (%s)", this.instance) : "";
+ return String.format("%s%s",
+ this.type,
+ cls);
}
@Override public boolean equals(Object other) {
- /**
- * We can say two types are equal, as
- * long as they are not equal on a
- * type error!
- */
return (other instanceof TypeBundle) &&
- this.hasChecked() &&
((TypeBundle) other).type == this.type;
}
- public boolean hasChecked() {
- return type != TypeEnum.ERROR;
+ public boolean isClass() {
+ return this.type == TypeEnum.classname;
+ }
+
+ public boolean isMethod() {
+ return this.type == TypeEnum.method;
+ }
+
+ public boolean isArray() {
+ return this.type == TypeEnum.intarray;
+ }
+
+ public boolean isBool() {
+ return this.type == TypeEnum.bool;
+ }
+
+ public boolean isInt() {
+ return this.type == TypeEnum.integer;
}
}