dol: initial dol commit
[jump.git] / dol / src / dol / datamodel / architecture / HWChannel.java
1 /* $Id: HWChannel.java 1 2010-02-24 13:03:05Z haidw $ */
2 package dol.datamodel.architecture;
3
4 import java.util.Iterator;
5 import java.util.Vector;
6
7 import dol.visitor.ArchiVisitor;
8
9 /**
10  * This class represents an interconnect element in the architecture.
11  */
12 public class HWChannel extends ArchiResource {
13     /**
14      * Constructor to create a HWChannel with a name and an empty
15      * nodeList.
16      */
17     public HWChannel(String name) {
18         super(name);
19         _pathList = new Vector<String>();
20     }
21
22     /**
23      * Accept a Visitor
24      * @param x A Visitor Object.
25      */
26     public void accept(ArchiVisitor x) {
27         x.visitComponent(this);
28     }
29
30     /**
31      * Clone this HWChannel
32      *
33      * @return a new instance of the HWChannel.
34      */
35     @SuppressWarnings("unchecked")
36     public Object clone() {
37         HWChannel newObj = (HWChannel) super.clone();
38         newObj.setPathList((Vector<String>)_pathList.clone());
39         return (newObj);
40     }
41
42     /**
43      * Get the range of this processor.
44      *
45      * @return range
46      */
47     public String getRange() {
48         return _range;
49     }
50
51     /**
52      * Set the range of this process.
53      *
54      * @param range new range value
55      */
56     public void setRange(String range) {
57         _range= range;
58     }
59
60     /**
61      * Get the type of this hw_channel.
62      *
63      * @return type
64      */
65     public String getType() {
66         return _type;
67     }
68
69     /**
70      * Set the type of this hw_channel.
71      *
72      * @param type new range value
73      */
74     public void setType(String type) {
75         _type= type;
76     }
77
78     /**
79      * Has this processor nodes?
80      *
81      * @return boolean value
82      */
83     public boolean hasNodes() {
84         Iterator<Node> i = getNodeList().iterator();
85         while (i.hasNext()) {
86             i.next();
87             return true;
88         }
89         return false;
90     }
91
92     /**
93      * Get the list of pathes via this resource.
94      *
95      * @return list of path.
96      */
97     public Vector<String> getPathList() {
98         return _pathList;
99     }
100
101     /**
102      * Set the list of pathes via this resource.
103      *
104      * @param list path list
105      */
106     public void setPathList(Vector<String> list) {
107         _pathList = list;
108     }
109
110     /**
111      * Return a description of the processor.
112      *
113      * @return a description of the processor.
114      */
115     public String toString() {
116         return "HWChannel: " + getName() ;
117     }
118
119     /**
120      * Range of the iterator when the instance belongs to an iterated
121      * series of processors.
122      */
123     protected String _range;
124     protected String _type;
125
126     // Store the name of pathes which go via this communication resource.
127     protected Vector<String> _pathList;
128 }