Prism.core
Class Port

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

public class Port
extends Brick
implements IPort

Port represents locus of communication in Prism.

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

Constructor Summary
Port(AbstractScaffold scaffold, int portType)
          This constructor sets the scaffold of this port to scaffold.
Port(int portType)
          This constructor creates an port with default parameters.
Port(int style, int portType)
          This constructor sets the style of this port to style.
Port(java.lang.String name, int portType)
          This constructor sets the name of this port to name.
Port(java.lang.String name, int style, AbstractScaffold scaffold, int portType)
          Initializes the name, style, and scaffold of this port.
 
Method Summary
 ExtensiblePort getExtensiblePort()
          In situations when the Port is actually more specialized and is an ExtensiblePort, this method returns the ExtensiblePort.
 IPort getMutualPort()
          This method returns the mutual port
 IBrick getParentBrick()
          Returns the parent brick of this Port.
 int getPortType()
          Returns the type of port.
 void handle(Event e)
          Passes an event to the parent to be handled.
 void setExtensiblePort(ExtensiblePort pExtPort)
          Sets the reference of this port object to its ExtensiblePort(child).
 void setMutualPort(IPort pPort)
          Sets the mutual port for this port
 void setParentBrick(IBrick pParentBrick)
          Sets the parent brick of this Port.
 
Methods inherited from class Prism.core.Brick
add, getName, getScaffold, getStyle, setName, setScaffold, start
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Prism.core.IBrick
add, getName, getScaffold, getStyle, setName, setScaffold, start
 

Constructor Detail

Port

public Port(int portType)
This constructor creates an port with default parameters.


Port

public Port(java.lang.String name,
            int portType)
This constructor sets the name of this port to name.

Parameters:
name - The name of this port. It cannot be a null value.

Port

public Port(int style,
            int portType)
This constructor sets the style of this port to style.

Parameters:
style - The style of this port.

Port

public Port(AbstractScaffold scaffold,
            int portType)
This constructor sets the scaffold of this port to scaffold.

Parameters:
scaffold - The scaffold of this port.

Port

public Port(java.lang.String name,
            int style,
            AbstractScaffold scaffold,
            int portType)
Initializes the name, style, and scaffold of this port.

Parameters:
name - The name of this port.
style - The style of this port.
scaffold - The scaffold of this port.
Method Detail

handle

public void handle(Event e)
Passes an event to the parent to be handled.

Specified by:
handle in interface IBrick
Specified by:
handle in class Brick

setMutualPort

public void setMutualPort(IPort pPort)
Sets the mutual port for this port

Specified by:
setMutualPort in interface IPort
Parameters:
pPort - Port to be added

getMutualPort

public IPort getMutualPort()
This method returns the mutual port

Specified by:
getMutualPort in interface IPort
Returns:
IPort the mutual port

getPortType

public int getPortType()
Returns the type of port. Request is equivalent to the notion of Top in C2. Reply is equivalent to the notion of Bottom in C2.

Specified by:
getPortType in interface IPort
Returns:
int port type

getParentBrick

public IBrick getParentBrick()
Returns the parent brick of this Port.

Specified by:
getParentBrick in interface IPort
Returns:
Brick parent Brick

setParentBrick

public void setParentBrick(IBrick pParentBrick)
Sets the parent brick of this Port.

Specified by:
setParentBrick in interface IPort

getExtensiblePort

public ExtensiblePort getExtensiblePort()
In situations when the Port is actually more specialized and is an ExtensiblePort, this method returns the ExtensiblePort.

Specified by:
getExtensiblePort in interface IPort
Returns:
ExtensiblePort child ExtensiblePort

setExtensiblePort

public void setExtensiblePort(ExtensiblePort pExtPort)
Sets the reference of this port object to its ExtensiblePort(child).

Specified by:
setExtensiblePort in interface IPort
Parameters:
pExtPort - child ExtensiblePort