appl.parallel.spmd
Class MultiDataObject

java.lang.Object
  extended by appl.parallel.spmd.MultiDataObject
Direct Known Subclasses:
MultiDataPartitionObject

public class MultiDataObject
extends Object

A multi data object stores multiple elements of the same type. While the related MultiDataInfo stores only Information about multi-data and is used by Xulu / V for transfer of metadata, this class is a actual user object. The user can retrieve a multidata object e.g. via the SPMDServerController and work with it (e.g. add elements)

Author:
Dominik Appl
See Also:
SPMDServerInterface.getMultiData(String), MultiDataInfo

Constructor Summary
MultiDataObject(MultiDataInfo info, DataServer dataServer)
          Construct a new Multidata object
 
Method Summary
 int addElement()
          Adds an element to MultiDataObjects.
 int addElement(int id)
          Adds an element with the specified ID.
 void deleteElement(int idx)
          removes the element with the specified index from the dataServer
 int getCount()
           
 Object getElement(int idx)
           
 MultiDataInfo getMultiInfo()
           
 String getName()
           
 void setManagedGrid(MultiGrid toManageMultiGrid)
          Manages a multigrid, which means that when a new element is added to the multiObject, then the same element is also added to the managed multiGrid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiDataObject

public MultiDataObject(MultiDataInfo info,
                       DataServer dataServer)
Construct a new Multidata object

Parameters:
info - a MultiDataInfo object with the identification of the objects
dataServer - a dataServer which is responsible for the actual loading of the data
Method Detail

getElement

public Object getElement(int idx)
Parameters:
idx - the position of the element
Returns:
the element at the indicated position

getCount

public int getCount()
Returns:
the number of elements in the multidataobject

addElement

public int addElement()
Adds an element to MultiDataObjects. Method should be thread safe.

Returns:
the index of the new element

addElement

public int addElement(int id)
Adds an element with the specified ID.

Parameters:
id - the id of the element to add
Returns:
the index of the new element or 0 if an error occurred

setManagedGrid

public void setManagedGrid(MultiGrid toManageMultiGrid)
Manages a multigrid, which means that when a new element is added to the multiObject, then the same element is also added to the managed multiGrid.

Parameters:
toManageMultiGrid - the grid to be managed. Only one grid will be managed at a time.

getMultiInfo

public MultiDataInfo getMultiInfo()
Returns:
the encapsulted MultiDataInfo

getName

public String getName()

deleteElement

public void deleteElement(int idx)
removes the element with the specified index from the dataServer

Parameters:
idx - the element