edu.uah.math.devices
Class Timeline

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.uah.math.devices.Graph
                      extended by edu.uah.math.devices.Timeline
All Implemented Interfaces:
java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class Timeline
extends Graph
implements java.awt.event.MouseMotionListener, java.io.Serializable

This class defines a simple timeline for displaying random points in time. The timeline is shown as an axis, with the points in time as dots in specified colors. This object is useful for the Poisson and negative binomial experiments.

Version:
August, 2003
Author:
Dawn Duehring, Kyle Siegrist
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class edu.uah.math.devices.Graph
ABOVE, BELOW, HORIZONTAL, LEFT, RIGHT, showModelDistribution, VERTICAL
 
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.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
Timeline()
          This default constructor creates a new timeline corresponding to the default domain (0, 1) (with step size 0.1), and with the default name "x".
Timeline(Domain d)
          This special constructor creates a new timeline corresponding to a specified domain and the default name "x".
Timeline(Domain d, java.lang.String n)
          This general constructor creates a new timeline corresponding to a specified domain and a specified name for the underlying variable.
 
Method Summary
 void addTime()
          This method adds a new time point of the default color red that is uniformly distributed on the domain.
 void addTime(java.awt.Color c)
          This method adds a new time point of a specified color that is uniformly distributed on the domain.
 void addTime(double t)
          This method adds a new time with the default color red.
 void addTime(double t, java.awt.Color c)
          This method adds a new time with a specified color.
 java.awt.Color getAxisColor()
          This method returns the axis color.
 java.awt.Color getColor(int i)
          This method returns the color at a specified index.
 java.util.Vector getColors()
          This method returns the entire vector of colors
 double getCummilativeTimesAtIndex(int ind)
          This method returns the Cummulative times UP-TO a specified index.
 double getCurrentTime()
          This method gets the current time.
 java.awt.Color getCurrentTimeColor()
          This method returns the color used to denote the current time.
 int getDataSize()
          This method returns the number of data points.
 Domain getDomain()
          This method returns the domain.
 java.lang.String getName()
          This method retunrs the name.
 double getTime(int i)
          This method returns the time at a specified index.
 java.util.Vector getTimes()
          This method returns the entire vector of times.
 void mouseDragged(java.awt.event.MouseEvent event)
           
 void mouseMoved(java.awt.event.MouseEvent e)
          This method handles the mouse move event.
 void paintComponent(java.awt.Graphics g)
          This method paints the timeline as an axis, with the data points as dots in a specified color.
 void reset()
          This method resets the data, by clearing the vector of times and colors, and then repaints the timeline.
 void resetData()
          This method resets the data by clearing the vector of times and color.
 void setAxisColor(java.awt.Color c)
          This method specifies the axis color.
 void setCurrentTime(double t)
          This method sets the current time.
 void setCurrentTimeColor(java.awt.Color c)
          This method sets the color used for the current time tick mark.
 void setDomain(Domain d)
          This method sets the domain.
 void setName(java.lang.String n)
          This method sets the name.
 
Methods inherited from class edu.uah.math.devices.Graph
drawAxis, drawAxis, drawAxis, drawBox, drawBox, drawBoxPlot, drawBoxPlot, drawCircle, drawLabel, drawLine, drawPoint, drawTick, drawTick, fillBox, fillBox, fillBoxPlot, fillBoxPlot, fillCircle, format, getBottomMargin, getLeftMargin, getPointSize, getRightMargin, getTopMargin, getXGraph, getXMax, getXMin, getXPixels, getXScale, getYGraph, getYMax, getYMin, getYPixels, getYScale, setMargins, setPointSize, setScale, setShowModelDistribution
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, 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
 

Constructor Detail

Timeline

public Timeline(Domain d,
                java.lang.String n)
This general constructor creates a new timeline corresponding to a specified domain and a specified name for the underlying variable.

Parameters:
d - the domain
n - the name

Timeline

public Timeline(Domain d)
This special constructor creates a new timeline corresponding to a specified domain and the default name "x".


Timeline

public Timeline()
This default constructor creates a new timeline corresponding to the default domain (0, 1) (with step size 0.1), and with the default name "x".

Method Detail

setDomain

public void setDomain(Domain d)
This method sets the domain.

Parameters:
d - the domain of the variable

getDomain

public Domain getDomain()
This method returns the domain.

Returns:
the domain of the variable

setName

public void setName(java.lang.String n)
This method sets the name.

Overrides:
setName in class java.awt.Component
Parameters:
n - the name of the variable

getName

public java.lang.String getName()
This method retunrs the name.

Overrides:
getName in class java.awt.Component
Returns:
the name of the variable

paintComponent

public void paintComponent(java.awt.Graphics g)
This method paints the timeline as an axis, with the data points as dots in a specified color. The data points up to the current time are painted.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - the graphics context

setAxisColor

public void setAxisColor(java.awt.Color c)
This method specifies the axis color.

Parameters:
c - the axis color

getAxisColor

public java.awt.Color getAxisColor()
This method returns the axis color.

Returns:
the axis color

addTime

public void addTime(double t,
                    java.awt.Color c)
This method adds a new time with a specified color.

Parameters:
t - the value (time) of the data point
c - the color to be used to represent the point

addTime

public void addTime(double t)
This method adds a new time with the default color red.

Parameters:
t - the value (time) of the data point

addTime

public void addTime(java.awt.Color c)
This method adds a new time point of a specified color that is uniformly distributed on the domain.

Parameters:
c - the color of the point

addTime

public void addTime()
This method adds a new time point of the default color red that is uniformly distributed on the domain.


getTime

public double getTime(int i)
This method returns the time at a specified index.

Parameters:
i - the index
Returns:
the time corresponding to the index

getCummilativeTimesAtIndex

public double getCummilativeTimesAtIndex(int ind)
This method returns the Cummulative times UP-TO a specified index.

Parameters:
i - the index
Returns:
the Cummulative time corresponding to Sum of all time up-to the index

getTimes

public java.util.Vector getTimes()
This method returns the entire vector of times.

Returns:
the vector of time points

getDataSize

public int getDataSize()
This method returns the number of data points.

Returns:
the number of points in the dataset

getColor

public java.awt.Color getColor(int i)
This method returns the color at a specified index.

Parameters:
i - the index
Returns:
the color corresponding to the index

getColors

public java.util.Vector getColors()
This method returns the entire vector of colors

Returns:
the vector of colors

resetData

public void resetData()
This method resets the data by clearing the vector of times and color.


reset

public void reset()
This method resets the data, by clearing the vector of times and colors, and then repaints the timeline.


setCurrentTime

public void setCurrentTime(double t)
This method sets the current time.

Parameters:
t - the current time

getCurrentTime

public double getCurrentTime()
This method gets the current time.

Returns:
the current time

setCurrentTimeColor

public void setCurrentTimeColor(java.awt.Color c)
This method sets the color used for the current time tick mark.

Parameters:
c - the color for the current time

getCurrentTimeColor

public java.awt.Color getCurrentTimeColor()
This method returns the color used to denote the current time.

Returns:
the color for the current time

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
This method handles the mouse move event. The coordinates of the mouse (in scale units) are shown in the tool tip.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener