public class Dataset
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
data
The array that backs the contents of the dataset.
|
protected int |
height
The height of a 2D dataset.
|
protected int |
width
The width of a 2D dataset.
|
| Constructor and Description |
|---|
Dataset()
Create a new uninitialized Dataset.
|
Dataset(Dataset orig)
Create a new Dataset from an original.
|
Dataset(double[] data)
Create a new 1D Dataset of width data.length and height 1.
|
Dataset(double[] data,
int width,
int height)
Create a new 2D Dataset from an input array.
|
Dataset(int width,
int height)
Create a new initialized but empty Dataset
|
| Modifier and Type | Method and Description |
|---|---|
double |
get(int x,
int y)
Retrieves the value of the data at a given point.
|
double[] |
getData()
Retrieve the underlying array
|
int |
getHeight()
Retrieves the current height of this Dataset.
|
int |
getSize()
Returns the current size of this Dataset.
|
int |
getWidth()
Retrieves the current width of this Dataset.
|
void |
prettyPrint()
Convenience method for printing this Dataset to standard output
|
void |
prettyPrint(java.io.PrintStream out)
Convenience method for printing this Dataset to a PrintStream
|
void |
set(int x,
int y,
double value)
Sets the value of a point.
|
void |
setData(Dataset dataSet)
Sets this Dataset's data to a copy of the specified's data.
|
void |
setData(double[] data,
int width,
int height)
Sets this Dataset's data to a copy of the specified data.
|
void |
write(java.io.File outputFile)
Writes this Dataset to a space-delimited text file.
|
void |
write(java.lang.String outputFileName)
Writes this Dataset to a space-delimited text file.
|
protected int width
protected int height
protected double[] data
public Dataset(int width,
int height)
width - width of the dataheight - height of the datapublic Dataset(double[] data)
data - array to copypublic Dataset(double[] data,
int width,
int height)
data - array to copywidth - width of dataheight - height of datapublic Dataset()
public Dataset(Dataset orig)
orig - original to copypublic double[] getData()
public void setData(Dataset dataSet)
dataSet - dataset to copypublic void setData(double[] data,
int width,
int height)
data - array to copywidth - new width of the Datasetheight - new height of the Datasetpublic double get(int x,
int y)
x - X-coordinate of the pointy - Y-coordinate of the pointpublic void set(int x,
int y,
double value)
x - X-coordinate of the pointy - Y-coordinate of the pointvalue - new value for the point (x, y)public int getWidth()
public int getHeight()
public int getSize()
public void prettyPrint(java.io.PrintStream out)
out - streampublic void prettyPrint()
public void write(java.io.File outputFile)
throws java.io.IOException
outputFile - name of the output filejava.io.IOException - if an I/O error occurspublic void write(java.lang.String outputFileName)
throws java.io.IOException
outputFileName - filename of the output filejava.io.IOException - if an error occurs