X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fdatamodel%2Farchitecture%2FPath.java;fp=dol%2Fsrc%2Fdol%2Fdatamodel%2Farchitecture%2FPath.java;h=c18084ae5fafd1a9b7ed6c0c301a3e3cfab10eb4;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/datamodel/architecture/Path.java b/dol/src/dol/datamodel/architecture/Path.java new file mode 100644 index 0000000..c18084a --- /dev/null +++ b/dol/src/dol/datamodel/architecture/Path.java @@ -0,0 +1,118 @@ +/* $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(); + } + + /** + * 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 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 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 _path; +}