All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sim.display.Plot

java.lang.Object
   |
   +----sim.display.Plot

public abstract class Plot
extends Object
implements Parsable, Watchable, Watcher
Classes inheriting from Plot represent one layer in a Graph2D display, or one layer on the bottom of the cube in a Graph3D display.

This code is (c) 1996,1997 Ansgar Laubsch and Leemon Baird <leemon@cs.cmu.edu>, http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely. If the code is modified, please state so in the comments.

Version:
1.0 15 May 97
Author:
Leemon Baird

Variable Index

 o parentDisplay
the Display that this plot will be drawn on
 o watchManager
the WatchManager that this class registers with
 o wmName
the prefix for all registered variables

Constructor Index

 o Plot()

Method Index

 o autoscaleBounds(PDouble, PDouble, PDouble, PDouble)
Put preferred autoscaling bounds into the variables pointed to by these four pointers.
 o BNF(int)
Return the BNF description of how to parse the parameters of this object.
 o destroy()
Clean up threads, Graphics contexts, etc., and let owned objects do the same
 o drawAll(Graphics, double, double, double, double, int, int, int, int, int, int)
Draw the plot.
 o getName()
Return the variable "name" that was passed into setWatchManager
 o getParameters(int)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
 o getWatchManager()
Get the WatchManager being used
 o initialize(int)
Initialize, either partially or completely.
 o parse(Parser, int)
Parse the input file to get the parameters for this object.
 o setWatchManager(WatchManager, String)
Remember the WatchManager for this object and create the window.
 o unparse(Unparser, int)
Output a description of this object that can be parsed with parse().
 o unregister(String)
One of the watched variables has been unregistered.
 o update(String, Pointer, Watchable)
Record any data being watched, but don't redraw the screen.

Variables

 o watchManager
 protected WatchManager watchManager
the WatchManager that this class registers with

 o wmName
 protected String wmName
the prefix for all registered variables

 o parentDisplay
 public Display parentDisplay
the Display that this plot will be drawn on

Constructors

 o Plot
 public Plot()

Methods

 o update
 public void update(String changedName,
                    Pointer changedVar,
                    Watchable obj)
Record any data being watched, but don't redraw the screen. This is called whenever a trigger variable is changed for the Nth time. If not overridden, it assumes a parameter was changed, and just redraws the screen.

 o setWatchManager
 public void setWatchManager(WatchManager wm,
                             String name)
Remember the WatchManager for this object and create the window. After everything is parsed and windows are created, all experiments are given a watchManager by Simulator, then it starts giving each Display a watchManager. This is where the Display should register each variable it wants to watch.

 o getName
 public String getName()
Return the variable "name" that was passed into setWatchManager

 o getWatchManager
 public WatchManager getWatchManager()
Get the WatchManager being used

 o unregister
 public void unregister(String watchedVar)
One of the watched variables has been unregistered.

 o autoscaleBounds
 public void autoscaleBounds(PDouble xMin,
                             PDouble xMax,
                             PDouble yMin,
                             PDouble yMax)
Put preferred autoscaling bounds into the variables pointed to by these four pointers. Change the variables only if the bounds should be expanded to be larger than what the variables already say.

 o destroy
 public void destroy()
Clean up threads, Graphics contexts, etc., and let owned objects do the same

 o getParameters
 public Object[][] getParameters(int lang)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.

See Also:
getParameters
 o BNF
 public String BNF(int lang)
Return the BNF description of how to parse the parameters of this object.

 o unparse
 public void unparse(Unparser u,
                     int lang)
Output a description of this object that can be parsed with parse().

 o parse
 public Object parse(Parser p,
                     int lang) throws ParserException
Parse the input file to get the parameters for this object.

Throws: ParserException
parser didn't find the required token
 o drawAll
 public abstract void drawAll(Graphics g,
                              double xMin,
                              double xMax,
                              double yMin,
                              double yMax,
                              int startX,
                              int startY,
                              int xAxisX,
                              int xAxisY,
                              int yAxisX,
                              int yAxisY)
Draw the plot. The region of mathematical space to draw is (xMin,yMin)-(xMax,yMax), where (xMin,yMin) is plotted at screen coordinates (startX,startY), and (xMax,yMin) is plotted at screen coordinates (xAxisX,xAxisY), and (xMin,yMax) is plotted at screen coordinates (yAxisX,yAxisY).

 o initialize
 public void initialize(int level)
Initialize, either partially or completely.

See Also:
initialize

All Packages  Class Hierarchy  This Package  Previous  Next  Index