edu.ull.cgunay.plots
Class Plot

java.lang.Object
  |
  +--edu.ull.cgunay.plots.Plot
All Implemented Interfaces:
HasAxisLabels, Serializable
Direct Known Subclasses:
ErrorBarPlot, ProfilePlot, SimplePlot, SingleDataPlot, SpikePlot, SuperposedDataPlot

public abstract class Plot
extends Object
implements Serializable, HasAxisLabels

Grapher independent description for plots. The plot is converted to a grapher specific String representation when the plot(Grapher) method is invoked.

See the description in the Grapher class on how to display the plot. Other private methods in this class are simply delegated to the associated Grapher instance (if available).

Created: Mon Apr 8 17:35:11 2002

Modified: $Date: 2003/03/13 05:09:54 $

Version:
$Revision: 1.12 $ for this file.
Author:
Cengiz Gunay
See Also:
SimplePlot, plot(Grapher), range, Grapher, Serialized Form

Field Summary
(package private)  List axes
          The list of Grapher.Axis's contained in the plot.
(package private)  int fontSize
          Font size for plot legends. 0 means default size.
protected  Grapher grapher
          Grapher instance associated with the plot (if available).
(package private)  String label
          Label of the dataset if it is the only one in this plot.
protected  Range range
          Range of the plot.
(package private)  String title
          Plot title.
(package private)  String xLabel
          Label for the x-axis.
(package private)  String yLabel
          Label for the x-axis.
 
Constructor Summary
Plot()
          Calls other constructors with null params.
Plot(String label, Range range)
           
 
Method Summary
protected  String add(String param1, String param2)
           
protected  String assign(String param1, String param2)
           
protected  String def_func(String param1, String[] param2, String param3)
           
protected  String div(String param1, String param2)
           
protected  String exp(String param1)
           
protected  String func(String param1, String[] param2)
           
protected  String geq(String param1, String param2)
           
 int getFontSize()
          Get the FontSize value.
 Grapher getGrapher()
          Get the value of grapher.
 String getLabel()
          Get the value of label.
(package private) static Range getMaxRange(Collection plots)
           
(package private) static Range getMaxRange(HasAxisLabels[] plots)
          Find maximum range by iterating on all objects implementing HasAxisLabels.
 Range getRange()
          Get the value of range.
 String getTitle()
          Get the value of title.
 String getXLabel()
          Get the value of xLabel.
 String getYLabel()
          Get the value of yLabel.
protected  String mul(String param1, String param2)
           
protected  String neg(String param1)
           
 String plot(Grapher grapher)
          Deprecated. Grapher handles things by directly calling Grapher.plotToString() and using the PlotHandle
protected  String profile(Profile param1, Range param2)
           
protected  String range(Range param1)
           
abstract  String recipe(Grapher grapher)
          A new way to describe plots in terms of Grapher capabilities.
 void setFontSize(int newFontSize)
          Set the FontSize value.
 void setGrapher(Grapher v)
          Set the value of grapher.
 void setLabel(String v)
          Set the value of label.
 void setRange(Range v)
          Set the value of range.
 void setTitle(String v)
          Set the value of title.
 void setXLabel(String v)
          Set the value of xLabel.
 void setYLabel(String v)
          Set the value of yLabel.
protected  String sub(String param1, String param2)
           
 String toString()
          Give title or label as part of description.
protected  String variable(String param1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

grapher

protected transient Grapher grapher
Grapher instance associated with the plot (if available).


axes

List axes
The list of Grapher.Axis's contained in the plot.

TODO: maybe should go to the grapher dependent part, the PlotHandle.


title

String title
Plot title.


fontSize

int fontSize
Font size for plot legends. 0 means default size.


label

String label
Label of the dataset if it is the only one in this plot.


xLabel

String xLabel
Label for the x-axis.


yLabel

String yLabel
Label for the x-axis.


range

protected Range range
Range of the plot.

Constructor Detail

Plot

public Plot(String label,
            Range range)

Plot

public Plot()
Calls other constructors with null params.

Method Detail

getGrapher

public Grapher getGrapher()
Get the value of grapher.

Returns:
value of grapher.

setGrapher

public void setGrapher(Grapher v)
Set the value of grapher.

Parameters:
v - Value to assign to grapher.

getTitle

public String getTitle()
Get the value of title.

Specified by:
getTitle in interface HasAxisLabels
Returns:
value of title.

setTitle

public void setTitle(String v)
Set the value of title.

Parameters:
v - Value to assign to title.

getFontSize

public int getFontSize()
Get the FontSize value.

Specified by:
getFontSize in interface HasAxisLabels
Returns:
the FontSize value.

setFontSize

public void setFontSize(int newFontSize)
Set the FontSize value.

Parameters:
newFontSize - The new FontSize value.

toString

public String toString()
Give title or label as part of description.

Overrides:
toString in class Object
Returns:
a String value

getLabel

public String getLabel()
Get the value of label.

Returns:
value of label.

setLabel

public void setLabel(String v)
Set the value of label.

Parameters:
v - Value to assign to label.

getXLabel

public String getXLabel()
Get the value of xLabel.

Specified by:
getXLabel in interface HasAxisLabels
Returns:
value of xLabel.

setXLabel

public void setXLabel(String v)
Set the value of xLabel.

Parameters:
v - Value to assign to xLabel.

getYLabel

public String getYLabel()
Get the value of yLabel.

Specified by:
getYLabel in interface HasAxisLabels
Returns:
value of yLabel.

setYLabel

public void setYLabel(String v)
Set the value of yLabel.

Parameters:
v - Value to assign to yLabel.

getRange

public Range getRange()
Get the value of range.

Specified by:
getRange in interface HasAxisLabels
Returns:
value of range.

setRange

public void setRange(Range v)
Set the value of range.

Parameters:
v - Value to assign to range.

getMaxRange

static Range getMaxRange(HasAxisLabels[] plots)
Find maximum range by iterating on all objects implementing HasAxisLabels.

Parameters:
plots - a Collection of HasAxisLabels objects
Returns:
the maximal Range in the list

getMaxRange

static Range getMaxRange(Collection plots)

recipe

public abstract String recipe(Grapher grapher)
A new way to describe plots in terms of Grapher capabilities.

Parameters:
grapher - a Grapher value
Returns:
a String value

plot

public String plot(Grapher grapher)
Deprecated. Grapher handles things by directly calling Grapher.plotToString() and using the PlotHandle

Returns a String representation of the plot for the given grapher. Delegates the request to the Grapher instance.

Returns:
a String value

add

protected String add(String param1,
                     String param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.add(String, String)

assign

protected String assign(String param1,
                        String param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.assign(String, String)

profile

protected String profile(Profile param1,
                         Range param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.profile(Profile, Range)

sub

protected String sub(String param1,
                     String param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.sub(String, String)

mul

protected String mul(String param1,
                     String param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.mul(String, String)

geq

protected String geq(String param1,
                     String param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.geq(String, String)

div

protected String div(String param1,
                     String param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.div(String, String)

neg

protected String neg(String param1)
Parameters:
param1 -
Returns:
See Also:
Grapher.neg(String)

exp

protected String exp(String param1)
Parameters:
param1 -
Returns:
See Also:
Grapher.exp(String)

def_func

protected String def_func(String param1,
                          String[] param2,
                          String param3)
Parameters:
param1 -
param2 -
param3 -
Returns:
See Also:
Grapher.def_func(String, String[], String)

range

protected String range(Range param1)
Parameters:
param1 -
Returns:
See Also:
Grapher.range(Range)

func

protected String func(String param1,
                      String[] param2)
Parameters:
param1 -
param2 -
Returns:
See Also:
Grapher.func(String, String[])

variable

protected String variable(String param1)
Parameters:
param1 - a String value
Returns:
a String value
See Also:
Grapher.variable(String)