--- /dev/null
+/* $Id: Path.java 1 2010-02-24 13:03:05Z haidw $ */
+package dol.datamodel.architecture;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+/**
+ * Path consisting of write path and read path.
+ */
+public class Path {
+ /**
+ * Default constructor.
+ */
+ public Path() {
+ _path = new Vector<ArchiResource>();
+ }
+
+ /**
+ * Set the read path of this path.
+ */
+ public void setReadPath(ReadPath readPath) {
+ _readPath = readPath;
+ computeArchitectureResources();
+ }
+
+ /**
+ * Return the read path of this path.
+ *
+ * @return read path
+ */
+ public ReadPath getReadPath() {
+ return _readPath;
+ }
+
+ /**
+ * Set the write path of this path.
+ */
+ public void setWritePath(WritePath writePath) {
+ _writePath = writePath;
+ computeArchitectureResources();
+ }
+
+ /**
+ * Return the write path of this path.
+ *
+ * @return write path
+ */
+ public WritePath getWritePath() {
+ return _writePath;
+ }
+
+ /**
+ * Return all resources contained in this path.
+ *
+ * @return all resources contained in this path
+ */
+ public Vector<ArchiResource> getPath() {
+ return _path;
+ }
+
+ /**
+ * Return the processor where this path starts.
+ *
+ * @return processor where this path starts
+ */
+ public Processor getStartProcessor() {
+ if (_path.size() == 0)
+ return null;
+
+ return (Processor)_path.elementAt(0);
+ }
+
+ /**
+ * Return the processor where this path ends.
+ *
+ * @return processor where this path ends
+ */
+ public Processor getTargetProcessor() {
+ if (_path.size() == 0)
+ return null;
+
+ return (Processor)_path.elementAt(_path.size() - 1);
+ }
+
+ /**
+ * Compute the vector of all resources contained in this path.
+ */
+ protected void computeArchitectureResources() {
+ _path.clear();
+
+ if (_readPath == null || _writePath == null)
+ return;
+
+ _path.add(_writePath.getProcessor());
+ _path.add(_writePath.getTXBuf());
+ Iterator<HWChannel> channelIterator =
+ _writePath.getHWChannelList().iterator();
+ while (channelIterator.hasNext()) {
+ _path.add(channelIterator.next());
+ }
+ _path.add(_readPath.getCHBuf());
+ channelIterator = _readPath.getHWChannelList().iterator();
+ while (channelIterator.hasNext()) {
+ _path.add(channelIterator.next());
+ }
+ _path.add(_readPath.getRXBuf());
+ _path.add(_readPath.getProcessor());
+ }
+
+ /** read path of this path*/
+ protected ReadPath _readPath = null;
+
+ /** write path of this path */
+ protected WritePath _writePath = null;
+
+ /** resources contained in this path */
+ Vector<ArchiResource> _path;
+}