org.objectweb.proactive.core.group
Interface Group

All Superinterfaces:
java.util.Collection
All Known Implementing Classes:
ProxyForGroup

public interface Group
extends java.util.Collection

This interface presents the group abilities extending java.util.Collection. A Group also permit some 'Map' operations like put, get(key), ...

Author:
Laurent Baduel
See Also:
Collection

Method Summary
 void addMerge(java.lang.Object ogroup)
          Merges a group into the group.
 void addNamedElement(java.lang.String key, java.lang.Object value)
          Associates the specified value with the specified key in this Group (optional operation).
 boolean allArrived()
          Checks if all the members of the Group are arrived.
 boolean allAwaited()
          Checks if all the members of the Group are awaited.
 boolean containsKey(java.lang.String key)
          Returns true if this Group contains a mapping for the specified key.
 boolean containsValue(java.lang.Object value)
          Returns true if this Group maps one or more keys to the specified value.
 Group difference(Group g)
          Creates a new group with all members that belong to the group or to the group g, but not to both.
 Group exclude(Group g)
          Creates a new group with the members that belong to the group, but not to the group g.
 java.lang.Object get(int index)
          Returns the object at the specified index.
 ExceptionList getExceptionList()
          Returns an ExceptionList containing all the throwables (exceptions and errors) occured when this group was built
 java.lang.Object getGroupByType()
          Returns an object representing the group, and assignable from the (upper) class of member.
 java.lang.Object getNamedElement(java.lang.String key)
          Returns the Object to which this Group maps the specified key.
 java.lang.Class getType()
          Returns the (upper) class of member.
 java.lang.String getTypeName()
          Returns the name of the (upper) class of member.
 int indexOf(java.lang.Object obj)
          Returns the index in the group of the first occurence of the specified element, -1 if the list does not contain this element.
 Group intersection(Group g)
          Creates a new group with all members that belong to the group and to the group g.
 java.util.Set keySet()
          Returns a set view of the keys contained in this Group.
 java.util.ListIterator listIterator()
          Returns a list iterator of the members in this Group (in proper sequence).
 void purgeExceptionAndNull()
          Removes all exceptions and null references contained in the Group.
 Group range(int begin, int end)
          Creates a new group with the members of the group begining at the index begin and ending at the index end.
 java.lang.Object remove(int index)
          Removes the object at the specified index.
 java.lang.Object removeNamedElement(java.lang.String key)
          Removes the mapping for this key from the group if it is present.
 void setRatioNemberToThread(int i)
          Modifies the number of members served by one thread
 Group union(Group g)
          Creates a new group with all members of the group and all the members of the group g
 void waitAll()
          Waits that all the members are arrived.
 java.lang.Object waitAndGetOne()
          Waits that at least one member is arrived and returns it.
 java.lang.Object waitAndGetOneThenRemoveIt()
          Waits one future is arrived and returns it (removes it from the group).
 java.lang.Object waitAndGetTheNth(int n)
          Waits that the member at the specified rank is arrived and returns it.
 void waitN(int n)
          Waits that at least n members are arrived.
 void waitOne()
          Waits that at least one member is arrived.
 int waitOneAndGetIndex()
          Waits that at least one member is arrived and returns its index.
 void waitTheNth(int n)
          Waits that the member at the specified rank is arrived.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

getType

public java.lang.Class getType()
                        throws java.lang.ClassNotFoundException
Returns the (upper) class of member.

Throws:
java.lang.ClassNotFoundException

getTypeName

public java.lang.String getTypeName()
Returns the name of the (upper) class of member.


getGroupByType

public java.lang.Object getGroupByType()
Returns an object representing the group, and assignable from the (upper) class of member.


get

public java.lang.Object get(int index)
Returns the object at the specified index.


addMerge

public void addMerge(java.lang.Object ogroup)
Merges a group into the group.


remove

public java.lang.Object remove(int index)
Removes the object at the specified index.

Returns:
the object that has been removed

indexOf

public int indexOf(java.lang.Object obj)
Returns the index in the group of the first occurence of the specified element, -1 if the list does not contain this element.


listIterator

public java.util.ListIterator listIterator()
Returns a list iterator of the members in this Group (in proper sequence).


waitAll

public void waitAll()
Waits that all the members are arrived.


waitOne

public void waitOne()
Waits that at least one member is arrived.


waitTheNth

public void waitTheNth(int n)
Waits that the member at the specified rank is arrived.

Parameters:
n - the rank of the awaited member.

waitN

public void waitN(int n)
Waits that at least n members are arrived.

Parameters:
n - the number of awaited members.

waitAndGetOne

public java.lang.Object waitAndGetOne()
Waits that at least one member is arrived and returns it.

Returns:
a non-awaited member of the Group.

waitAndGetOneThenRemoveIt

public java.lang.Object waitAndGetOneThenRemoveIt()
Waits one future is arrived and returns it (removes it from the group).

Returns:
a member of o. (o is removed from the group)

waitAndGetTheNth

public java.lang.Object waitAndGetTheNth(int n)
Waits that the member at the specified rank is arrived and returns it.

Parameters:
n - - the rank of the wanted member.
Returns:
the member (non-awaited) at the rank n in the Group.

waitOneAndGetIndex

public int waitOneAndGetIndex()
Waits that at least one member is arrived and returns its index.

Returns:
the index of a non-awaited member of the Group.

allAwaited

public boolean allAwaited()
Checks if all the members of the Group are awaited.

Returns:
true if all the members of the Group are awaited.

allArrived

public boolean allArrived()
Checks if all the members of the Group are arrived.

Returns:
true if all the members of the Group are arrived.

getExceptionList

public ExceptionList getExceptionList()
Returns an ExceptionList containing all the throwables (exceptions and errors) occured when this group was built

Returns:
an ExceptionList

purgeExceptionAndNull

public void purgeExceptionAndNull()
Removes all exceptions and null references contained in the Group. Exceptions (and null references) appears with communication/program-level/runtime errors and are stored in the Group. (After this operation the size of the Group decreases)


setRatioNemberToThread

public void setRatioNemberToThread(int i)
Modifies the number of members served by one thread

Parameters:
i - - the new ratio

union

public Group union(Group g)
Creates a new group with all members of the group and all the members of the group g

Parameters:
g - - a group
Returns:
a group that contain all the members of the group and g. null if the class of the group is incompatible.

intersection

public Group intersection(Group g)
Creates a new group with all members that belong to the group and to the group g.

Parameters:
g - - a group
Returns:
a group that contain the common members of the group and g. null if the class of the group is incompatible.

difference

public Group difference(Group g)
Creates a new group with all members that belong to the group or to the group g, but not to both.

Parameters:
g - - a group
Returns:
a group that contain the non-common members of the group and g. null if the class of the group is incompatible.

exclude

public Group exclude(Group g)
Creates a new group with the members that belong to the group, but not to the group g.

Parameters:
g - - a group
Returns:
a group that contain the members of the group without the member g. null if the class of the group is incompatible.

range

public Group range(int begin,
                   int end)
Creates a new group with the members of the group begining at the index begin and ending at the index end.

Parameters:
begin - - the begining index
end - - the ending index
Returns:
a group that contain the members of the group from begin to end. null if begin > end.

containsKey

public boolean containsKey(java.lang.String key)
Returns true if this Group contains a mapping for the specified key. More formally, returns true if and only if this Group contains at a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)

Parameters:
key - - key whose presence in this Group is to be tested.
Returns:
true if this Group contains a mapping for the specified key.
Throws:
java.lang.ClassCastException - - if the key is of an inappropriate type for this Group (optional).
java.lang.NullPointerException - - if the key is null and this Group does not not permit null keys (optional).

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if this Group maps one or more keys to the specified value. More formally, returns true if and only if this Group contains at least one mapping to a value v such that (value==null ? v==null : value.equals(v)).

Parameters:
value - - value whose presence in this map is to be tested.
Returns:
true if this Group maps one or more keys to the specified value.
Throws:
java.lang.ClassCastException - - if the value is of an inappropriate type for this Collection (optional).
java.lang.NullPointerException - - if the value is null and this Group does not not permit null values (optional).

getNamedElement

public java.lang.Object getNamedElement(java.lang.String key)
Returns the Object to which this Group maps the specified key. Returns null if the Collection contains no mapping for this key. A return value of null does not necessarily indicate that the Collection contains no mapping for the key; it's also possible that the Group explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases. More formally, if this Group contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

Parameters:
key - - key whose associated value is to be returned.
Returns:
the value to which this map maps the specified key, or null if the map contains no mapping for this key.
Throws:
java.lang.ClassCastException - - if the key is of an inappropriate type for this Group (optional).
java.lang.NullPointerException - - key is null and this Group does not not permit null keys (optional).

removeNamedElement

public java.lang.Object removeNamedElement(java.lang.String key)
Removes the mapping for this key from the group if it is present. More formally, if this group contains a mapping from key k to value v such that (key==null ? k==null : key.equals(k)), that mapping is removed. (The map can contain at most one such mapping.) Returns the value to which the group previously associated the key, or null if the group contained no mapping for this key. The group will not contain a mapping for the specified key once the call returns.

Parameters:
key - the name of the element
Returns:
the named element

addNamedElement

public void addNamedElement(java.lang.String key,
                            java.lang.Object value)
Associates the specified value with the specified key in this Group (optional operation). If the Group previously contained a mapping for this key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)) In that case, the old value is also removed from the group.

Parameters:
key - - key with which the specified value is to be associated.
value - - value to be associated with the specified key.
Throws:
java.lang.UnsupportedOperationException - - if the put operation is not supported by this Group.
java.lang.ClassCastException - - if the class of the specified key or value prevents it from being stored in this Group.
java.lang.IllegalArgumentException - - if some aspect of this key or value prevents it from being stored in this Group.
java.lang.NullPointerException - - this map does not permit null keys or values, and the specified key or value is null.

keySet

public java.util.Set keySet()
Returns a set view of the keys contained in this Group. The set is backed by the Group, so changes to the Group are reflected in the set, and vice-versa. If the Group is modified while an iteration over the set is in progress, the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the Group, via the Iterator.remove, Set.remove, removeAll retainAll, and clear operations. It does not support the add or addAll operations.

Returns:
a set view of the keys contained in this Group.


Copyright ? October 2004 INRIA All Rights Reserved.