Changeset 7510

Show
Ignore:
Timestamp:
05/07/08 13:45:49 (5 years ago)
Author:
Snyder.Jason
Message:

added method to connect ports

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/ComponentProject/src/edu/vt/ossie/wavedev/Port.java

    r7494 r7510  
    8080        return getString(TYPE); 
    8181    } 
     82     
     83    public String connect(Port remotePort) 
     84    { 
     85        String result = null; 
     86         
     87        if(this.getType() == remotePort.getType()) 
     88            result = "Both ports are " + this.getType() + " ports."; 
     89        else 
     90        { 
     91            Connection connection = (Connection) factory().create(Connection.PYTHON_CLASS,  
     92                this, remotePort, remotePort.getOwner()); 
     93         
     94            if(!connection.checkConnection(connection)) 
     95                result = "Duplicate Connection.";  
     96            else 
     97                getOwner().getConnections().append(connection.deepcopy()); 
     98        } 
     99        return result; 
     100    } 
    82101 
    83102 
     
    90109        { 
    91110            put(ECLIPSE_OWNER, Py.None); 
     111            put(ECLIPSE_CONNECTIONS, Py.None); 
    92112        } 
     113         
    93114    } 
    94115 
     
    101122    // Augmented attributes added by Eclipse tools 
    102123    private static final String ECLIPSE_OWNER = "xOwner"; 
     124    private static final String ECLIPSE_CONNECTIONS = "xConnections"; 
    103125}