1 package net.mograsim.machine.isa;
3 import java.util.Objects;
5 public final class AsmLabel implements AsmElement
7 private final String name;
8 private AsmInstruction inst;
10 public AsmLabel(String name)
12 this.name = Objects.requireNonNull(name);
15 public String getName()
20 public void setInst(AsmInstruction inst)
23 throw new IllegalStateException("Instrution already set for " + name);
28 public String toString()
36 return Objects.hash(inst, name);
40 public boolean equals(Object obj)
44 if (!(obj instanceof AsmLabel))
46 AsmLabel other = (AsmLabel) obj;
47 return Objects.equals(inst, other.inst) && Objects.equals(name, other.name);