Prism.framework
Class Brick

java.lang.Object
  |
  +--Prism.framework.Brick
All Implemented Interfaces:
ScaffoldConstants
Direct Known Subclasses:
Architecture, Component, Connector, PeerConnector

public abstract class Brick
extends java.lang.Object
implements ScaffoldConstants

Brick is the abstract building block for architectures. It is never used directly, but instantiated as either a component or a connector. This class does not have a behavior of its own, but depends on sub classes to handle messages.

Version:
0.2
Author:
Nikunj Mehta, Marija Mikic-Rakic

Field Summary
 Address bottomId
          A identifying address for the bottom of the brick as a part of the architecture.
 Address myId
           
 java.lang.String name
          The identifier for this Brick.
 IScaffold scaffold
          The scaffold that might be attached to a brick.
 Address sideId
          A identifying address for the side of the brick as a part of the architecture.
 Address topId
          An identifying address for the top of the brick as a part of the architecture.
 
Fields inherited from interface Prism.framework.ScaffoldConstants
DISPATCH, MONITOR, SCHEDULER
 
Constructor Summary
Brick(java.lang.String str)
          A simple constructor to store the components name, and to assign it a unique ID
 
Method Summary
 void add(Message message)
          Add a message to the dispatcher
 void fireEvent(ArchitectureEvent event)
          Fire an event if the architecture has scaffolds
 Address getBottomId()
          Get the numeric identifier for the bottom of this brick
 Address getSideId()
          Get the numeric identifier for top of this brick
 Address getTopId()
          Get the numeric identifier for top of this brick
abstract  void handle(Message m)
          Both connectors and components need to handle messages.
 void setBottomId(Address id)
          Set the numeric identifier for the top of this brick
 void setName(java.lang.String n)
          Set the name of the component
 void setNameAfterTheFact(java.lang.String str)
           
 void setScaffold(IScaffold scaffold)
           
 void setSideId(Address id)
          Set the numeric identifier for the side of this brick
 void setTopId(Address id)
          Set the numeric identifier for the top of this brick
 void start()
          By default a brick does not do anything.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myId

public Address myId

scaffold

public IScaffold scaffold
The scaffold that might be attached to a brick.

name

public java.lang.String name
The identifier for this Brick. This identifier is used to resolve message names.

topId

public Address topId
An identifying address for the top of the brick as a part of the architecture.

bottomId

public Address bottomId
A identifying address for the bottom of the brick as a part of the architecture. This is not used for a connector as the topId is the only identifier for a connector.

sideId

public Address sideId
A identifying address for the side of the brick as a part of the architecture.
Constructor Detail

Brick

public Brick(java.lang.String str)
A simple constructor to store the components name, and to assign it a unique ID
Method Detail

setNameAfterTheFact

public void setNameAfterTheFact(java.lang.String str)

handle

public abstract void handle(Message m)
Both connectors and components need to handle messages. handle is used to despatch messages in a loosely coupled manner.
Parameters:
m - Message object to be handled

setScaffold

public void setScaffold(IScaffold scaffold)

setTopId

public void setTopId(Address id)
Set the numeric identifier for the top of this brick

getTopId

public Address getTopId()
Get the numeric identifier for top of this brick

setSideId

public void setSideId(Address id)
Set the numeric identifier for the side of this brick

getSideId

public Address getSideId()
Get the numeric identifier for top of this brick

setBottomId

public void setBottomId(Address id)
Set the numeric identifier for the top of this brick

getBottomId

public Address getBottomId()
Get the numeric identifier for the bottom of this brick

start

public void start()
By default a brick does not do anything. The start method is called to activate this brick

fireEvent

public void fireEvent(ArchitectureEvent event)
Fire an event if the architecture has scaffolds
Parameters:
event - Object[] array of event description elements

add

public void add(Message message)
Add a message to the dispatcher
Parameters:
message - Message object to be added

setName

public void setName(java.lang.String n)
Set the name of the component
Parameters:
n - New name of the component