dol: initial dol commit
[jump.git] / dol / src / dol / datamodel / pn / SourceCode.java
1 /* $Id: SourceCode.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 is the basic source code of a process.
8  */
9 public class SourceCode {
10
11     /**
12      *  Constructor to create a SourceCode with a name.
13      */
14     public SourceCode(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 SourceCode.
29      *
30      * @return new instance of the SourceCode.
31      */
32     public Object clone() {
33         try {
34             SourceCode newObj = (SourceCode) super.clone();
35             newObj.setName(_name);
36             newObj.setType(_type);
37             newObj.setLocality(_locality);
38             newObj.setProcess( (Process) _process.clone() );
39             return (newObj);
40         } catch (CloneNotSupportedException e) {
41             System.out.println("Error Clone not Supported");
42         }
43         return null;
44     }
45
46     /**
47      * Get the name of this SourceCode.
48      *
49      * @return  the name
50      */
51     public String getName() {
52         return _name;
53     }
54
55     /**
56      * Set the name of this SourceCode.
57      *
58      * @param name name of the SourceCode
59      */
60     public void setName(String name) {
61         _name = name;
62     }
63
64     /**
65      * Get the process of this SourceCode.
66      *
67      * @return process to which this SourceCode belongs
68      */
69     public Process getProcess() {
70         return _process;
71     }
72
73     /**
74      * Set the proces of this SourceCode.
75      *
76      * @param process process to which this SourceCode belongs
77      */
78     public void setProcess(Process process) {
79         _process = process;
80     }
81
82     /**
83      * Get the locality of this SourceCode.
84      *
85      * @return locality of the SourceCode
86      */
87     public String getLocality() {
88         return _locality;
89     }
90
91     /**
92      * Set the locality of this SourceCode.
93      *
94      * @param locality locality of the SourceCode
95      */
96     public void setLocality(String locality) {
97         _locality = locality;
98     }
99
100     /**
101      * Get the type of this SourceCode.
102      *
103      * @return type of the SourceCode
104      */
105     public String getType() {
106         return _type;
107     }
108
109     /**
110      * Set the type of this SourceCode.
111      *
112      * @param  type The new type
113      */
114     public void setType(String type) {
115         _type = type;
116     }
117
118     /**
119      * Return a string representation of the SourceCode.
120      *
121      * @return string representation of the SourceCode
122      */
123     public String toString() {
124         return "SourceCode: " + _name;
125     }
126
127     protected String _name = null;
128     protected Process _process = null;
129     protected String _type = null;
130     protected String _locality = null;
131 }