/[xulu]/trunk.bakup/src/appl/parallel/data/splittable/SplittableLLProxyGrid.java
ViewVC logotype

Annotation of /trunk.bakup/src/appl/parallel/data/splittable/SplittableLLProxyGrid.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
Original Path: trunk/src/appl/parallel/data/splittable/SplittableLLProxyGrid.java
File size: 3493 byte(s)
First Commit, corresponds to Revision 1008 of Wikisquare-SVN 
1 mojays 2 package appl.parallel.data.splittable;
2    
3     import java.awt.Rectangle;
4     import java.io.Serializable;
5    
6     import schmitzm.data.WritableGrid;
7     import appl.data.DataLoader;
8     import appl.data.WritableGridLLProxy;
9     import appl.parallel.spmd.split.DataPartition;
10     import appl.parallel.spmd.split.SplittableGrid;
11     import appl.parallel.spmd.split.SplittableResource;
12     import appl.parallel.spmd.split.WritableGridPartition;
13     import appl.parallel.util.PartitionUtil;
14     import appl.util.RasterMetaData;
15     import edu.bonn.xulu.appl.XuluRegistry;
16     import edu.bonn.xulu.io.ImportFactory;
17     import edu.bonn.xulu.plugin.io.grid.WritableGridFactory;
18    
19     /**
20     * @version 1.0
21     */
22     public class SplittableLLProxyGrid extends WritableGridLLProxy implements
23     SplittableGrid, Serializable {
24    
25     private final int id;
26    
27     public SplittableLLProxyGrid(ImportFactory importFac,
28     RasterMetaData metaData, Object inputPara, XuluRegistry reg) {
29     super(importFac, metaData, inputPara, reg);
30     id = this.hashCode();
31     }
32    
33     public SplittableLLProxyGrid(WritableGridFactory targetFactory,
34     RasterMetaData metaData) {
35     super(targetFactory, metaData);
36     id = this.hashCode();
37     }
38    
39     public SplittableLLProxyGrid(RasterMetaData metaData, int id) {
40     super(metaData);
41     this.id = id;
42     }
43    
44     /*
45     * (non-Javadoc)
46     *
47     * @see appl.parallel.spmd.split.SplittableResource#getFileSystemLoader()
48     */
49     public DataLoader getLocalLoader() {
50     return this.intialDataLoader;
51     }
52    
53     /*
54     * (non-Javadoc)
55     *
56     * @see appl.parallel.spmd.split.SplittableResource#getID()
57     */
58     public int getRootID() {
59     return this.id;
60     }
61    
62     /*
63     * (non-Javadoc)
64     *
65     * @see appl.parallel.spmd.split.SplittableResource#getPartition(java.awt.Rectangle)
66     */
67     public WritableGridPartition getPartition(Rectangle partitionBounds) {
68     if (!loaded)
69     tryLoadingGrid();
70     return PartitionUtil.getPartitialGrid2D(this, partitionBounds,
71     getRootID());
72     }
73    
74     /**
75     * Overwrites the data at the location specified by the {@link Rectangle}
76     * with the given partition-data.
77     *
78     * @param partition
79     * the grid to be inserted which MUST be an instance of
80     * {@link WritableGrid}!
81     * @param partitionBounds
82     * the target location of the data
83     * @see appl.parallel.spmd.split.DataPartition#setPartition(DataPartition,
84     * java.awt.Rectangle)
85     */
86     public void setPartition(DataPartition partition, Rectangle partitionBounds) {
87     if (!loaded)
88     tryLoadingGrid();
89     if (!(partition instanceof WritableGrid))
90     throw new UnsupportedOperationException(
91     "The partition must be an instance of WritableGrid!");
92     PartitionUtil.setPartition(this, (WritableGrid) partition,
93     partitionBounds);
94     }
95    
96     /*
97     * (non-Javadoc)
98     *
99     * @see appl.parallel.spmd.split.SplittableResource#getSplitHeight()
100     */
101     public int getSplitHeight() {
102     return this.getHeight();
103     }
104    
105     /*
106     * (non-Javadoc)
107     *
108     * @see appl.parallel.spmd.split.SplittableResource#getSplitWidth()
109     */
110     public int getSplitWidth() {
111     return this.getWidth();
112     }
113    
114     /*
115     * (non-Javadoc)
116     *
117     * @see appl.parallel.spmd.split.DataPartition#getPartitionBounds()
118     */
119     public Rectangle getPartitionBounds() {
120     return new Rectangle(0, 0, this.getWidth(), this.getHeight());
121     }
122    
123     /*
124     * (non-Javadoc)
125     *
126     * @see appl.parallel.spmd.split.DataPartition#getEmpty()
127     */
128     public DataPartition getEmpty(int id) {
129     return new SplittableLLProxyGrid(this.metaData, id);
130     }
131    
132     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26