view src/MPipeline/src/mpipeline/MConnection.java @ 46:ca0b8d4dcdb6 database-connection-manager

Fix
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mpipeline;

/**
 * A class that stores information about the connection of two blocks.
 * 
 * @author hewitson
 */
public class MConnection extends MElement{

    private String srcCanvas;
    private String dstCanvas;
    private String srcBlock;
    private int srcport;
    private int dstport;
    private String dstBlock;
    
    /**
     * Empty constructor
     */
    public MConnection(){
        
    }
    
    /**
     * Construct a connection given the src block and src port, the destination
     * block and destination port.
     * 
     * @param srcb
     * @param sp
     * @param dstb
     * @param dp
     */
    public MConnection(String srcb, int sp, String dstb, int dp){
        srcport = sp;
        dstport = dp;
        srcBlock = srcb;
        dstBlock = dstb;
    }

    /**
     * Create an MConnection object.
     * 
     * @param srcc source canvas name
     * @param srcb source block name
     * @param sp source port number
     * @param dstc destination canvas
     * @param dstb destination block
     * @param dp destination port number
     */
    public MConnection(String srcc, String srcb, int sp, String dstc, String dstb, int dp){
        srcCanvas = srcc;
        dstCanvas = dstc;
        srcport = sp;
        dstport = dp;
        srcBlock = srcb;
        dstBlock = dstb;
    }
    
    /**
     * Get the destination block for this connection.
     * @return
     */
    public String getDstBlock() {
        return dstBlock;
    }

    /**
     * Set the destination block for this connection.
     * @param dstBlock
     */
    public void setDstBlock(String dstBlock) {
        this.dstBlock = dstBlock;
    }

    
    /**
     * Get the destination port number.
     * @return
     */
    public int getDstport() {
        return dstport;
    }

    /**
     * Set the destination port number.
     * @param dstport
     */
    public void setDstport(int dstport) {
        this.dstport = dstport;
    }

    /**
     * Get the source block for this conneciton.
     * @return
     */
    public String getSrcBlock() {
        return srcBlock;
    }

    /**
     * Set the source block.
     * @param srcBlock
     */
    public void setSrcBlock(String srcBlock) {
        this.srcBlock = srcBlock;
    }

    /**
     * Get the source port number.
     * @return
     */
    public int getSrcport() {
        return srcport;
    }

    /**
     * Set the source port number.
     * @param srcport
     */
    public void setSrcport(int srcport) {
        this.srcport = srcport;
    }

    /**
     *
     * @return
     */
    public String getDstCanvas() {
        return dstCanvas;
    }

    /**
     *
     * @param dstCanvas
     */
    public void setDstCanvas(String dstCanvas) {
        this.dstCanvas = dstCanvas;
    }

    /**
     *
     * @return
     */
    public String getSrcCanvas() {
        return srcCanvas;
    }

    /**
     * 
     * @param srcCanvas
     */
    public void setSrcCanvas(String srcCanvas) {
        this.srcCanvas = srcCanvas;
    }

    

    /**
     *
     */
    public void display(){
        System.out.println("connection: " + srcCanvas + "/" + srcBlock + "[" + srcport + "] -> " + dstCanvas+"/"+dstBlock + "[" + dstport + "]");
    }
}