1 /* $Id: Path.java 1 2010-02-24 13:03:05Z haidw $ */
2 package dol.datamodel.architecture;
4 import java.util.Iterator;
5 import java.util.Vector;
8 * Path consisting of write path and read path.
12 * Default constructor.
15 _path = new Vector<ArchiResource>();
19 * Set the read path of this path.
21 public void setReadPath(ReadPath readPath) {
23 computeArchitectureResources();
27 * Return the read path of this path.
31 public ReadPath getReadPath() {
36 * Set the write path of this path.
38 public void setWritePath(WritePath writePath) {
39 _writePath = writePath;
40 computeArchitectureResources();
44 * Return the write path of this path.
48 public WritePath getWritePath() {
53 * Return all resources contained in this path.
55 * @return all resources contained in this path
57 public Vector<ArchiResource> getPath() {
62 * Return the processor where this path starts.
64 * @return processor where this path starts
66 public Processor getStartProcessor() {
67 if (_path.size() == 0)
70 return (Processor)_path.elementAt(0);
74 * Return the processor where this path ends.
76 * @return processor where this path ends
78 public Processor getTargetProcessor() {
79 if (_path.size() == 0)
82 return (Processor)_path.elementAt(_path.size() - 1);
86 * Compute the vector of all resources contained in this path.
88 protected void computeArchitectureResources() {
91 if (_readPath == null || _writePath == null)
94 _path.add(_writePath.getProcessor());
95 _path.add(_writePath.getTXBuf());
96 Iterator<HWChannel> channelIterator =
97 _writePath.getHWChannelList().iterator();
98 while (channelIterator.hasNext()) {
99 _path.add(channelIterator.next());
101 _path.add(_readPath.getCHBuf());
102 channelIterator = _readPath.getHWChannelList().iterator();
103 while (channelIterator.hasNext()) {
104 _path.add(channelIterator.next());
106 _path.add(_readPath.getRXBuf());
107 _path.add(_readPath.getProcessor());
110 /** read path of this path*/
111 protected ReadPath _readPath = null;
113 /** write path of this path */
114 protected WritePath _writePath = null;
116 /** resources contained in this path */
117 Vector<ArchiResource> _path;