1 /* $Id: Variable.java 1 2010-02-24 13:03:05Z haidw $ */
2 package dol.datamodel.pn;
4 import dol.visitor.PNVisitor;
7 * This class represents a global variable in XML.
9 public class Variable {
12 * Constructor to create a Variable.
14 public Variable(String name) {
21 * @param x visitor object
23 public void accept(PNVisitor x) {
24 x.visitComponent(this);
28 * Clone this Variable.
30 * @return new instance of the Variable.
32 public Object clone() {
34 Variable newObj = (Variable) super.clone();
35 newObj.setName(_name);
37 } catch (CloneNotSupportedException e) {
38 System.out.println("Error Clone not Supported");
44 * Get the value of the Variable.
46 * @return the value of the variable
48 public int getValue() {
53 * Set the value of the Variable.
55 * @param value the value of the variable
57 public void setValue(int value) {
62 * Get the name of this SourceCode.
66 public String getName() {
71 * Set the name of this SourceCode.
73 * @param name name of the SourceCode
75 public void setName(String name) {
80 * Get the hierarchical parent of this resource.
82 * @return parent of this resource
84 public Resource getParentResource() {
85 return _parentResource;
89 * Set the hierarchical parent of this resource.
91 * @param parentResource new parent
93 public void setParentResource(Resource parentResource) {
94 _parentResource = parentResource;
98 * Return a string representation of the Variable.
100 * @return string representation of the Variable
102 public String toString() {
103 return "Variable: " + getName();
106 protected int _value;
107 protected String _name = null;
108 protected Resource _parentResource = null;