|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.unidu.is.gnuplot.Source
de.unidu.is.gnuplot.FileSource
de.unidu.is.gnuplot.DataSource
An abstract class describing a single plot curve which is defined by data points (instead of a function).
For using this class, the name of the data output file has to be specified.
For constructing the data file inside of getCommand(), the
program iterates through (x,y) data pairs with next() together
with getX() and getY():
while(next()) {
double x = getX(); // current x
double y = getY(); // current y
doSomething(x,y);
}
Thus, one instance can only be used once for iterating.This class has to be subclassed for specific application areas.
| Field Summary |
| Fields inherited from class de.unidu.is.gnuplot.FileSource |
filename, nosmooth |
| Fields inherited from class de.unidu.is.gnuplot.Source |
max, min, title |
| Constructor Summary | |
DataSource(java.lang.String title,
java.lang.String filename)
Creates a new instance. |
|
| Method Summary | |
java.lang.String |
getCommand()
Creates the datafile and returns a gnuplot expression defining the data file for the gnuplot plot command (with
smooth unique is set). |
abstract double |
getX()
Returns the x value of the current (x,y) data pair. |
abstract double |
getY()
Returns the y value of the current (x,y) data pair. |
abstract boolean |
next()
Switches to the next possible (x,y) data pair if possible. |
void |
write()
Writes the data in the file. |
void |
write(java.io.Writer writer)
Writes the data in the witer. |
| Methods inherited from class de.unidu.is.gnuplot.FileSource |
getFilename, isSmooth, setFilename, setSmooth |
| Methods inherited from class de.unidu.is.gnuplot.Source |
getMax, getMin, getTitle, setMax, setMin |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DataSource(java.lang.String title,
java.lang.String filename)
filename - name of the corresponding file with data points| Method Detail |
public void write(java.io.Writer writer)
writer - writer to which the file is written topublic void write()
public java.lang.String getCommand()
plot command (with
smooth unique is set).
getCommand in class FileSourcepublic abstract boolean next()
This method has to be overridden in subclasses.
public abstract double getX()
This method has to be overridden in subclasses.
public abstract double getY()
This method has to be overridden in subclasses.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||