appl.parallel.spmd
Class MultiDataInfo

java.lang.Object
  extended by appl.parallel.spmd.MultiDataInfo
All Implemented Interfaces:
Serializable

public class MultiDataInfo
extends Object
implements Serializable

Instances of this class encapsulate information about multiple objects of the same type, e.g. lists of grids. In contrast to the MultiDataObject there are no objects stored, but only the IDs of the objects. That simplifies the the synchronization of multidata information over a network.

Author:
Dominik Appl
See Also:
Serialized Form

Field Summary
static String MULTISPLITCONSTANT
          This constant is used as a divider for adding multiple data associated with the same name.
 
Constructor Summary
MultiDataInfo(int[] ids, String name)
           
 
Method Summary
 String addElement(int id)
          Adds a new Element with the specified id.
 int getCount()
           
static int getIndexFromNameWithIdx(String identificationName)
          Extracts the the the index out of a identification
 int getMultiID(int idx)
           
 String getName()
           
static String getNameWithIdx(int idx, String name)
          Generates a identification String based only on the given name and the given idx.
 int getNewIDForIndex(int idx)
          Generates a new id for a given index, based on the id of the first element in the multidata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MULTISPLITCONSTANT

public static final String MULTISPLITCONSTANT
This constant is used as a divider for adding multiple data associated with the same name. The dividing should be as follows: name + MULTISPLITCONSTANT + index

See Also:
Constant Field Values
Constructor Detail

MultiDataInfo

public MultiDataInfo(int[] ids,
                     String name)
Method Detail

addElement

public String addElement(int id)
Adds a new Element with the specified id.

Parameters:
id - The ID of the new element.
Returns:
the name of the new Element

getMultiID

public int getMultiID(int idx)

getNameWithIdx

public static String getNameWithIdx(int idx,
                                    String name)
Generates a identification String based only on the given name and the given idx. It can be used for identification of the same data over multiple resources

Parameters:
idx - the index of the element in the multidata
name - the name of the element
Returns:
the identification string
See Also:
getIndexFromNameWithIdx(String)

getIndexFromNameWithIdx

public static int getIndexFromNameWithIdx(String identificationName)
Extracts the the the index out of a identification

Parameters:
identificationName - the identification
Returns:
the index
See Also:
getNameWithIdx(int, String)

getNewIDForIndex

public int getNewIDForIndex(int idx)
Generates a new id for a given index, based on the id of the first element in the multidata.

Parameters:
idx - the index for which a new id should be generated
Returns:
the new id

getCount

public int getCount()
Returns:
the number of elements currently in the multi-info

getName

public String getName()
Returns:
the name associated with this multi-id