|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--GraphicGate
GraphicGate is an abstract class that is extended by each of the different types of gates, as well as the input object. For gates like not, (and for the input object) one or both of the input gates will be set so that the correct output is given.
Inner classes inherited from class java.awt.Component |
java.awt.Component.AWTTreeLock |
Field Summary | |
protected java.awt.Graphics |
g
|
protected Macro |
gateMacro
|
protected int |
gateType
|
protected int |
id
|
protected java.awt.Image |
image
|
protected java.lang.String |
imageLocation
|
protected GraphicGate |
input1
|
protected GraphicGate |
input2
|
protected LogicGate |
logicGate
|
protected java.util.Vector |
output
|
protected boolean |
outputValue
|
protected int |
x
|
protected int |
y
|
Fields inherited from class java.awt.Component |
actionListenerK,
adjustmentListenerK,
appContext,
background,
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
componentListener,
componentListenerK,
componentOrientation,
containerListenerK,
cursor,
dropTarget,
enabled,
eventMask,
focusListener,
focusListenerK,
font,
foreground,
hasFocus,
height,
incRate,
inputMethodListener,
inputMethodListenerK,
isInc,
isPacked,
itemListenerK,
keyListener,
keyListenerK,
LEFT_ALIGNMENT,
locale,
LOCK,
minSize,
mouseListener,
mouseListenerK,
mouseMotionListener,
mouseMotionListenerK,
newEventsOnly,
ownedWindowK,
parent,
peer,
peerFont,
popups,
prefSize,
RIGHT_ALIGNMENT,
textListenerK,
TOP_ALIGNMENT,
valid,
visible,
width,
windowListenerK,
x,
y |
Constructor Summary | |
(package private) |
GraphicGate(int x_,
int y_,
int id_,
Macro gateMacro_,
java.awt.Graphics g_)
GraphicGate constructor - takes location and id, initializes those values, as well as setting up Vector for storing output gates |
Method Summary | |
(package private) void |
addOutputGate(GraphicGate gate)
adds gate to the Vector of output gates |
(package private) void |
drawImage()
draws the image at the gate location |
(package private) void |
drawOutput()
draws the output value of the gate |
(package private) int |
getGateType()
returns the gateType |
(package private) int |
getID()
returns current gate id |
(package private) GraphicGate |
getInput1()
returns the gate connected to input1 of current gate |
(package private) GraphicGate |
getInput2()
returns the gate connected to input2 of current gate |
(package private) LogicGate |
getLogicGate()
returns the LogicGate corresponding to current gate |
(package private) Macro |
getMacro()
returns macro |
(package private) java.util.Vector |
getOutputGates()
returns the vector of output gates |
(package private) boolean |
getOutputValue()
returns the output value of a gate |
(package private) int |
getXCoor()
returns the x coordinate of the gate |
(package private) int |
getYCoor()
returns the y coordinate of the gate |
protected void |
loadImage()
loads the image given by imageLocation into the gate image |
(package private) void |
remove()
deletes a gate |
(package private) boolean |
removeOutputGate(GraphicGate gate)
removes the given gate from the Vector of output gates |
(package private) void |
setGateLocation(int x_,
int y_)
sets the gate location - used to move gate as well |
(package private) void |
setInput1(GraphicGate input1_)
sets input1 of the gate to the gate being connected |
(package private) void |
setInput2(GraphicGate input2_)
sets input2 of the gate to the gate being connected |
(package private) void |
setLogicGate(LogicGate logicGate_)
sets the logicGate variable - should be called in LogicGate constructor |
(package private) void |
setMacro(Macro gateMacro_)
sets macro |
(package private) void |
setOutputGates(java.util.Vector outputGates)
takes a vector of gates and sets it to the output gates vector |
(package private) void |
setOutputValue(boolean outputValue_)
sets the output value of the gate - called by coresponding logic gate when calculate is run |
Methods inherited from class java.awt.Component |
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected int x
protected int y
protected int id
protected int gateType
protected java.awt.Image image
protected java.awt.Graphics g
protected java.lang.String imageLocation
protected GraphicGate input1
protected GraphicGate input2
protected boolean outputValue
protected java.util.Vector output
protected LogicGate logicGate
protected Macro gateMacro
Constructor Detail |
GraphicGate(int x_, int y_, int id_, Macro gateMacro_, java.awt.Graphics g_)
x_
- x coordinatey_
- y coordinateid_
- gate idg_
- Graphics object to be drawn onMethod Detail |
protected void loadImage()
void drawImage()
void drawOutput()
int getGateType()
Macro getMacro()
void setMacro(Macro gateMacro_)
gateMacro_
- the new macrovoid setLogicGate(LogicGate logicGate_)
logicGate_
- the coresponding logic gate to this graphic gateLogicGate getLogicGate()
void setGateLocation(int x_, int y_)
x_
- x coordinatey_
- y coordinateint getXCoor()
int getYCoor()
void setOutputValue(boolean outputValue_)
outputValue_
- output value of gateboolean getOutputValue()
void addOutputGate(GraphicGate gate)
gate
- gate to be addedboolean removeOutputGate(GraphicGate gate)
gate
- gate to be removedjava.util.Vector getOutputGates()
void setOutputGates(java.util.Vector outputGates)
outputGates
- vector of gatesvoid setInput1(GraphicGate input1_)
input1_
- the gate being connectedGraphicGate getInput1()
void setInput2(GraphicGate input2_)
input2_
- the gate being connectedGraphicGate getInput2()
int getID()
void remove()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |