X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fdatamodel%2Fpn%2FChannel.java;fp=dol%2Fsrc%2Fdol%2Fdatamodel%2Fpn%2FChannel.java;h=2aa07062ece24a1e6db284b39b45446d85de9dad;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/datamodel/pn/Channel.java b/dol/src/dol/datamodel/pn/Channel.java new file mode 100644 index 0000000..2aa0706 --- /dev/null +++ b/dol/src/dol/datamodel/pn/Channel.java @@ -0,0 +1,129 @@ +/* $Id: Channel.java 1 2010-02-24 13:03:05Z haidw $ */ +package dol.datamodel.pn; + +import dol.visitor.PNVisitor; + +/** + * This class is the basic channel in a process network. + * The channel has a name and a list of ports connected by this channel. + * In this model, a channel has only two ports: one input port and one + * output port. + */ +public class Channel extends Resource implements Schedulable { + + /** + * Constructor to create a channel with a name and an empty + * portList. + */ + public Channel(String name) { + super(name); + } + + /** + * Accept a visitor. + * @param x visitor object + */ + public void accept(PNVisitor x) { + x.visitComponent(this); + } + + /** + * Clone this channel. + * + * @return new instance of the channel + */ + public Object clone() { + Channel newObj = (Channel) super.clone(); + return (newObj); + } + + /** + * Get the size of this channel. + * + * @return size of the channel + */ + public int getSize() { + return _size; + } + + /** + * Set the size of this channel. + * + * @param size new size value + */ + public void setSize(int size) { + _size = size; + } + + /** + * Get the token size of this channel. + * + * @return token size of the channel + */ + public int getTokenSize() { + return _tokenSize; + } + + /** + * Set the token size of this channel. + * + * @param size new token size + */ + public void setTokenSize(int size) { + _tokenSize = size; + } + + /** + * Return a string representation of the channel. + * + * @return string representation of the channel + */ + public String toString() { + return "Channel: " + getName(); + } + + /** + * Get the process where this channel starts from. + * + * @return origin process + */ + public Process getOrigin() { + return _origin; + } + + /** + * Set the process where this channel starts from. + * + * @param origin origin process + */ + public void setOrigin(Process origin) { + _origin = origin; + } + + /** + * Get the process where this channel ends. + * + * @return target process + */ + public Process getTarget() { + return _target; + } + + /** + * Set the process where this channel ends. + * + * @param target target process + */ + public void setTarget(Process target) { + _target = target; + } + + protected Process _origin; + protected Process _target; + + /** size of the channel */ + protected int _size; + + /** token size fo the channel */ + protected int _tokenSize; +}