jabble
Class DataStructuresFactory

java.lang.Object
  extended by jabble.DataStructuresFactory

public abstract class DataStructuresFactory
extends java.lang.Object

Factory for the data structure classes, such as Point, Grid and Field.


Constructor Summary
DataStructuresFactory()
           
 
Method Summary
abstract  Field createField(Field field)
          Creates a new field that is the copy of the given Field.
abstract  Field createField(java.lang.String name, double[] data, Grid grid)
          Creates a new field with the given name, data and Grid.
abstract  Field createField(java.lang.String name, Grid grid)
          Creates a new field with a value of zero at each point of the Grid.
abstract  Grid createGrid(Grid grid)
          Creates a new Grid object with the same dimension and sizes of the given Grid.
abstract  Grid createGrid(int... sizes)
          Creates a Grid of the specified size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataStructuresFactory

public DataStructuresFactory()
Method Detail

createField

public abstract Field createField(java.lang.String name,
                                  Grid grid)
Creates a new field with a value of zero at each point of the Grid.

Parameters:
name - The name of the field (will be used to identify it in the Slice object)
grid - The Grid on which the field is defined.

createField

public abstract Field createField(Field field)
Creates a new field that is the copy of the given Field. That is, the new field will have the same name, will be defined on the same Grid and the data will be initialized to the data of the argument Field data.

Parameters:
field - The template field from which to create the new one

createField

public abstract Field createField(java.lang.String name,
                                  double[] data,
                                  Grid grid)
Creates a new field with the given name, data and Grid. The data array will be used directly by the new field, without a copy. So any modification on the data array will mean changing values in the Field.

Parameters:
name - the name to give to the field
data - array containing all the values of the field across the grid
grid - the grid on which the field is defined

createGrid

public abstract Grid createGrid(int... sizes)
Creates a Grid of the specified size.

Parameters:
sizes - The number of points in each direction.

createGrid

public abstract Grid createGrid(Grid grid)
Creates a new Grid object with the same dimension and sizes of the given Grid.

Parameters:
grid - The grid to use as a prototype