com.cra.bnet.engine
Class TopologyEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.cra.bnet.engine.TopologyEvent
All Implemented Interfaces:
Serializable

public class TopologyEvent
extends EventObject

A topology-related event for a Bayesian network.

See Also:
Serialized Form

Field Summary
static com.cra.bnet.engine.TopologyEvent.TopologyEventType EDGE_ADDED
          The edge added event type.
static com.cra.bnet.engine.TopologyEvent.TopologyEventType EDGE_REMOVED
          The edge removed event type.
static com.cra.bnet.engine.TopologyEvent.TopologyEventType NODE_ADDED
          The node added event type.
static com.cra.bnet.engine.TopologyEvent.TopologyEventType NODE_REMOVED
          The node removed event type.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
TopologyEvent(BayesianNetwork source, com.cra.bnet.engine.TopologyEvent.TopologyEventType type, Edge edge)
          Creates a new edge-related TopologyEvent.
TopologyEvent(BayesianNetwork source, com.cra.bnet.engine.TopologyEvent.TopologyEventType type, Node node)
          Creates a new node-related TopologyEvent.
 
Method Summary
 Edge getEdge()
          Returns the edge that was added to or removed from the Bayesian network.
 BayesianNetwork getNetwork()
          Returns the Bayesian network that this event occured upon.
 Node getNode()
          Returns the node that added to or removed from the Bayesian network.
 com.cra.bnet.engine.TopologyEvent.TopologyEventType getType()
          Returns the type of this event.
 String toString()
          Returns a string representation of this topology event.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NODE_ADDED

public static final com.cra.bnet.engine.TopologyEvent.TopologyEventType NODE_ADDED
The node added event type.


NODE_REMOVED

public static final com.cra.bnet.engine.TopologyEvent.TopologyEventType NODE_REMOVED
The node removed event type.


EDGE_ADDED

public static final com.cra.bnet.engine.TopologyEvent.TopologyEventType EDGE_ADDED
The edge added event type.


EDGE_REMOVED

public static final com.cra.bnet.engine.TopologyEvent.TopologyEventType EDGE_REMOVED
The edge removed event type.

Constructor Detail

TopologyEvent

public TopologyEvent(BayesianNetwork source,
                     com.cra.bnet.engine.TopologyEvent.TopologyEventType type,
                     Node node)
Creates a new node-related TopologyEvent. The specified type must be either TopologyEvent.NODE_ADDED or TopologyEvent.NODE_REMOVED.

Parameters:
source - the Bayesian network the event occured upon.
type - type of the event.
node - node that was added to or removed from the Bayesian network.

TopologyEvent

public TopologyEvent(BayesianNetwork source,
                     com.cra.bnet.engine.TopologyEvent.TopologyEventType type,
                     Edge edge)
Creates a new edge-related TopologyEvent. The specified type must be either TopologyEvent.EDGE_ADDED or TopologyEvent.EDGE_REMOVED.

Parameters:
source - the Bayesian network the event occured upon.
type - type of the event.
edge - edge that was added to or removed from the Bayesian network.
Method Detail

getNetwork

public BayesianNetwork getNetwork()
Returns the Bayesian network that this event occured upon.

Returns:
the Bayesian network that this event occured upon.

getType

public com.cra.bnet.engine.TopologyEvent.TopologyEventType getType()
Returns the type of this event.

Returns:
the type of this event.

getNode

public Node getNode()
Returns the node that added to or removed from the Bayesian network. If this is an edge-related event, this method will return null.

Returns:
the node that added to or removed from the Bayesian network.

getEdge

public Edge getEdge()
Returns the edge that was added to or removed from the Bayesian network. If this is a node-related event, this method will return null.

Returns:
the edge that was added to or removed from the Bayesian network.

toString

public String toString()
Returns a string representation of this topology event.

Overrides:
toString in class EventObject
Returns:
a string representation of this topology event.