public abstract class Gate extends java.lang.Object implements Logic
Constructor and Description |
---|
Gate(java.lang.String name,
java.util.List<Wire> ins,
Wire out)
Gate constructor, construct the disign of our gates child
throws ExceptionLogicParameters if are input list is empty
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
public boolean equals(Object other).
|
void |
feed(java.util.List<Signal> inSigs)
feed method feeds these list of singnals into inputs list
|
void |
feed(java.lang.String s)
feed method feeds these String into inputs list
|
java.util.List<Wire> |
getInputs()
getInputs
|
java.lang.String |
getName()
getName
|
Wire |
getOutput()
getOutput
|
java.util.List<Signal> |
inspect(java.util.List<Signal> inputs)
A combination of feeding, propagating, and reading.
|
java.lang.String |
inspect(java.lang.String inputs)
We will return the String of the inputs that we did in previous
method.
|
abstract boolean |
propagate()
This abstract method should be implement by each child class of gate
|
java.util.List<Signal> |
read()
read the single signal value from the output wire,
and create a list of singls of outputs
|
void |
setInputs(java.util.List<Wire> inputs)
setInputs sets the inputs to parameter value list
|
void |
setName(java.lang.String name)
setName sets the name to parameter value
|
void |
setOutput(Wire output)
setOutput sets the output to parameter value
|
java.lang.String |
toString()
toString the representation of a gate object
|
public Gate(java.lang.String name, java.util.List<Wire> ins, Wire out)
name
- is the name to construct the gateins
- is the list of inputs that a gate hasout
- is the output value to get out of this gate.public void feed(java.util.List<Signal> inSigs)
public void feed(java.lang.String s)
public java.util.List<Signal> read()
public abstract boolean propagate()
public java.util.List<Signal> inspect(java.util.List<Signal> inputs)
public java.lang.String inspect(java.lang.String inputs)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- is the object that we compare too.public java.util.List<Wire> getInputs()
public Wire getOutput()
public java.lang.String getName()
public void setInputs(java.util.List<Wire> inputs)
inputs
- the list to set the inputspublic void setOutput(Wire output)
output
- the value to set the outputpublic void setName(java.lang.String name)
name
- the value to set the name