public class TrafficLightSimulator
extends java.awt.Canvas
Constructor and Description |
---|
TrafficLightSimulator(TrafficEventHandler trafficEventHandler,
Activator activator) |
Modifier and Type | Method and Description |
---|---|
void |
changeLight(double time)
Change the traffic light color.
|
void |
clearTimeWaitedLine()
Clear the waiting time line.
|
void |
displayCases(TrafficSituationCase query,
java.util.ArrayList<TrafficSituationCase> trafficCases)
Display the query case and the retrieved cases in the table
|
void |
displayNoIntentionToUserInTable() |
void |
initPic()
Initialize the pictures used by the traffic light (Reduce flickering).
|
void |
normalMode()
Deactivate GUI required to store a new case
|
void |
paint(java.awt.Graphics g) |
void |
retainMode()
Activate GUI required to store a new case
|
void |
showTimeWaited(double time)
Convert how long a pedestrian has waited to X coordinates, which is used to draw the timeLine.
|
void |
stop()
Stop the changeLight method, because all the loops become false
|
void |
update(java.awt.Graphics g)
Update the traffic light graphics
|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
public TrafficLightSimulator(TrafficEventHandler trafficEventHandler, Activator activator)
trafficEventHandler
- Used to bind the keyEvents to the GUIactivator
- The Activatorpublic void retainMode()
public void normalMode()
public void displayCases(TrafficSituationCase query, java.util.ArrayList<TrafficSituationCase> trafficCases)
query
- Case created from the sensor datatrafficCases
- The retrieved casespublic void initPic()
public void update(java.awt.Graphics g)
update
in class java.awt.Canvas
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
public void clearTimeWaitedLine()
public void showTimeWaited(double time)
time
- The pedestrian that have waited the longest timepublic void displayNoIntentionToUserInTable()
public void changeLight(double time)
time
- Crossing timepublic void stop()