appl.parallel.data.xulugridfile
Class XuluWritableGridFile

java.lang.Object
  extended by appl.data.LateLoadingProxy
      extended by appl.data.WritableGridLLProxy
          extended by appl.parallel.data.xulugridfile.XuluWritableGridFile
All Implemented Interfaces:
DataProxy, DataPartition, SplittableGrid, SplittableResource, Serializable

public class XuluWritableGridFile
extends WritableGridLLProxy
implements SplittableGrid

An implementation of a WritableGrid based on a XuluGridFile.

Author:
Dominik Appl
See Also:
Serialized Form

Field Summary
 
Fields inherited from class appl.data.WritableGridLLProxy
metaData
 
Fields inherited from class appl.data.LateLoadingProxy
baseObject, dataLoader, intialDataLoader, loaded, LOG
 
Constructor Summary
XuluWritableGridFile(File gridfileName)
          Opens the GridFile at the given destination
XuluWritableGridFile(int newID, RasterMetaData metaData, String directory)
          Creates a new XuluWritableGridFile in the specified directory, with the given metadata.
XuluWritableGridFile(RasterMetaData metaData, String directory)
          Creates NEW a GridFile in the given directory with the given metadata-sample
XuluWritableGridFile(XuluGridFile xuluGridFile)
          creates a instance out of a XuluGridFile
 
Method Summary
 DataPartition getEmpty(int newID)
          Creates an empty Object with the given id.
 String getGridFileName()
           
 Object getGridSample(double... coord)
           
 byte getGridSampleAsByte(double... coord)
           
 double getGridSampleAsDouble(double... coord)
           
 float getGridSampleAsFloat(double... coord)
           
 int getGridSampleAsInt(double... coord)
           
 long getGridSampleAsLong(double... coord)
           
 short getGridSampleAsShort(double... coord)
           
 DataLoader getLocalLoader()
          Returns the loader which is responible for loading the data.
 DataPartition getPartition(Rectangle partitionBounds)
          Returns the partition specified by the given Rectangle.
 Rectangle getPartitionBounds()
          Returns the bounds of the partition as a rectangle.
 int getRootID()
          Should return a unique ID for this resource.
 int getSplitHeight()
           
 int getSplitWidth()
           
 void setGridSample(Object value, double... coord)
           
 void setPartition(DataPartition partition, Rectangle partitionBounds)
          Overwrites the data at the location specified by the Rectangle with the given partition-data.
 void setRasterSample(Object value, int... cell)
           
 void unloadData()
          unloading is not necessary (method does nothing
 
Methods inherited from class appl.data.WritableGridLLProxy
convertRasterToReal, convertRealToRaster, dispose, getCellHeight, getCellWidth, getCoordinateReferenceSystem, getHeight, getMinX, getMinY, getRasterSample, getRasterSampleAsByte, getRasterSampleAsDouble, getRasterSampleAsFloat, getRasterSampleAsInt, getRasterSampleAsLong, getRasterSampleAsShort, getRealHeight, getRealWidth, getSampleType, getWidth, getX, getY, isLateLoadable, tryLoadingGrid
 
Methods inherited from class appl.data.LateLoadingProxy
getProxiedObject, getUnloadFile, isLoaded, isUnloadingEnabled, loadData, setUnloadDir, setUnloading
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XuluWritableGridFile

public XuluWritableGridFile(File gridfileName)
Opens the GridFile at the given destination

Parameters:
gridfileName - the filename of the XuluGridfile

XuluWritableGridFile

public XuluWritableGridFile(RasterMetaData metaData,
                            String directory)
Creates NEW a GridFile in the given directory with the given metadata-sample

Parameters:
metaData - the metadata

XuluWritableGridFile

public XuluWritableGridFile(XuluGridFile xuluGridFile)
creates a instance out of a XuluGridFile


XuluWritableGridFile

public XuluWritableGridFile(int newID,
                            RasterMetaData metaData,
                            String directory)
Creates a new XuluWritableGridFile in the specified directory, with the given metadata. The ID given in this constuctor will be the RootID of this Grid (used e.g. for identification in remoteComputing)

Parameters:
newID - the to be set as the new RootID (permanent)
metaData - the metadata is used for creation of the bounds and the type of the new XuluGridFile
directory - the directory in which the file should be created
See Also:
SplittableResource.getRootID()
Method Detail

getLocalLoader

public DataLoader getLocalLoader()
Description copied from interface: SplittableResource
Returns the loader which is responible for loading the data. This loader should be independet from the current system. This means that, e.g. for a loader which loads a grid from filesystem, that all paths should be relative (and not absolute), so that a possibly remote resource can load the data from its local filesystem, if the data is stored in the same position relative to the home directory.

Specified by:
getLocalLoader in interface SplittableResource
Returns:
a loader for this resource.

getRootID

public int getRootID()
Description copied from interface: SplittableResource
Should return a unique ID for this resource. Standard implementation would be returning the hashcode of the object.

Specified by:
getRootID in interface DataPartition
Specified by:
getRootID in interface SplittableResource
Returns:
a ID which is unique for this client

getSplitHeight

public int getSplitHeight()
Specified by:
getSplitHeight in interface SplittableResource
Returns:
the splittable is splitted according to its splitHeight (example: the height of a raster)

getSplitWidth

public int getSplitWidth()
Specified by:
getSplitWidth in interface SplittableResource
Returns:
the splittable is splitted according to its splitWidth (example: the width of a raster or the length of an array)

getEmpty

public DataPartition getEmpty(int newID)
Description copied from interface: DataPartition
Creates an empty Object with the given id. (Used e.g. by Multi-Data-Objects)

Specified by:
getEmpty in interface DataPartition
Parameters:
newID - the id of the new Object
Returns:
an Empty element with the same dimension as this element.

getPartition

public DataPartition getPartition(Rectangle partitionBounds)
Description copied from interface: DataPartition
Returns the partition specified by the given Rectangle. Note, that partitioning by a rectangle does not mean, that the underlying datastructure has to be 2D, but only that the splitting has to be at max. 2D.

Specified by:
getPartition in interface DataPartition
Parameters:
partitionBounds - the bounds of the partition which are to be retrieved in global coordinates (the coordinates should be relative to the root-structure)

getPartitionBounds

public Rectangle getPartitionBounds()
Description copied from interface: DataPartition
Returns the bounds of the partition as a rectangle. The coordinates of the rectangle are global (which means relative to the root structure).

Specified by:
getPartitionBounds in interface DataPartition
Returns:
the bounds of the partition as a rectangle. The coordinates of the rectangle are global (which means relative to the root structure).

setPartition

public void setPartition(DataPartition partition,
                         Rectangle partitionBounds)
Description copied from interface: DataPartition
Overwrites the data at the location specified by the Rectangle with the given partition-data.

Specified by:
setPartition in interface DataPartition
Parameters:
partition - the new data
partitionBounds - the target location of the data (in coordinates of the root structure)

setGridSample

public void setGridSample(Object value,
                          double... coord)
Overrides:
setGridSample in class WritableGridLLProxy

setRasterSample

public void setRasterSample(Object value,
                            int... cell)
Overrides:
setRasterSample in class WritableGridLLProxy

getGridSample

public Object getGridSample(double... coord)
Overrides:
getGridSample in class WritableGridLLProxy

getGridSampleAsByte

public byte getGridSampleAsByte(double... coord)
Overrides:
getGridSampleAsByte in class WritableGridLLProxy

getGridSampleAsDouble

public double getGridSampleAsDouble(double... coord)
Overrides:
getGridSampleAsDouble in class WritableGridLLProxy

getGridSampleAsFloat

public float getGridSampleAsFloat(double... coord)
Overrides:
getGridSampleAsFloat in class WritableGridLLProxy

getGridSampleAsInt

public int getGridSampleAsInt(double... coord)
Overrides:
getGridSampleAsInt in class WritableGridLLProxy

getGridSampleAsLong

public long getGridSampleAsLong(double... coord)
Overrides:
getGridSampleAsLong in class WritableGridLLProxy

getGridSampleAsShort

public short getGridSampleAsShort(double... coord)
Overrides:
getGridSampleAsShort in class WritableGridLLProxy

unloadData

public void unloadData()
unloading is not necessary (method does nothing

Overrides:
unloadData in class LateLoadingProxy
See Also:
LateLoadingProxy.unloadData()

getGridFileName

public String getGridFileName()