|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--edu.ull.cgunay.plots.Grapher
Represents the active Grapher process and its capabilities. The methods defined in this class are generic or abstract if it is not possible to generalize them.
Returns string representations for various operations according to the grapher platform. Each of the classes extending this class specifies such a platform.
In order to create a plot the usage is as follows:
Grapher g = new ...();
Plot p = new ...();
g.display(p);
Created: Mon Apr 8 17:12:23 2002
Modified: $Date: 2003/03/21 05:10:57 $
Plot| Nested Class Summary | |
protected class |
Grapher.Axis
An object that represent a data axis for the grapher. |
(package private) class |
Grapher.Data
Each dataset that can be added to an Axis. |
protected class |
Grapher.DataType
Type of representation for the data. |
class |
Grapher.ErrorData
For errorbar plots. |
protected class |
Grapher.MultiAxes
An object that combines multiple axes. |
class |
Grapher.PreciseProfileData
Data structure for generating profile plots. |
class |
Grapher.ProfileData
Data structure for generating profile plots, where the precision can be defined as the total number of points on the plot. |
class |
Grapher.VerticalBar
For drawing a vertical bar on the x-axis. |
| Field Summary | |
protected Hashtable |
dataTypes
Hash to hold name->datatype values for a grapher. |
(package private) BufferedReader |
err
Reader of the error stream of the grapher process. |
(package private) BufferedReader |
msg
Reader of the output stream of the grapher process. |
PrintWriter |
out
The output stream that is connected to the grapher process. |
(package private) int |
points
Number of points on the graph, default is 100. |
(package private) Process |
process
The runtime process of the spawned grapher program. |
protected int |
windowNumber
The number of the window in which the plot will appear. |
| Constructor Summary | |
(package private) |
Grapher(String processName)
Spawns a grapher process (used from subclasses). |
| Method Summary | |
String |
add(String a,
String b)
Returns a String that adds two parameters for the Grapher.
|
String |
assign(String var,
String value)
Returns a String that assigns a value to a variable
for the Grapher. |
void |
close()
Kills the grapher process. |
String |
command(String line)
Properly terminate a grapher command with end-of-line separator. |
abstract Grapher.Axis |
createAxis()
Factory method fro creating Axis instances. |
abstract Grapher.MultiAxes |
createMultiAxes(Grapher.Axis[] axes)
Factory method fro creating MultiAxes instances. |
abstract Grapher.MultiAxes |
createMultiAxes(List axes)
Factory method fro creating MultiAxes instances. |
abstract String |
def_func(String name,
String[] params,
String body)
Returns a String that defines a function
for the Grapher. |
PlotHandle |
display(Plot plot,
PrintStream out)
Displays the plot generated from the given plot description. |
String |
div(String a,
String b)
Returns a String that divides two parameters for the Grapher.
|
String |
exp(String a)
Returns a String that takes the exponential of the
parameter for the Grapher.
|
String |
func(String name,
String[] params)
Returns a String that calls a predefined function with given arguments
for the Grapher. |
String |
geq(String a,
String b)
Returns a String that is a greater or equal conditional
expression for the Grapher.
|
int |
getPoints()
Get the value of points. |
String |
mul(String a,
String b)
Returns a String that multiplies two parameters for the Grapher.
|
abstract PlotHandle |
multiPlot(Collection plots,
PrintStream out)
Multiple plots in the same window, arranged one on top of the other with same range. |
PlotHandle |
multiPlot(Plot[] plots,
PrintStream out)
|
String |
neg(String a)
Returns a String that negates the parameter for the Grapher.
|
String |
paren(String a)
Returns a String that parenthesizes the parameter
for the Grapher. |
abstract String |
plotToString(SimplePlot plot)
Deprecated. |
abstract String |
plotToString(SpikePlot plot)
Deprecated. |
abstract String |
plotToStringAlt(Plot plot)
When defined, should call plot.recipe. |
String |
profile(Profile profile,
Range range)
Returns a string representation of a Profile for
a given Range. |
String |
quote(String value)
Quotes the given string. |
String |
range(Range range)
Returns a String that gives a range
for the Grapher. |
String |
response()
Returns the standard and error outputs of the process if available. |
void |
setPoints(int v)
Set the value of points. |
abstract void |
setWindow(int windowNumber)
Sets the current plot window according to grapher platform. |
String |
sub(String a,
String b)
Returns a String that subtracts two parameters for the Grapher.
|
abstract PlotHandle |
superposedPlot(String title,
Collection plots,
PrintStream out)
Multiple datasets on the same axis. |
PlotHandle |
superposedPlot(String title,
Plot[] plots,
PrintStream out)
|
(package private) String |
variable(String name)
Returns a String that represents the given
variable for the Grapher. |
void |
waitForResponse()
Wait until a response comes from either the output or error streams of the process. |
abstract void |
writeEPS(PlotHandle handle,
String filename)
Exports an EPS file of the previously visualized (required) plot. |
abstract void |
writeEPSbw(PlotHandle handle,
String filename)
Exports a black-n-white EPS file of the previously visualized (required) plot. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
Process process
GNUPlot,
MatLabpublic PrintWriter out
BufferedReader msg
BufferedReader err
int points
protected int windowNumber
protected Hashtable dataTypes
| Constructor Detail |
Grapher(String processName) throws GrapherNotAvailableException
processName - the string to be executed
GrapherNotAvailableException - cannot connect process or streams| Method Detail |
public int getPoints()
public void setPoints(int v)
v - Value to assign to points.
public String profile(Profile profile,
Range range)
Profile for
a given Range. Most of the time it should be in the form of
((t>t1)*v1 + (t>t2)*(v2-v1) + ... ) where t is the variable denoting time,
and (t1,v1) is a pair found in the profile. See specific implementations for
more information. It is an error if the Profilable entity does not
meaningfully define its doubleValue() method, that is converted
to a simple double value.
profile - a Profile valuerange - a Range value
String valueProfilable.doubleValue()public abstract String plotToString(SimplePlot plot)
Plot.body() as the body.
plot - a Plot value
String valueSimplePlot.body()public abstract String plotToString(SpikePlot plot)
String representation of a spike
plot for the Grapher.
plot - a SpikePlot value
String valuepublic abstract String plotToStringAlt(Plot plot)
plot.recipe.
plot - a Plot value
String value
public PlotHandle multiPlot(Plot[] plots,
PrintStream out)
plots - a Plot[] valueout - a PrintStream value
String valuemultiPlot(Collection,PrintStream)
public abstract PlotHandle multiPlot(Collection plots,
PrintStream out)
plots - a Collection valueout - a PrintStream value
String valueGNUPlot.multiPlot(java.util.Collection, java.io.PrintStream),
MatLab.multiPlot(java.util.Collection, java.io.PrintStream)
public PlotHandle superposedPlot(String title,
Plot[] plots,
PrintStream out)
title - a String valueplots - a Plot[] valueout - a PrintStream value
PlotHandle valuesuperposedPlot(String,Collection,PrintStream)
public abstract PlotHandle superposedPlot(String title,
Collection plots,
PrintStream out)
title - a String valueplots - a Collection valueout - a PrintStream value
PlotHandle valuepublic abstract Grapher.Axis createAxis()
Axis instances.
Axis subclass instance for the given grapher.public abstract Grapher.MultiAxes createMultiAxes(Grapher.Axis[] axes)
MultiAxes instances.
axes - a Grapher.Axis[] value
Grapher.MultiAxes valuepublic abstract Grapher.MultiAxes createMultiAxes(List axes)
MultiAxes instances.
axes - a List of Grapher.Axis[] values
Grapher.MultiAxes valueString variable(String name)
String that represents the given
variable for the Grapher. By default it is
"name".
name - a String value
String value
public String add(String a,
String b)
String that adds two parameters for the Grapher.
By default it is "(a) + (b)".
a - a String valueb - a String value
String value
public String sub(String a,
String b)
String that subtracts two parameters for the Grapher.
by default it is add((a), neg(b)).
a - a String valueb - a String value
String value
public String mul(String a,
String b)
String that multiplies two parameters for the Grapher.
By default it is "(a) * (b)".
a - a String valueb - a String value
String value
public String geq(String a,
String b)
String that is a greater or equal conditional
expression for the Grapher.
By default it is "(a) >= (b)".
a - a String valueb - a String value
String value
public String div(String a,
String b)
String that divides two parameters for the Grapher.
By default it is "(a) / (b)".
a - a String valueb - a String value
String valuepublic String neg(String a)
String that negates the parameter for the Grapher.
By default it is "-(a)".
a - a String value
String valuepublic String exp(String a)
String that takes the exponential of the
parameter for the Grapher.
By default it is "exp(a)".
a - a String value
String valuepublic String paren(String a)
String that parenthesizes the parameter
for the Grapher. By default it is "(a)".
a - a String value
String valuepublic String quote(String value)
value - a String valuepublic String command(String line)
line - a String value
public String assign(String var,
String value)
String that assigns a value to a variable
for the Grapher.
var - a String valuevalue - a String value
String value
public abstract String def_func(String name,
String[] params,
String body)
String that defines a function
for the Grapher.
name - a String value, name of the functionparams - a String[] value, parameter names of the functionbody - a String value, the body of the function
String valuepublic String range(Range range)
String that gives a range
for the Grapher. By default it is "start:end".
range - a Range value
String value
public String func(String name,
String[] params)
String that calls a predefined function with given arguments
for the Grapher. By default it is "func(par1,par2,...)".
name - a String value, name of the functionparams - a String[] value, array of parameter values
String value
public PlotHandle display(Plot plot,
PrintStream out)
TODO: Should return the PlotHandle and call directly Grapher.plot(Plot)
plot - a Plot valueout - a PrintStream for displaying grapher
response. If null, System.out is used.
Plot.plot(Grapher)public abstract void setWindow(int windowNumber)
windowNumber - an int valuepublic String response()
String valuepublic void waitForResponse()
public void close()
public abstract void writeEPS(PlotHandle handle,
String filename)
handle - a PlotHandle valuefilename - a String value
public abstract void writeEPSbw(PlotHandle handle,
String filename)
TODO: make some export properties to handle these.
handle - a PlotHandle valuefilename - a String value
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||