1 /* $Id: Channel.java 1 2010-02-24 13:03:05Z haidw $ */
2 package dol.datamodel.pn;
4 import dol.visitor.PNVisitor;
7 * This class is the basic channel in a process network.
8 * The channel has a name and a list of ports connected by this channel.
9 * In this model, a channel has only two ports: one input port and one
12 public class Channel extends Resource implements Schedulable {
15 * Constructor to create a channel with a name and an empty
18 public Channel(String name) {
24 * @param x visitor object
26 public void accept(PNVisitor x) {
27 x.visitComponent(this);
33 * @return new instance of the channel
35 public Object clone() {
36 Channel newObj = (Channel) super.clone();
41 * Get the size of this channel.
43 * @return size of the channel
45 public int getSize() {
50 * Set the size of this channel.
52 * @param size new size value
54 public void setSize(int size) {
59 * Get the token size of this channel.
61 * @return token size of the channel
63 public int getTokenSize() {
68 * Set the token size of this channel.
70 * @param size new token size
72 public void setTokenSize(int size) {
77 * Return a string representation of the channel.
79 * @return string representation of the channel
81 public String toString() {
82 return "Channel: " + getName();
86 * Get the process where this channel starts from.
88 * @return origin process
90 public Process getOrigin() {
95 * Set the process where this channel starts from.
97 * @param origin origin process
99 public void setOrigin(Process origin) {
104 * Get the process where this channel ends.
106 * @return target process
108 public Process getTarget() {
113 * Set the process where this channel ends.
115 * @param target target process
117 public void setTarget(Process target) {
121 protected Process _origin;
122 protected Process _target;
124 /** size of the channel */
127 /** token size fo the channel */
128 protected int _tokenSize;