[kepler-dev] connectionsChanged() method

Edward A. Lee eal at eecs.berkeley.edu
Wed Jun 4 12:19:15 PDT 2008


In looking at Efrat's OpenDBConnection actor, I see:

  /**
   * When connecting the dbcon port, trigger the connectionsChanged of
   * the connected actor.
   */
  public void connectionsChanged(Port port) {
      super.connectionsChanged(port);
      if (port == dbcon) {
        List conPortsList = dbcon.connectedPortList();
        Iterator conPorts = conPortsList.iterator();
        while (conPorts.hasNext()) {
                IOPort p = (IOPort) conPorts.next();
                if (p.isInput()) {
                        Entity container = (Entity)p.getContainer();
                        container.connectionsChanged(p);
                }
        }
      }
  }


This looks to me like something that should be in a base class.
However, it wouldn't quite work as written, since it would
go into an infinite loop with a pair of ports calling each other's
connectionsChanged() methods.

Comments?  Anyone else found that they need this?
If there is demand, I'll change the functionality of the appropriate
base class.

Edward


------------ 
Edward A. Lee
Chair of EECS and Robert S. Pepper Distinguished Professor
231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
phone: 510-642-0253, fax: 510-642-2845
eal at eecs.Berkeley.EDU, http://www.eecs.berkeley.edu/Faculty/Homepages/lee.html  



More information about the Kepler-dev mailing list