gumbo.util.route
Class EventRouter

java.lang.Object
  |
  +--gumbo.util.route.EventRouter
Direct Known Subclasses:
EventDataRouter, EventGroupRouter

public abstract class EventRouter
extends java.lang.Object

An abstract "strategy" for connecting two event nodes. Event node connections involve "syntax" and "semantics". Syntax is handled by the nodes themselves through static and dynamic type checking. Semantics is handled by a router by checking for end node compatibility.

Version:
$Revision: 1.1 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Constructor Summary
EventRouter()
           
 
Method Summary
protected abstract  boolean checkConnect(int indexA, EventNode nodeA, int indexB, EventNode nodeB)
          Implementors should throw an exception if the nodes are incompatible for connection, and return false if the connection should be silently ignored.
protected abstract  boolean checkDisconnect(EventNode nodeA, EventNode nodeB)
          Implementors should throw an exception if the nodes are incompatible for disconnection, and return false if the disconnection should be silently ignored.
 boolean connect(EventNodeMarker nodeA, EventNodeMarker nodeB)
          Connects two nodes together, with data receiver nodes being added to the ends of the node receiver lists.
 boolean connect(int indexA, EventNodeMarker nodeA, int indexB, EventNodeMarker nodeB)
          Connects two nodes together, with data receiver nodes being inserted at the specified indices in the respective node receiver lists.
 boolean disconnect(EventNodeMarker nodeA, EventNodeMarker nodeB)
          Disconnects two nodes.
abstract  boolean sync()
          Forces this route's senders to send their values to this route's receivers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventRouter

public EventRouter()
Method Detail

connect

public final boolean connect(EventNodeMarker nodeA,
                             EventNodeMarker nodeB)
Connects two nodes together, with data receiver nodes being added to the ends of the node receiver lists.


connect

public final boolean connect(int indexA,
                             EventNodeMarker nodeA,
                             int indexB,
                             EventNodeMarker nodeB)
Connects two nodes together, with data receiver nodes being inserted at the specified indices in the respective node receiver lists. If index is 0, insertion occurs at the head of the list. If index is -1, insertion occurs at the end of the list. Calls each node's checkRouter() and this router's checkConnect() to check the connection.


disconnect

public final boolean disconnect(EventNodeMarker nodeA,
                                EventNodeMarker nodeB)
Disconnects two nodes. Ignores missing nodes and connections. Calls each node's checkRouter() and this router's checkDisconnect() to check the disconnection.


sync

public abstract boolean sync()
Forces this route's senders to send their values to this route's receivers.


checkConnect

protected abstract boolean checkConnect(int indexA,
                                        EventNode nodeA,
                                        int indexB,
                                        EventNode nodeB)
Implementors should throw an exception if the nodes are incompatible for connection, and return false if the connection should be silently ignored.


checkDisconnect

protected abstract boolean checkDisconnect(EventNode nodeA,
                                           EventNode nodeB)
Implementors should throw an exception if the nodes are incompatible for disconnection, and return false if the disconnection should be silently ignored.