dol: initial dol commit
[jump.git] / dol / src / dol / datamodel / pn / Configuration.java
1 /* $Id: Configuration.java 1 2010-02-24 13:03:05Z haidw $ */
2 package dol.datamodel.pn;
3
4 import dol.visitor.PNVisitor;
5
6 /**
7  * This class represents a name-value pair of a configuration tag in XML.
8  */
9 public class Configuration {
10
11     /**
12      * Constructor to create a Configuration.
13      */
14     public Configuration(String name) {
15         _name = name;
16     }
17
18     /**
19      * Accept a Visitor.
20      *
21      * @param x visitor object
22      */
23     public void accept(PNVisitor x) {
24         x.visitComponent(this);
25     }
26
27     /**
28      * Clone this Configuration.
29      *
30      * @return new instance of the Configuration.
31      */
32     public Object clone() {
33         try {
34             Configuration newObj = (Configuration) super.clone();
35             newObj.setName(_name);
36             newObj.setValue(_value);
37             return (newObj);
38         } catch (CloneNotSupportedException e) {
39             System.out.println("Error Clone not Supported");
40         }
41         return null;
42     }
43
44     /**
45      * Get the value of the Configuration.
46      *
47      * @return the value of the configuration.
48      */
49     public String getValue() {
50         return _value;
51     }
52
53     /**
54      * Set the value of the Configuration.
55      *
56      * @param value the value of the configuration.
57      */
58     public void setValue(String value) {
59         _value = value;
60     }
61
62     /**
63      * Get the name of this configuration.
64      *
65      * @return  the name
66      */
67     public String getName() {
68         return _name;
69     }
70
71     /**
72      * Set the name of this configuration.
73      *
74      * @param name name of the configuration
75      */
76     public void setName(String name) {
77         _name = name;
78     }
79
80     /**
81      * Get the hierarchical parent of this resource.
82      *
83      * @return parent of this resource
84      */
85      public Resource getParentResource() {
86         return _parentResource;
87     }
88
89     
90     /**
91      * Set the hierarchical parent of this resource.
92      *
93      * @param parentResource new parent
94      */
95     public void setParentResource(Resource parentResource) {
96         _parentResource = parentResource;
97     }
98
99     
100     /**
101      * Return a string representation of the Configuration.
102      *
103      * @return string representation of the Configuration
104      */
105     public String toString() {
106         return "Configuration: " + getName();
107     }
108
109     protected String _value = null;
110     protected String _name = null;
111     protected Resource _parentResource = null;
112 }