01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2002, Refractions Reserach Inc.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.graph.io.standard;
18:
19: import java.util.HashMap;
20:
21: import org.geotools.graph.io.GraphReaderWriter;
22:
23: /**
24: * An abstract implementation of the GraphReaderWriter interface.
25: *
26: * @author Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
27: *
28: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/graph/src/main/java/org/geotools/graph/io/standard/AbstractReaderWriter.java $
29: */
30: public abstract class AbstractReaderWriter implements GraphReaderWriter {
31: private HashMap m_properties;
32:
33: /** GraphGenerator property key **/
34: public static final String GENERATOR = "GENERATOR";
35:
36: /** GraphBuilder property key **/
37: public static final String BUILDER = "BUILDER";
38:
39: /** Node write / read flag **/
40: public static final String NODES = "NODES";
41:
42: /** Edge write / read flag **/
43: public static final String EDGES = "EDGES";
44:
45: /**
46: * Constructs an AbstractReaderWriter.
47: */
48: public AbstractReaderWriter() {
49: m_properties = new HashMap();
50: }
51:
52: /**
53: * Sets a property. Some properties dont have values associated with them,
54: * they are just set, and unset.
55: *
56: * @param name Name of property
57: */
58: public void setProperty(String name) {
59: setProperty(name, new Object());
60: }
61:
62: /**
63: * @see GraphReaderWriter#setProperty(String, Object)
64: */
65: public void setProperty(String name, Object obj) {
66: m_properties.put(name, obj);
67: }
68:
69: /**
70: * @see GraphReaderWriter#getProperty(String)
71: */
72: public Object getProperty(String name) {
73: return (m_properties.get(name));
74: }
75: }
|