com.singularsys.jepexamples.applets
Class ParametrisedCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by com.singularsys.jepexamples.applets.AbstractCanvas
              extended by com.singularsys.jepexamples.applets.ParametrisedCanvas
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class ParametrisedCanvas
extends AbstractCanvas

This class plots parametrised curves specified by two Jep expressions.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
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
protected  Jep jep
          Math parser
protected  Variable t
          "x" variable
protected  Node xExpression
          Expression to evaluate
protected  Node yExpression
           
 
Fields inherited from class com.singularsys.jepexamples.applets.AbstractCanvas
axisColor, bgColor, cenX, cenY, defaultOffX, defaultOffY, defaultScaleX, defaultScaleY, dimensions, gridColor, labelColor, labelFont, lastpos, offX, offY, popup, scaleFont, scaleX, scaleY, showGrid, showScale, showTime, strategy
 
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
ParametrisedCanvas(Jep jep, Variable t, double min, double max, int steps)
           
 
Method Summary
 void dump()
          Dump the coordinates on the standard output
 Variable getT()
           
 double getTMax()
           
 double getTMin()
           
 int getTSteps()
           
 Node getXExpression()
           
protected  double getXValue(double tValue)
           
 Node getYExpression()
           
protected  double getYValue(double tValue)
           
protected  void paintCurve(java.awt.Graphics g)
          Paints the graph of the function.
 void rescaled()
          Called when scale, or offset changed Default action is to call repaint
 void setRange(double min, double max, int steps)
           
 void setT(Variable t)
           
 void setXExpression(Node xExpr)
           
 void setYExpression(Node yExpr)
           
 
Methods inherited from class com.singularsys.jepexamples.applets.AbstractCanvas
center, clipX, clipY, componentHidden, componentMoved, componentResized, componentShown, getOffX, getOffY, getPopup, getScaleX, getScaleY, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, paint, paintAxes, paintCanvas, paintGrid, paintScale, paintTime, paintWhite, reset, resetCanvas, resized, setOffset, setScale, shiftCanvas, update, xAbsolute, xRelative, yAbsolute, yRelative, zoomCanvas
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, 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, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jep

protected Jep jep
Math parser


xExpression

protected Node xExpression
Expression to evaluate


yExpression

protected Node yExpression

t

protected Variable t
"x" variable

Constructor Detail

ParametrisedCanvas

public ParametrisedCanvas(Jep jep,
                          Variable t,
                          double min,
                          double max,
                          int steps)
Parameters:
jep - The Jep instance
t - A Variable object holding the parameter
min - minimum value for parameter
max - maximum value for parameter
steps - number of line segments to draw
Method Detail

getT

public Variable getT()

setT

public void setT(Variable t)

getXExpression

public Node getXExpression()

getYExpression

public Node getYExpression()

setXExpression

public void setXExpression(Node xExpr)

setYExpression

public void setYExpression(Node yExpr)

getTMin

public double getTMin()

getTMax

public double getTMax()

getTSteps

public int getTSteps()

setRange

public void setRange(double min,
                     double max,
                     int steps)

getYValue

protected double getYValue(double tValue)
Returns:
The value of the function at an x value of the parameter. NaN on errors

getXValue

protected double getXValue(double tValue)

paintCurve

protected void paintCurve(java.awt.Graphics g)
Paints the graph of the function. A null argument cause the values to be dumped to stdout.

Specified by:
paintCurve in class AbstractCanvas

rescaled

public void rescaled()
Description copied from class: AbstractCanvas
Called when scale, or offset changed Default action is to call repaint

Overrides:
rescaled in class AbstractCanvas

dump

public void dump()
Dump the coordinates on the standard output

Specified by:
dump in class AbstractCanvas


Copyright © 2010 Singular Systems http://www.singularsys.com/jep