/[xulu]/branches/1.8-gt2-2.6/src/appl/parallel/spmd/MultiDataPartitionObject.java
ViewVC logotype

Contents of /branches/1.8-gt2-2.6/src/appl/parallel/spmd/MultiDataPartitionObject.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 60 - (show annotations)
Sun Oct 4 16:54:52 2009 UTC (15 years, 2 months ago) by alfonx
File size: 1734 byte(s)
* organized imports
1 package appl.parallel.spmd;
2
3 import java.rmi.RemoteException;
4 import java.util.Vector;
5
6 import appl.parallel.server.PartitionDataServer;
7 import appl.parallel.spmd.split.DataPartition;
8 import appl.parallel.spmd.split.PartitionInfo;
9 import appl.parallel.spmd.split.SinglePartitionInfo;
10
11 /**
12 * A extension of the {@link MultiDataObject} for storing {@link DataPartition DataPartitions}.
13 *
14 * @author Dominik Appl
15 */
16 public class MultiDataPartitionObject extends MultiDataObject {
17
18 private final PartitionDataServer partitionDataServer;
19 private final MultiDataInfo info;
20
21 public MultiDataPartitionObject(MultiDataInfo info, PartitionDataServer dataServer) {
22 super(info, dataServer);
23 this.info = info;
24 partitionDataServer = dataServer;
25 }
26
27 /**
28 * Adds an element to the PartitionObject as {@link MultiDataObject} does. Also
29 * adds the needed {@link PartitionInfo} Object for the new Element
30 * to the {@link PartitionDataServer}.
31 *
32 * @return the index of the last element
33 */
34 @Override
35 public int addElement() {
36 int lastIdx = super.addElement();
37 int newID = this.getMultiInfo().getMultiID(lastIdx);
38 //get PartitionInfo of the first grid and duplicate it
39 try {
40 SinglePartitionInfo partitionInfo = (SinglePartitionInfo) partitionDataServer.getPartitionInfo(info.getMultiID(0)).clone(newID);
41 //add the new PartitionInfo to the server
42 Vector<SinglePartitionInfo> partitionVector = new Vector<SinglePartitionInfo>();
43 partitionVector.add(partitionInfo);
44 partitionDataServer.addPartitionInfos(partitionVector);
45 } catch (RemoteException e) {
46 // TODO Auto-generated catch block
47 e.printStackTrace();
48 }
49
50 return lastIdx;
51 }
52
53
54 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26