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

Contents of /trunk/src/appl/parallel/data/splittable/SplittableLLProxyGrid.java

Parent Directory Parent Directory | Revision Log Revision Log


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26