/[xulu]/trunk/src/appl/parallel/spmd/MultiDataPartitionObject.java
ViewVC logotype

Annotation of /trunk/src/appl/parallel/spmd/MultiDataPartitionObject.java

Parent Directory Parent Directory | Revision Log Revision Log


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26