X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fdatamodel%2Fpn%2FConnection.java;fp=dol%2Fsrc%2Fdol%2Fdatamodel%2Fpn%2FConnection.java;h=3830f96e591c495c60a7e92b04f1cf93fb103588;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/datamodel/pn/Connection.java b/dol/src/dol/datamodel/pn/Connection.java new file mode 100644 index 0000000..3830f96 --- /dev/null +++ b/dol/src/dol/datamodel/pn/Connection.java @@ -0,0 +1,130 @@ +/* $Id: Connection.java 1 2010-02-24 13:03:05Z haidw $ */ +package dol.datamodel.pn; + +import dol.visitor.PNVisitor; + +/** + * This class defines a connection. + * A connection contains one origin and one target resource and the + * according ports. + */ +public class Connection extends Resource { + + /** + * Constructor to create a Connection with a name, + * empty process list and empty channel list. + */ + public Connection(String name) { + super(name); + } + + /** + * Accept a Visitor. + * + * @param x visitor object + */ + public void accept(PNVisitor x) { + x.visitComponent(this); + } + + /** + * Clone this Connection. + * + * @return a new instance of the Connection. + */ + public Object clone() { + Connection newObj = (Connection) super.clone(); + newObj.setOrigin(_origin); + newObj.setOriginPort(_originPort); + newObj.setTarget(_target); + newObj.setTargetPort(_targetPort); + return (newObj); + } + + /** + * Return a string representation of the connection. + * + * @return string representation of the connection + */ + public String toString() { + return "Connection: " + getName(); + } + + + /** + * Get the origin resource of his connection. + * + * @return origin resource + */ + public Resource getOrigin() { + return _origin; + } + + /** + * Set the origin resource of this connection. + * + * @param origin origin resource + */ + public void setOrigin(Resource origin) { + _origin = origin; + } + + /** + * Get the origin port of this connection. + * + * @return origin port + */ + public Port getOriginPort() { + return _originPort; + } + + /** + * Set the origin port of this connection. + * + * @param port origin port + */ + public void setOriginPort(Port port) { + _originPort = port; + } + + /** + * Get the target resource of his connection. + * + * @return target resource + */ + public Resource getTarget() { + return _target; + } + + /** + * Set the target resource of this connection. + * + * @param target target resource + */ + public void setTarget(Resource target) { + _target = target; + } + + /** + * Get the target port of this connection. + * + * @return target port + */ + public Port getTargetPort() { + return _targetPort; + } + + /** + * Set the target port of this connection. + * + * @param port target port + */ + public void setTargetPort(Port port) { + _targetPort = port; + } + + protected Resource _origin; + protected Port _originPort; + protected Resource _target; + protected Port _targetPort; +}