1 package dol.datamodel.mapping;
3 import dol.visitor.MapVisitor;
6 * This class represents a global variable in the mapping XML.
8 public class Variable implements Cloneable {
11 * Constructor to create a Variable.
13 public Variable(String name) {
20 * @param x visitor object
22 public void accept(MapVisitor x) {
23 x.visitComponent(this);
27 * Clone this Variable.
29 * @return new instance of the Variable.
31 public Object clone() {
33 Variable newObj = (Variable) super.clone();
34 newObj.setName(_name);
36 } catch (CloneNotSupportedException e) {
37 System.out.println("Error Clone not Supported");
43 * Get the value of the Variable.
45 * @return the value of the variable
47 public int getValue() {
52 * Set the value of the Variable.
54 * @param value the value of the variable
56 public void setValue(int value) {
61 * Get the name of this SourceCode.
65 public String getName() {
70 * Set the name of this SourceCode.
72 * @param name name of the SourceCode
74 public void setName(String name) {
79 * Get the parent ArchiResource.
81 * @return parent ArchiResource
83 public MapResource getParentResource() {
84 return _parentResource;
88 * Set the parent ArchiResource.
90 * @param parentResource new parent
92 public void setParentResource(MapResource parentResource) {
93 _parentResource = parentResource;
97 * Return a string representation of the Variable.
99 * @return string representation of the Variable
101 public String toString() {
102 return "Variable: " + getName();
105 protected int _value;
106 protected String _name = null;
107 protected MapResource _parentResource = null;