svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / operation / GeometryOperationContext.java @ 21047
History | View | Annotate | Download (976 Bytes)
1 |
package org.gvsig.fmap.geom.operation; |
---|---|
2 |
|
3 |
import java.util.HashMap; |
4 |
import java.util.Map; |
5 |
|
6 |
/**
|
7 |
* This class is a default parameter container for geometry operation.<br>
|
8 |
*
|
9 |
* Normally every GeometryOperation will extend this class and identify
|
10 |
* its parameters publicly with getters/setters
|
11 |
*
|
12 |
* For those operations that need high performance, parameters should be declared as class
|
13 |
* members instead of using the setAttribute/getAttribute mechanism. This way you avoid a hash
|
14 |
* and a cast operation.
|
15 |
*
|
16 |
* @author jyarza
|
17 |
*
|
18 |
*/
|
19 |
public class GeometryOperationContext { |
20 |
|
21 |
private Map ctx = new HashMap(); |
22 |
|
23 |
/**
|
24 |
* Returns an attribute given its name.
|
25 |
* If it does not exist returns <code>null</code>
|
26 |
* @param name
|
27 |
* @return attribute
|
28 |
*/
|
29 |
public Object getAttribute(String name) { |
30 |
return ctx.get(name);
|
31 |
} |
32 |
|
33 |
/**
|
34 |
* Sets an attribute
|
35 |
* @param name
|
36 |
* @param value
|
37 |
*/
|
38 |
public void setAttribute(String name, Object value) { |
39 |
ctx.put(name, value); |
40 |
} |
41 |
|
42 |
} |