|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
fi.hu.cs.titokone.Animator
This class takes care of the animation window. It digs the needed information from a RunInfo instance.
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
private static int |
ALU_IN1
|
private static int |
ALU_IN2
|
private static int |
ALU_OUT
|
private java.lang.Thread |
animationThread
Thread, that runs animation. |
private java.awt.image.BufferedImage |
backgroundImage
|
private static int |
BASE
|
private java.lang.String |
comment1
Comment label |
private java.lang.String |
comment2
|
private java.lang.String |
currentCommand
Current command label |
private int |
delay
|
private java.awt.image.BufferedImage |
doubleBuffer
|
private boolean |
executeAnimationImmediately
If this is true, animation will be executed without repaitings and delays. |
private static int |
EXTERNAL_DEVICE
|
private RunInfo |
info
RunInfo object of currently running animation. |
private static int |
IR
|
private boolean |
isAnimating
Is animation currently running. |
private static java.lang.String[] |
labels
|
private static int |
LIMIT
|
private static int |
MAR
|
private static int |
MBR
|
private static int |
MEMORY
|
private static int |
PC
|
private int |
pointX
|
private int |
pointY
|
private static int |
R0
|
private static int |
R1
|
private static int |
R2
|
private static int |
R3
|
private static int |
R4
|
private static int |
R5
|
private static int |
R6
|
private static int |
R7
|
private static int[][] |
routeToBus
|
private static int |
SR
|
private java.lang.String |
SR_String
String presentation of status register. |
private static java.awt.Font |
textFont
|
private static int |
TR
|
private int[] |
value
Contains values of registers, alu, memory and external device. |
private static int[][] |
whereWriteLabelTo
|
private static int[][] |
whereWriteValueTo
|
Fields inherited from class javax.swing.JPanel |
|
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
Animator()
Creats new animator. |
Method Summary | |
boolean |
animate(RunInfo info)
This method produces an animation of a command based on the information in the RunInfo parameter. |
private void |
animateAnEvent(int from,
int to)
|
private void |
animateAnEvent(int from,
int to,
int newValue)
This method animates one event like "move 7 from R1 to In2 in ALU using the bus in between" The building block of a more complex operations like "STORE R1, 100" where one needs to fetch an instruction, decipher it etc. |
void |
init(TTK91Cpu cpu,
int baseValue,
int limitValue)
Initalizes animation. |
boolean |
isAnimationRunning()
|
static void |
main(java.lang.String[] args)
|
void |
paint(java.awt.Graphics g)
|
private void |
pause()
|
void |
run()
Animation is done in this run method. |
void |
setAnimationDelay(int delay)
Sets animation delay. |
void |
stopAnimation()
Stops currently running animation if there is one. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final java.awt.Font textFont
private static final int R0
private static final int R1
private static final int R2
private static final int R3
private static final int R4
private static final int R5
private static final int R6
private static final int R7
private static final int TR
private static final int PC
private static final int IR
private static final int SR
private static final int BASE
private static final int LIMIT
private static final int MAR
private static final int MBR
private static final int ALU_IN1
private static final int ALU_IN2
private static final int ALU_OUT
private static final int EXTERNAL_DEVICE
private static final int MEMORY
private static final int[][] routeToBus
private static final int[][] whereWriteValueTo
private static final int[][] whereWriteLabelTo
private static final java.lang.String[] labels
private int[] value
private java.lang.String currentCommand
private java.lang.String comment1
private java.lang.String comment2
private java.lang.String SR_String
private boolean executeAnimationImmediately
private boolean isAnimating
private java.lang.Thread animationThread
private RunInfo info
private java.awt.image.BufferedImage backgroundImage
private java.awt.image.BufferedImage doubleBuffer
private int pointX
private int pointY
private int delay
Constructor Detail |
public Animator() throws java.io.IOException
java.io.IOException
- If there are problems reading background image throw IOException.Method Detail |
public void paint(java.awt.Graphics g)
public void run()
run
in interface java.lang.Runnable
public void stopAnimation()
public boolean isAnimationRunning()
public boolean animate(RunInfo info)
info
- A RunInfo to base the animation on.
public void init(TTK91Cpu cpu, int baseValue, int limitValue)
cpu
- A TTK91Cpu, giving the start values of the registers.baseValue
- Value of the BASE register in MMU.limitValue
- Value of the LIMIT register in MMU.public void setAnimationDelay(int delay)
delay
- Delay between frames in milliseconds.private void animateAnEvent(int from, int to, int newValue)
from
- From where does the value come from.to
- Where is the value going to be transported.newValue
- New value replaces the old value in destination.private void animateAnEvent(int from, int to)
private void pause()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |