KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > group > Group


1 /*
2  * ################################################################
3  *
4  * ProActive: The Java(TM) library for Parallel, Distributed,
5  * Concurrent computing with Security and Mobility
6  *
7  * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8  * Contact: proactive-support@inria.fr
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  *
25  * Initial developer(s): The ProActive Team
26  * http://www.inria.fr/oasis/ProActive/contacts.html
27  * Contributor(s):
28  *
29  * ################################################################
30  */

31 package org.objectweb.proactive.core.group;
32
33 import java.util.ListIterator JavaDoc;
34
35
36 /**
37  * This interface presents the group abilities extending java.util.Collection.
38  *
39  * @see java.util.Collection
40  *
41  * @author Laurent Baduel
42  *
43  */

44 public interface Group extends java.util.Collection JavaDoc {
45
46     /**
47      * Returns the (upper) class of member.
48      */

49     public Class JavaDoc getType() throws java.lang.ClassNotFoundException JavaDoc;
50
51     /**
52      * Returns the name of the (upper) class of member.
53      */

54     public String JavaDoc getTypeName();
55
56     /**
57      * Returns an object representing the group, and assignable from the (upper) class of member.
58      */

59     public Object JavaDoc getGroupByType();
60
61     /**
62      * Returns the object at the specified index.
63      */

64     public Object JavaDoc get(int index);
65
66     /**
67      * Merges a group into the group.
68      */

69     public void addMerge(Object JavaDoc ogroup);
70
71     /**
72      * Removes the object at the specified index.
73      */

74     public void remove(int index);
75
76     /**
77      * Returns the index in the group of the first occurence of the specified element, -1 if the list does not contain this element.
78      */

79     public int indexOf(Object JavaDoc obj);
80
81     /**
82      * Returns a list iterator of the members in this Group (in proper sequence).
83      */

84     public ListIterator JavaDoc listIterator();
85
86     /**
87      * Waits that all the members are arrived.
88      */

89     public void waitAll();
90
91     /**
92      * Waits that at least one member is arrived.
93      */

94     public void waitOne();
95
96     /**
97      * Waits that the member at the specified rank is arrived.
98      * @param <code>index</code> the rank of the awaited member.
99      */

100     public void waitTheNth(int n);
101
102     /**
103      * Waits that at least <code>n</code> members are arrived.
104      * @param <code>n</code> the number of awaited members.
105      */

106     public void waitN(int n);
107
108     /**
109      * Waits that at least one member is arrived and returns it.
110      * @return a non-awaited member of the Group.
111      */

112     public Object JavaDoc waitAndGetOne();
113
114     /**
115      * Waits that the member at the specified rank is arrived and returns it.
116      * @param <code>n</code> the rank of the wanted member.
117      * @return the member (non-awaited) at the rank <code>n</code> in the Group.
118      */

119     public Object JavaDoc waitAndGetTheNth(int n);
120
121     /**
122      * Waits that at least one member is arrived and returns its index.
123      * @return the index of a non-awaited member of the Group.
124      */

125     public int waitOneAndGetIndex();
126
127     /**
128      * Checks if all the members of the Group are awaited.
129      * @return <code>true</code> if all the members of the Group are awaited.
130      */

131     public boolean allAwaited();
132
133     /**
134      * Checks if all the members of the Group are arrived.
135      * @return <code>true</code> if all the members of the Group are arrived.
136      */

137     public boolean allArrived();
138
139     /**
140      * Returns an ExceptionList containing all the throwables (exceptions and errors) occured
141      * when this group was built
142      * @return an ExceptionList
143      */

144     public ExceptionList getExceptionList();
145
146     /**
147      * Removes all exceptions and null references contained in the Group.
148      * Exceptions (and null references) appears with communication/program-level/runtime errors
149      * and are stored in the Group.
150      * (After this operation the size of the Group decreases)
151      */

152     public void purgeExceptionAndNull();
153
154     /**
155      * Modifies the number of members served by one thread
156      * @param i - the new ratio
157      */

158     public void setRatioNemberToThread(int i);
159
160     /**
161      * Creates a new group with all members of the group and all the members of the group <code>g</code>
162      * @param g - a group
163      * @return a group that contain all the members of the group and <code>g</code>. <code>null<code> if the class of the group is incompatible.
164      */

165     public Group union(Group g);
166
167     /**
168      * Creates a new group with all members that belong to the group and to the group <code>g</code>.
169      * @param g - a group
170      * @return a group that contain the common members of the group and <code>g</code>. <code>null<code> if the class of the group is incompatible.
171      */

172     public Group intersection(Group g);
173
174     /**
175      * Creates a new group with all members that belong to the group or to the group <code>g</code>, but not to both.
176      * @param g - a group
177      * @return a group that contain the non-common members of the group and <code>g</code>. <code>null<code> if the class of the group is incompatible.
178      */

179     public Group difference(Group g);
180
181     /**
182      * Creates a new group with the members that belong to the group, but not to the group <code>g</code>.
183      * @param g - a group
184      * @return a group that contain the members of the group without the member <code>g</code>. <code>null<code> if the class of the group is incompatible.
185      */

186     public Group exclude(Group g);
187
188     /**
189      * Creates a new group with the members of the group begining at the index <code>begin</code> and ending at the index <code>end</code>.
190      * @param begin - the begining index
191      * @param end - the ending index
192      * @return a group that contain the members of the group from <code>begin</code> to <code>end</code>. <code>null</code> if <code>begin > end</code>.
193      */

194     public Group range(int begin, int end);
195     
196     /**
197      * Strongly synchronizes all the members of the group
198      */

199     public void barrier ();
200 }
201
Popular Tags