maltcms.datastructures.array
Class ArrayFactory

java.lang.Object
  extended by maltcms.datastructures.array.ArrayFactory

public class ArrayFactory
extends Object

A factory abstraction for creation of IArrayD2Double implementations.

Author:
Nils.Hoffmann@cebitec.uni-bielefeld.de

Constructor Summary
ArrayFactory()
           
 
Method Summary
 IArrayD2Double create(Array a)
          Wraps an Array within a DenseArray.
 IArrayD2Double create(int rows, int cols, AnchorPairSet aps, int neighborhood, double band, double default_value, boolean globalBand)
          Creates a PartitionedArray if number of passed in anchors is greater than 2.
 IArrayD2Double create(int rows, int cols, double default_value)
          Creates a DenseArray with given number of rows, columns and default_value as initial value of elements.
 IArrayD2Double create(int rows, int cols, double default_value, Area bounds)
          Create an optimized array storing only those elements contained within the area bounds.
 IArrayD2Double createCopiedLayout(IArrayD2Double ia)
          Creates a copied layout.
 BufferedImage createLayoutImage(IArrayD2Double ia)
           
 IArrayD2Double createSharedLayout(IArrayD2Double ia)
          Creating a shared layout is recommended, if you want to use a layout for multiple arrays.
 IArrayD2Double createSparseArray(int rows, int columns)
          Create a two-dimensional array, which is backed by some sparse implementation (rcs or hashing).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayFactory

public ArrayFactory()
Method Detail

create

public IArrayD2Double create(Array a)
Wraps an Array within a DenseArray. Data of a is copied.

Parameters:
a -
Returns:

create

public IArrayD2Double create(int rows,
                             int cols,
                             AnchorPairSet aps,
                             int neighborhood,
                             double band,
                             double default_value,
                             boolean globalBand)
Creates a PartitionedArray if number of passed in anchors is greater than 2. If a band constraint > 0 is also given, the resulting layout will be the intersection of both constraints' shapes. If no anchor pair set is given, but a band constraint has been set >0, than this will return a PartitionedArray with the corresponding band constraint. Otherwise, a DenseArray is returned.

Parameters:
rows -
cols -
aps -
neighborhood -
band -
default_value -
globalBand -
Returns:

create

public IArrayD2Double create(int rows,
                             int cols,
                             double default_value)
Creates a DenseArray with given number of rows, columns and default_value as initial value of elements.

Parameters:
rows -
cols -
default_value -
Returns:

create

public IArrayD2Double create(int rows,
                             int cols,
                             double default_value,
                             Area bounds)
Create an optimized array storing only those elements contained within the area bounds.

Parameters:
rows -
cols -
default_value -
bounds -
Returns:

createCopiedLayout

public IArrayD2Double createCopiedLayout(IArrayD2Double ia)
Creates a copied layout. Underlying column start, length and offset arrays are copied. Default value, number of virtual rows and number of virtual columns are copied.

Parameters:
ia - the array used as blueprint for layout
Returns:

createLayoutImage

public BufferedImage createLayoutImage(IArrayD2Double ia)

createSharedLayout

public IArrayD2Double createSharedLayout(IArrayD2Double ia)
Creating a shared layout is recommended, if you want to use a layout for multiple arrays. Underlying column start, length and offset arrays are shared by reference. Default value, number of virtual rows and number of virtual columns are copied.

Parameters:
ia - the array used as blueprint for layout
Returns:
either a PartitionedArray if ia is a PartitionedArray, otherwise a DenseArray

createSparseArray

public IArrayD2Double createSparseArray(int rows,
                                        int columns)
Create a two-dimensional array, which is backed by some sparse implementation (rcs or hashing). Virtual layout size is given by rows and columns. Default value is fixed to 0.

Parameters:
rows -
columns -
Returns:


Copyright © 2007-2012. All Rights Reserved.