Class c2.framework.Brick
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class c2.framework.Brick

java.lang.Object
   |
   +----c2.framework.Brick

public class Brick
extends Object
Brick is the abstract super class of both components and connectors. It contains data and behavior that is shared between the two.

NOTE: This class should not be used directly. Use either Component, Connector, or one of their derived classes.

See Also:
Component, Connector, ComponentThread, ConnectorThread

Variable Index

 o component
 o connector
 o debugging
Enables debugging output.
 o name
 o type

Constructor Index

 o Brick()
 o Brick(String, String)

Method Index

 o brickType()
Returns the type; either "Component" or "Connector".
 o create(String, String)
 o debugPrint(String)
Prints a string to System.err only if Brick.debugging is true.
 o debugPrintln(String)
Prints a string to System.err only if Brick.debugging is true.
 o finish()
Immediately stops the execution of the component or connector (even if it has outstanding messages to process).
 o finished()
Returns true if the component or connector is idle (ie that it is not processing any messages).
 o handle(Notification)
This method is invoked when the brick receives a notification from a brick below it.
 o handle(Request)
This method is invoked when the brick receives a request from a brick below it.
 o name()
Returns the name of the component or connector.
 o newMessage(Port)
This method is invoked when the brick receives a new request or notification.
 o send(Notification)
Call this method to send a notification to a brick below your brick.
 o send(Request)
Call this method to send a request to a brick above your brick.
 o start()
Start the component or connector running.
 o toString()
Returns a String representation of the Brick, including the brick's type and name.

Variables

 o component
  protected final static String component
 o connector
  protected final static String connector
 o debugging
  public static boolean debugging
Enables debugging output. If set to true, calls to debugPrint() and debugPrintln() are forwarded to System.err.print().
See Also:
debugPrint, debugPrintln, err
 o name
  protected String name
 o type
  protected String type

Constructors

 o Brick
  public Brick()
 o Brick
  public Brick(String _name,
               String _type)

Methods

 o create
  public void create(String _name,
                     String _type)
 o start
  public void start()
Start the component or connector running. This method should be called before the component send or receives any messages.
 o finish
  public void finish()
Immediately stops the execution of the component or connector (even if it has outstanding messages to process).
 o finished
  public boolean finished()
Returns true if the component or connector is idle (ie that it is not processing any messages).
 o name
  public String name()
Returns the name of the component or connector.
 o brickType
  public String brickType()
Returns the type; either "Component" or "Connector".
 o handle
  protected abstract void handle(Request r)
This method is invoked when the brick receives a request from a brick below it. Override this method to process requests.
 o handle
  protected abstract void handle(Notification n)
This method is invoked when the brick receives a notification from a brick below it. Override this method to process notifications.
 o send
  protected abstract void send(Request r)
Call this method to send a request to a brick above your brick.
See Also:
Request
 o send
  protected abstract void send(Notification n)
Call this method to send a notification to a brick below your brick.
See Also:
Notification
 o newMessage
  protected abstract void newMessage(Port p)
This method is invoked when the brick receives a new request or notification. By default, it invokes the appropriate handle() method. Override this function only if you need to do special processing on incomming messages.
See Also:
handle, handle
 o toString
  public String toString()
Returns a String representation of the Brick, including the brick's type and name.
Overrides:
toString in class Object
 o debugPrintln
  public void debugPrintln(String s)
Prints a string to System.err only if Brick.debugging is true.
See Also:
debugging
 o debugPrint
  public void debugPrint(String s)
Prints a string to System.err only if Brick.debugging is true.
See Also:
debugging

All Packages  Class Hierarchy  This Package  Previous  Next  Index