dol: initial dol commit
[jump.git] / dol / src / dol / datamodel / pn / SourceCode.java
diff --git a/dol/src/dol/datamodel/pn/SourceCode.java b/dol/src/dol/datamodel/pn/SourceCode.java
new file mode 100644 (file)
index 0000000..26f09e1
--- /dev/null
@@ -0,0 +1,131 @@
+/* $Id: SourceCode.java 1 2010-02-24 13:03:05Z haidw $ */
+package dol.datamodel.pn;
+
+import dol.visitor.PNVisitor;
+
+/**
+ * This class is the basic source code of a process.
+ */
+public class SourceCode {
+
+    /**
+     *  Constructor to create a SourceCode with a name.
+     */
+    public SourceCode(String name) {
+        _name = name;
+    }
+
+    /**
+     * Accept a visitor.
+     *
+     * @param x visitor object
+     */
+    public void accept(PNVisitor x) {
+        x.visitComponent(this);
+    }
+
+    /**
+     * Clone this SourceCode.
+     *
+     * @return new instance of the SourceCode.
+     */
+    public Object clone() {
+        try {
+            SourceCode newObj = (SourceCode) super.clone();
+            newObj.setName(_name);
+            newObj.setType(_type);
+            newObj.setLocality(_locality);
+            newObj.setProcess( (Process) _process.clone() );
+            return (newObj);
+        } catch (CloneNotSupportedException e) {
+            System.out.println("Error Clone not Supported");
+        }
+        return null;
+    }
+
+    /**
+     * Get the name of this SourceCode.
+     *
+     * @return  the name
+     */
+    public String getName() {
+        return _name;
+    }
+
+    /**
+     * Set the name of this SourceCode.
+     *
+     * @param name name of the SourceCode
+     */
+    public void setName(String name) {
+        _name = name;
+    }
+
+    /**
+     * Get the process of this SourceCode.
+     *
+     * @return process to which this SourceCode belongs
+     */
+    public Process getProcess() {
+        return _process;
+    }
+
+    /**
+     * Set the proces of this SourceCode.
+     *
+     * @param process process to which this SourceCode belongs
+     */
+    public void setProcess(Process process) {
+        _process = process;
+    }
+
+    /**
+     * Get the locality of this SourceCode.
+     *
+     * @return locality of the SourceCode
+     */
+    public String getLocality() {
+        return _locality;
+    }
+
+    /**
+     * Set the locality of this SourceCode.
+     *
+     * @param locality locality of the SourceCode
+     */
+    public void setLocality(String locality) {
+        _locality = locality;
+    }
+
+    /**
+     * Get the type of this SourceCode.
+     *
+     * @return type of the SourceCode
+     */
+    public String getType() {
+        return _type;
+    }
+
+    /**
+     * Set the type of this SourceCode.
+     *
+     * @param  type The new type
+     */
+    public void setType(String type) {
+        _type = type;
+    }
+
+    /**
+     * Return a string representation of the SourceCode.
+     *
+     * @return string representation of the SourceCode
+     */
+    public String toString() {
+        return "SourceCode: " + _name;
+    }
+
+    protected String _name = null;
+    protected Process _process = null;
+    protected String _type = null;
+    protected String _locality = null;
+}