dol: initial dol commit
[jump.git] / dol / src / dol / datamodel / architecture / HWChannel.java
diff --git a/dol/src/dol/datamodel/architecture/HWChannel.java b/dol/src/dol/datamodel/architecture/HWChannel.java
new file mode 100644 (file)
index 0000000..f4ed94e
--- /dev/null
@@ -0,0 +1,128 @@
+/* $Id: HWChannel.java 1 2010-02-24 13:03:05Z haidw $ */
+package dol.datamodel.architecture;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import dol.visitor.ArchiVisitor;
+
+/**
+ * This class represents an interconnect element in the architecture.
+ */
+public class HWChannel extends ArchiResource {
+    /**
+     * Constructor to create a HWChannel with a name and an empty
+     * nodeList.
+     */
+    public HWChannel(String name) {
+        super(name);
+        _pathList = new Vector<String>();
+    }
+
+    /**
+     * Accept a Visitor
+     * @param x A Visitor Object.
+     */
+    public void accept(ArchiVisitor x) {
+        x.visitComponent(this);
+    }
+
+    /**
+     * Clone this HWChannel
+     *
+     * @return a new instance of the HWChannel.
+     */
+    @SuppressWarnings("unchecked")
+    public Object clone() {
+        HWChannel newObj = (HWChannel) super.clone();
+        newObj.setPathList((Vector<String>)_pathList.clone());
+        return (newObj);
+    }
+
+    /**
+     * Get the range of this processor.
+     *
+     * @return range
+     */
+    public String getRange() {
+        return _range;
+    }
+
+    /**
+     * Set the range of this process.
+     *
+     * @param range new range value
+     */
+    public void setRange(String range) {
+        _range= range;
+    }
+
+    /**
+     * Get the type of this hw_channel.
+     *
+     * @return type
+     */
+    public String getType() {
+        return _type;
+    }
+
+    /**
+     * Set the type of this hw_channel.
+     *
+     * @param type new range value
+     */
+    public void setType(String type) {
+        _type= type;
+    }
+
+    /**
+     * Has this processor nodes?
+     *
+     * @return boolean value
+     */
+    public boolean hasNodes() {
+        Iterator<Node> i = getNodeList().iterator();
+        while (i.hasNext()) {
+            i.next();
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Get the list of pathes via this resource.
+     *
+     * @return list of path.
+     */
+    public Vector<String> getPathList() {
+        return _pathList;
+    }
+
+    /**
+     * Set the list of pathes via this resource.
+     *
+     * @param list path list
+     */
+    public void setPathList(Vector<String> list) {
+        _pathList = list;
+    }
+
+    /**
+     * Return a description of the processor.
+     *
+     * @return a description of the processor.
+     */
+    public String toString() {
+        return "HWChannel: " + getName() ;
+    }
+
+    /**
+     * Range of the iterator when the instance belongs to an iterated
+     * series of processors.
+     */
+    protected String _range;
+    protected String _type;
+
+    // Store the name of pathes which go via this communication resource.
+    protected Vector<String> _pathList;
+}