Prism.core
Class Component

java.lang.Object
  extended by Prism.core.Brick
      extended by Prism.core.Component
All Implemented Interfaces:
java.io.Serializable, IComponent
Direct Known Subclasses:
ExtensibleComponent

public class Component
extends Brick
implements IComponent, java.io.Serializable

This class defines the basic Prism component and the send methods that allow any class extending this one to interact with the architecture. The usual practice is to create a component in your own architecture by extending this class and implementing the handle method.

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

Field Summary
 
Fields inherited from class Prism.core.Brick
name, scaffold
 
Fields inherited from interface Prism.core.IComponent
CONNS_PER_COMPONENT
 
Constructor Summary
Component(java.lang.String name)
          This constructor calls on the Brick(String) constructor.
Component(java.lang.String name, AbstractImplementation pImplementation)
           
 
Method Summary
 void addCompPort(IPort port)
          Adds a port to this component.
 java.util.Vector getCompPorts()
          This method returns a list of all available ports in this component.
 AbstractImplementation getImplementation()
           
 void handle(Event e)
          Handling of Event.
 void removeCompPort(IPort port)
          Removes a port from this component.
 void send(Event e)
          This method sends the event up/down the Prism architecture that this component is a part of.
 void setImplementation(AbstractImplementation impl)
           
 void start()
          By default a brick does not do anything.
 
Methods inherited from class Prism.core.Brick
add, getStyle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Component

public Component(java.lang.String name)
This constructor calls on the Brick(String) constructor.

Parameters:
name - String: the name of this component object.

Component

public Component(java.lang.String name,
                 AbstractImplementation pImplementation)
Method Detail

start

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

Overrides:
start in class Brick

setImplementation

public void setImplementation(AbstractImplementation impl)

getImplementation

public AbstractImplementation getImplementation()

send

public void send(Event e)
This method sends the event up/down the Prism architecture that this component is a part of.

Specified by:
send in interface IComponent
Parameters:
e - a Event to be sent to the Brick above/below.

handle

public void handle(Event e)
Handling of Event. This is application specific code and should be implemented by subclasses of this class.

Specified by:
handle in interface IComponent
Specified by:
handle in class Brick
Parameters:
e - Event to be handled

addCompPort

public void addCompPort(IPort port)
Adds a port to this component.

Specified by:
addCompPort in interface IComponent
Parameters:
port - Port to be added.

removeCompPort

public void removeCompPort(IPort port)
Removes a port from this component.

Specified by:
removeCompPort in interface IComponent
Parameters:
port - Port to be removed.

getCompPorts

public java.util.Vector getCompPorts()
This method returns a list of all available ports in this component.

Specified by:
getCompPorts in interface IComponent
Returns:
DynamicArray List of available ports