dol: initial dol commit
[jump.git] / dol / src / dol / datamodel / architecture / Memory.java
1 /* $Id: Memory.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 a memory element in the archietcture.
11  */
12 public class Memory extends ArchiResource {
13     /**
14      * Constructor to create a Memory with a name and an empty
15      * nodeList.
16      */
17     public Memory(String name) {
18         super(name);
19         _rxBufList = new Vector<String>();
20         _txBufList = new Vector<String>();
21         _chBufList = new Vector<String>();
22     }
23
24     /**
25      * Accept a Visitor
26      * @param x A Visitor Object.
27      */
28     public void accept(ArchiVisitor x) {
29         x.visitComponent(this);
30     }
31
32     /**
33      * Clone this Memory
34      *
35      * @return a new instance of the Memory.
36      */
37     @SuppressWarnings("unchecked")
38     public Object clone() {
39         Memory newObj = (Memory) super.clone();
40         newObj.setRXBufList((Vector<String>)_rxBufList.clone());
41         newObj.setTXBufList((Vector<String>)_txBufList.clone());
42         newObj.setCHBufList((Vector<String>)_chBufList.clone());
43         return (newObj);
44     }
45
46     /**
47      * Get the range of this Memory.
48      *
49      * @return range
50      */
51     public String getRange() {
52         return _range;
53     }
54
55     /**
56      * Set the range of this Memory.
57      *
58      * @param range new range value
59      */
60     public void setRange(String range) {
61         _range= range;
62     }
63
64     /**
65      * Get the type of this Memory.
66      *
67      * @return type
68      */
69     public String getType() {
70         return _type;
71     }
72
73     /**
74      * Set the type of this Memory.
75      *
76      * @param type new range value
77      */
78     public void setType(String type) {
79         _type= type;
80     }
81
82     /**
83      * Get the list of RXBuf of this memory
84      *
85      * @return list of RX buffer.
86      */
87     public Vector<String> getRXBufList() {
88         return _rxBufList;
89     }
90
91     /**
92      * Set the list of RXBuf of this memory.
93      *
94      * @param list RX buffer list
95      */
96     public void setRXBufList(Vector<String> list) {
97         _rxBufList = list;
98     }
99
100     /**
101      * Get the list of TXBuf of this memory.
102      *
103      * @return list of TX buffers.
104      */
105     public Vector<String> getTXBufList() {
106         return _txBufList;
107     }
108
109     /**
110      * Set the list of TXBuf of this memory.
111      *
112      * @param list TX buffer list
113      */
114     public void setTXBufList(Vector<String> list) {
115         _txBufList = list;
116     }
117
118     /**
119      * Get the list of channel buffers of this memory.
120      *
121      * @return list of channel buffers.
122      */
123     public Vector<String> getCHBufList() {
124         return _chBufList;
125     }
126
127     /**
128      * Set the list of channel Buf of this memory.
129      *
130      * @param list channel buffer list
131      */
132     public void setCHBufList(Vector<String> list) {
133         _chBufList = list;
134     }
135
136     /**
137      * Has this memory nodes?
138      *
139      * @return boolean value
140      */
141     public boolean hasNodes() {
142         Iterator<Node> i = getNodeList().iterator();
143         while (i.hasNext()) {
144             i.next();
145             return true;
146         }
147         return false;
148     }
149
150     /**
151      * Return a description of the Memory.
152      *
153      * @return a description of the Memory.
154      */
155     public String toString() {
156         return "Memory: " + getName() ;
157     }
158
159     /**
160      * Range of the iterator when the instance belongs to an iterated
161      * series of Memories.
162      */
163     protected String _range;
164     protected String _type;
165
166     // store the name of rx, tx channel buffer, can be used for dotty gen.
167     protected Vector<String> _rxBufList;
168     protected Vector<String> _txBufList;
169     protected Vector<String> _chBufList;
170 }