public class CoinTossLLNGraph extends Graph
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
ABOVE, BELOW, HORIZONTAL, LEFT, RIGHT, showModelDistribution, VERTICAL
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
CoinTossLLNGraph()
This defaut constructor creates a new CoinTossLLNGraph with 50 Heads and
30 Tails.
|
CoinTossLLNGraph(int _total)
This general constructor creates a new CoinToss LLN Graph with specified total
(the number of experiments (coin tosses).
|
Modifier and Type | Method and Description |
---|---|
void |
addAHead()
This method adds a Head at the next index.
|
void |
addAHead(int i)
This method adds a Head at a specified time index.
|
void |
addATail()
This method adds a Tails at the next index.
|
void |
addATail(int i)
This method adds a Tails at a specified time index.
|
void |
computeStats(int i)
This method computes the Proportions and Difference Statistics up to current index.
|
float |
getDifferences(int i)
This method gets the 2|H-T|/Total difference at a specified time index.
|
java.awt.Color |
getGraphColor()
This method returns the color for the graph of the random walk.
|
int |
getHeads()
This method returns the total number of Heads.
|
int |
getHeads(int ind)
This method returns the number of Heads up to index (ind).
|
int |
getIndex()
This method returns the Current Index.
|
float |
getProbability()
This method gets the theoretical probability.
|
float |
getProportion(int i)
This method gets the H/(H+T) proportion at a specified time index.
|
int |
getTails()
This method returns the total number of Tails.
|
int |
getTails(int ind)
This method returns the Tails up to index (ind).
|
int |
getTotal()
This method returns the total number of experiments (H + T).
|
double |
maxDiff()
This method computes the Maximum difference for the sample (for graph normalization)
|
void |
paintComponent(java.awt.Graphics g)
This method draws the graph of the random walk.
|
void |
reset()
This method resets the balot graph.
|
void |
setAllValues(int[] newValues)
This method resets the balot graph.
|
void |
setDifferences(int i,
float d)
This method sets the 2|H-T|/Total difference at a specified time index.
|
void |
setGraphColor(java.awt.Color c)
This method sets the color for the graph of the random walk.
|
void |
setIndex(int i)
This method sets the Current Index.
|
void |
setParameters(int t)
This method sets the basic parameter: number of experiments.
|
void |
setProbability(float _p)
This method sets the theoretical probability.
|
void |
setProportions(int i,
float p)
This method sets the Heads Proportion at a specified time index.
|
void |
setTotal(int _total)
This method sets the total number of experiments to be done.
|
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
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, getName, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public CoinTossLLNGraph(int _total)
total
- the total number of trials.public CoinTossLLNGraph()
public void setParameters(int t)
t
- the total number of experiments.public void setProbability(float _p)
p
- is the theoretical probability for a Headpublic float getProbability()
p
- is the theoretical probability for a Headpublic int getHeads(int ind)
public int getTails(int ind)
public int getHeads()
public int getTails()
public int getTotal()
public int getIndex()
public void setIndex(int i)
public void setTotal(int _total)
t
- is the Total value.public void addAHead(int i)
i
- the indexpublic void addAHead()
public void addATail(int i)
i
- the indexpublic void addATail()
public void computeStats(int i)
i
- the indexpublic float getProportion(int i)
i
- the indexpublic void setDifferences(int i, float d)
i
- the indexd
- the difference valuepublic double maxDiff()
public void setProportions(int i, float p)
i
- the indexp
- the proportionpublic float getDifferences(int i)
i
- the indexpublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void setAllValues(int[] newValues)
public void reset()
public void setGraphColor(java.awt.Color c)
c
- the graph colorpublic java.awt.Color getGraphColor()