X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Ftables%2FDisplaySettings.java;fp=net.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Ftables%2FDisplaySettings.java;h=dde6b015ab3c90b332791d0d4a5e7ef1aea76c11;hb=1e6eee9a46051c1e3f841b9675d3337ba3b72ac7;hp=0000000000000000000000000000000000000000;hpb=45942cbbb4b10a99cef716c56fe14642f7c45722;p=Mograsim.git diff --git a/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/DisplaySettings.java b/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/DisplaySettings.java new file mode 100644 index 00000000..dde6b015 --- /dev/null +++ b/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/DisplaySettings.java @@ -0,0 +1,49 @@ +package net.mograsim.plugin.tables; + +import java.util.HashSet; +import java.util.Set; + +import net.mograsim.plugin.asm.AsmNumberUtil.NumberType; + +public class DisplaySettings +{ + private NumberType dataNumberType; + private final Set observers; + + public DisplaySettings() + { + this(NumberType.HEXADECIMAL); + } + + public DisplaySettings(NumberType dataNumberType) + { + this.dataNumberType = dataNumberType; + observers = new HashSet<>(); + } + + public NumberType getDataNumberType() + { + return dataNumberType; + } + + public void setDataNumberType(NumberType dataNumberType) + { + this.dataNumberType = dataNumberType; + notifyObservers(); + } + + void notifyObservers() + { + observers.forEach(r -> r.run()); + } + + public void addObserver(Runnable ob) + { + observers.add(ob); + } + + public void removeObserver(Runnable ob) + { + observers.remove(ob); + } +} \ No newline at end of file