Prism.core
Class Brick

java.lang.Object
  extended by Prism.core.Brick
All Implemented Interfaces:
java.io.Serializable, IBrick
Direct Known Subclasses:
Architecture, Component, Connector, Port

public abstract class Brick
extends java.lang.Object
implements java.io.Serializable, IBrick

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

Version:
2.0
Author:
USC Soft. Arch. Group. Contact: Sam Malek malek@usc.edu
See Also:
Serialized Form

Constructor Summary
Brick()
          This constructor creates a brick with default name, style, and scaffold.
Brick(AbstractScaffold scaffold)
          A simple constructor to store the brick scaffold.
Brick(int style)
          A simple constructor to store the brick style.
Brick(java.lang.String name)
          A simple constructor to store the brick name.
Brick(java.lang.String name, int style, AbstractScaffold scaffold)
          Initializes the name, style, and scaffold of the brick.
 
Method Summary
 void add(Event event)
          Add a message to the scaffold which results in a message getting added to the scaffold's queue.
 java.lang.String getName()
           
 AbstractScaffold getScaffold()
           
 int getStyle()
           
abstract  void handle(Event e)
          This abstract method needs to be overriden by any object that extends Brick.
 void setName(java.lang.String name)
           
 void setScaffold(AbstractScaffold scaffold)
           
 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
 

Constructor Detail

Brick

public Brick()
This constructor creates a brick with default name, style, and scaffold.


Brick

public Brick(java.lang.String name)
A simple constructor to store the brick name.

Parameters:
name - Name of the brick.

Brick

public Brick(int style)
A simple constructor to store the brick style.

Parameters:
style - Style of the brick.

Brick

public Brick(AbstractScaffold scaffold)
A simple constructor to store the brick scaffold.

Parameters:
scaffold - Scaffold of the brick.

Brick

public Brick(java.lang.String name,
             int style,
             AbstractScaffold scaffold)
Initializes the name, style, and scaffold of the brick.

Parameters:
name - Name of the brick.
style - Style of the brick.
scaffold - Scaffold of the brick.
Method Detail

start

public void start()
Description copied from interface: IBrick
By default a brick does not do anything. The start method is called to activate this brick

Specified by:
start in interface IBrick

add

public void add(Event event)
Description copied from interface: IBrick
Add a message to the scaffold which results in a message getting added to the scaffold's queue.

Specified by:
add in interface IBrick
Parameters:
event - Event object to be added

handle

public abstract void handle(Event e)
Description copied from interface: IBrick
This abstract method needs to be overriden by any object that extends Brick. The subclassing object shall provide the desired implementation to handle an Event.

Specified by:
handle in interface IBrick

setScaffold

public void setScaffold(AbstractScaffold scaffold)
Specified by:
setScaffold in interface IBrick

getScaffold

public AbstractScaffold getScaffold()
Specified by:
getScaffold in interface IBrick

setName

public void setName(java.lang.String name)
Specified by:
setName in interface IBrick

getName

public java.lang.String getName()
Specified by:
getName in interface IBrick

getStyle

public int getStyle()
Specified by:
getStyle in interface IBrick