From b01fe1e8e5541d6c11f905d7fbb949d747f29230 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 27 Mar 2024 22:53:08 -0600 Subject: SymbolTable to separate library, Class/Method Instances --- st/AbstractInstance.java | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 st/AbstractInstance.java (limited to 'st/AbstractInstance.java') 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; + } + +} -- cgit v1.2.3