summaryrefslogtreecommitdiff
path: root/st/AbstractInstance.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-03-27 22:53:08 -0600
committerbd-912 <bdunahu@colostate.edu>2024-03-27 22:53:08 -0600
commitb01fe1e8e5541d6c11f905d7fbb949d747f29230 (patch)
treed348b6b471fa2ebb2cece61daaf672c8b27b4299 /st/AbstractInstance.java
parent8131ddc22af5d39114a55349d71bcdc467599187 (diff)
SymbolTable to separate library, Class/Method Instances
Diffstat (limited to 'st/AbstractInstance.java')
-rw-r--r--st/AbstractInstance.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/st/AbstractInstance.java b/st/AbstractInstance.java
new file mode 100644
index 0000000..a7dc8eb
--- /dev/null
+++ b/st/AbstractInstance.java
@@ -0,0 +1,35 @@
+package st;
+
+public abstract class AbstractInstance {
+ protected String name; // the literal name of the declaration
+ protected TypeEnum type; // the type of the declaration
+ protected int size; // the size in memory
+
+ public AbstractInstance(String name, TypeEnum type) {
+ this.type = type;
+ this.name = name;
+ }
+
+ public abstract String toString();
+
+ public boolean equals(AbstractInstance other) {
+ return this.name == other.get_name();
+ }
+
+ public int hashCode() {
+ return this.name.hashCode();
+ }
+
+ public String get_name() {
+ return this.name;
+ }
+
+ public TypeEnum get_type() {
+ return this.type;
+ }
+
+ public int get_size() {
+ return this.size;
+ }
+
+}