X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodel%2Fwires%2FPin.java;h=38ba2045f94e01e6504b1161911b83f10717e33c;hb=93b398d6271a538a2a4c9f4de07a3b4a8a2a7fd4;hp=d20087330f1811bcb4966258359225e05fe196b6;hpb=ed9c53e1fac04d87ccfd5ab701e2381f18863bab;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/Pin.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/Pin.java index d2008733..38ba2045 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/Pin.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/Pin.java @@ -2,34 +2,39 @@ package net.mograsim.logic.model.model.wires; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.function.Consumer; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.mograsim.logic.model.model.components.GUIComponent; +import net.mograsim.logic.model.model.components.ModelComponent; /** - * A connection interface between a GUIComponent and the rest of a ViewModel. Pins usually are created by {@link GUIComponent}s themselves. - *
- * A pin has a name identifying it. Pin names are unique for a {@link GUIComponent}: Every pin of a {@link GUIComponent} has a different - * name, but different {@link GUIComponent}s can have pins with the same name. + * A connection interface between a ModelComponent and the rest of a ViewModel. Pins usually are created by {@link ModelComponent}s + * themselves.
+ * A pin has a name identifying it. Pin names are unique for a {@link ModelComponent}: Every pin of a {@link ModelComponent} has a different + * name, but different {@link ModelComponent}s can have pins with the same name. * * @author Daniel Kirschten */ public class Pin { - // TODO introduce input/output/tristate hints /** - * The {@link GUIComponent} this pin belongs to + * The {@link ModelComponent} this pin belongs to. */ - public final GUIComponent component; + public final ModelComponent component; /** - * The name identifying this pin. Is unique for a {@link GUIComponent}. + * The name identifying this pin. Is unique for a {@link ModelComponent}. */ public final String name; /** * The logical width of this pin. Denotes how many bits this pin consists of. */ public final int logicWidth; + /** + * How this pin is used by the component it belongs to.
+ * Note that this is only a hint. + */ + public final PinUsage usage; /** * The X position of this pin, relative to its component's location. @@ -46,15 +51,17 @@ public class Pin // creation and destruction /** - * Creates a new pin. Usually it is not needed to call this constructor manually, as {@link GUIComponent}s create their pins themselves. + * Creates a new pin. Usually it is not needed to call this constructor manually, as {@link ModelComponent}s create their pins + * themselves. * * @author Daniel Kirschten */ - public Pin(GUIComponent component, String name, int logicWidth, double relX, double relY) + public Pin(ModelComponent component, String name, int logicWidth, PinUsage usage, double relX, double relY) { this.component = component; this.name = name; this.logicWidth = logicWidth; + this.usage = Objects.requireNonNull(usage); this.relX = relX; this.relY = relY;