org.mbari.siam.moos.utils.chart.graph
Class BuildGraph

java.lang.Object
  extended by java.io.StreamTokenizer
      extended by org.mbari.siam.moos.utils.chart.graph.ScanWord
          extended by org.mbari.siam.moos.utils.chart.graph.BuildGraph

public class BuildGraph
extends ScanWord

This class will parse a description file and build a plot based on the instructions in the file. The build Graph class, with attached Axes and DataSets can be accessed though methods in the class

Version:
$Revision: 1.1 $, $Date: 2008/11/04 22:17:55 $
Author:
Leigh Brookshaw

Field Summary
protected  java.applet.Applet applet
          The Calling Applet
protected  java.util.Stack build
          The BUILD stack.
protected  java.util.Vector built
          The class vector.
protected  boolean debug
          Debug.
protected  java.lang.Object graph
          The constructed Graph Object
protected  TextLine graphtitle
          The TextLine containing the title
 int level
          The current brace level.
 int lineno
          Current line being parsed
protected  java.util.Stack object
          The Object stack.
 
Fields inherited from class org.mbari.siam.moos.utils.chart.graph.ScanWord
ERROR, STRING, UNKNOWN
 
Fields inherited from class java.io.StreamTokenizer
nval, sval, TT_EOF, TT_EOL, TT_NUMBER, TT_WORD, ttype
 
Constructor Summary
BuildGraph(java.io.InputStream in, java.applet.Applet ap)
          Instantiate the class
 
Method Summary
protected  double[] arrayFromFunction(ParseFunction f, int nx, double xmin, double xmax)
           
protected  double[] arrayFromFunction(ParseFunction f, int nx, double xmin, double xmax, int ny, double ymin, double ymax)
           
protected  boolean build(org.mbari.siam.moos.utils.chart.graph.NamedObject nobj)
          Based on the parsed object build something.
protected  boolean buildAxis()
           
protected  boolean buildContour(org.mbari.siam.moos.utils.chart.graph.NamedObject nobj)
           
protected  boolean buildData(int type)
           
protected  boolean buildFont()
           
protected  boolean buildGraph(int type)
          Pop things off the object stack and build the graph
protected  boolean buildGrid()
           
protected  boolean buildLabel()
           
protected  boolean buildMarker()
           
protected  boolean buildTitle()
           
protected  boolean buildZero()
           
 java.util.Vector getBuilt()
          Get a vector of all the built Classes.
 java.lang.Object getGraph()
          Get the Graph object that has been built!
 TextLine getGraphTitle()
          Get the title of the Graph
protected  boolean isContext(int token)
          Check if the object is on the "to be built" stack.
 void parse()
          This is THE method that parses the input file and constructs the plot.
 
Methods inherited from class org.mbari.siam.moos.utils.chart.graph.ScanWord
addKeyWord, closeStream, getKeyValue, getNumber, nextWord, resetKeyWords, resetWordSyntax, setStringChar
 
Methods inherited from class java.io.StreamTokenizer
commentChar, eolIsSignificant, lineno, lowerCaseMode, nextToken, ordinaryChar, ordinaryChars, parseNumbers, pushBack, quoteChar, resetSyntax, slashSlashComments, slashStarComments, toString, whitespaceChars, wordChars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

build

protected java.util.Stack build
The BUILD stack. Everything pushed on this stack has to be built from other objects. An example would be a Font, which is constructed from Logical name, style and size.


object

protected java.util.Stack object
The Object stack. All input tokens get pushed onto and popped off this stack.


built

protected java.util.Vector built
The class vector. This contains final class objects that cannot be deleted. That is we don't want these classes unnattached and collected into the garbage. The obvious classes here are the main Graph2D class, the Axes of the plot DataSets etc.


graph

protected java.lang.Object graph
The constructed Graph Object


graphtitle

protected TextLine graphtitle
The TextLine containing the title


applet

protected java.applet.Applet applet
The Calling Applet


debug

protected boolean debug
Debug. If true output copious debug messages. Though unless you know what is going on with the code most messages will probably be meaningless


lineno

public int lineno
Current line being parsed


level

public int level
The current brace level. At the end of the input if all braces are matched the level should be back to zero.

Constructor Detail

BuildGraph

public BuildGraph(java.io.InputStream in,
                  java.applet.Applet ap)
Instantiate the class

Parameters:
in - The inputstream to be read
ap - the driving applet.
Method Detail

getGraph

public java.lang.Object getGraph()
Get the Graph object that has been built!


getGraphTitle

public TextLine getGraphTitle()
Get the title of the Graph


getBuilt

public java.util.Vector getBuilt()
Get a vector of all the built Classes. Ie the DataSets, Axis, Graph etc. This can be used by an applet to override anything specified in the input file


parse

public void parse()
This is THE method that parses the input file and constructs the plot.


isContext

protected boolean isContext(int token)
Check if the object is on the "to be built" stack. This way context can be checked so potential errors flagged.

Parameters:
token - is this the object we are currently building?
Returns:
true if the token matches current object being built

build

protected boolean build(org.mbari.siam.moos.utils.chart.graph.NamedObject nobj)
Based on the parsed object build something.

Parameters:
nobj - The object to be built
Returns:
true if the build was successful.

buildGraph

protected boolean buildGraph(int type)
Pop things off the object stack and build the graph

Parameters:
type - Type of graph to build, Graph2D, G2Dint, Contour.
Returns:
true if the build was successful

buildContour

protected boolean buildContour(org.mbari.siam.moos.utils.chart.graph.NamedObject nobj)
Returns:
true if the build was successful

buildFont

protected boolean buildFont()
Returns:
true if the build was successful

buildTitle

protected boolean buildTitle()
Returns:
true if the build was successful

buildLabel

protected boolean buildLabel()
Returns:
true if the build was successful

buildMarker

protected boolean buildMarker()

buildData

protected boolean buildData(int type)
Returns:
true if the build was successful

arrayFromFunction

protected double[] arrayFromFunction(ParseFunction f,
                                     int nx,
                                     double xmin,
                                     double xmax)

arrayFromFunction

protected double[] arrayFromFunction(ParseFunction f,
                                     int nx,
                                     double xmin,
                                     double xmax,
                                     int ny,
                                     double ymin,
                                     double ymax)

buildAxis

protected boolean buildAxis()
Returns:
true if the build was successful

buildGrid

protected boolean buildGrid()
Returns:
true if the build was successful

buildZero

protected boolean buildZero()
Returns:
true if the build was successful


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.