neosim.implementation
Class EntityClassImpl

java.lang.Object
  |
  +--neosim.implementation.NeosimClassImpl
        |
        +--neosim.implementation.EntityClassImpl

public class EntityClassImpl
extends NeosimClassImpl
implements EntityClass

See Also:
Serialized Form

Constructor Summary
EntityClassImpl()
           
EntityClassImpl(java.lang.String name)
           
 
Method Summary
 PortID addInPort(EventClass ec)
           
 PortID addInPort(EventClass ec, java.lang.String name)
          Add an input port to the class.
 PortID addOutPort(EventClass ec)
           
 PortID addOutPort(EventClass ec, java.lang.String name)
          Add an output port to the class.
 PortID getInPort(java.lang.String name)
          Get an input port given a name.
 java.util.Vector getInPorts()
           
 PortID getOutPort(java.lang.String name)
          Get an output port given a name
 java.util.Vector getOutPorts()
           
 void init(java.lang.String name, java.util.Hashtable args)
          Initialise from a bean
 void init(java.lang.String name, java.lang.String args)
          Deprecated. - use hashtable args instead
 void initModule(ScriptReader sr)
          If this entity requires extra global initialisation (e.g.
 Entity makeEntity(Population p, int index)
          An EntityClass must provide a method to create an instance of the class
 
Methods inherited from class neosim.implementation.NeosimClassImpl
getClassID, getName, getPackage, getParent, isAssignableFrom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityClassImpl

public EntityClassImpl(java.lang.String name)

EntityClassImpl

public EntityClassImpl()
Method Detail

init

public void init(java.lang.String name,
                 java.lang.String args)
Deprecated. - use hashtable args instead

Initialise from a bean
Specified by:
init in interface EntityClass

init

public void init(java.lang.String name,
                 java.util.Hashtable args)
Initialise from a bean
Specified by:
init in interface EntityClass
Tags copied from interface: EntityClass
Parameters:
name - the name of the entity class
args - string name/value pairs for arguments

makeEntity

public Entity makeEntity(Population p,
                         int index)
Description copied from interface: EntityClass
An EntityClass must provide a method to create an instance of the class
Specified by:
makeEntity in interface EntityClass
Tags copied from interface: EntityClass
Parameters:
p - the population the entity will be part of
index - the index in the population

addOutPort

public PortID addOutPort(EventClass ec)
Specified by:
addOutPort in interface EntityClass

addOutPort

public PortID addOutPort(EventClass ec,
                         java.lang.String name)
Description copied from interface: EntityClass
Add an output port to the class. This port will be valid for all entity instances of the class.
Specified by:
addOutPort in interface EntityClass
Tags copied from interface: EntityClass
Parameters:
ec - the class of events the port generates
name - the name of the port (optional)
Returns:
the id of the output port (from 1..#output ports).

addInPort

public PortID addInPort(EventClass ec)
Specified by:
addInPort in interface EntityClass

addInPort

public PortID addInPort(EventClass ec,
                        java.lang.String name)
Description copied from interface: EntityClass
Add an input port to the class. This port will be valid for all entity instances of the class.
Specified by:
addInPort in interface EntityClass
Tags copied from interface: EntityClass
Parameters:
ec - the class of events the port accepts
name - the name of the port (optional)
Returns:
the id of the input port (from 1..#input ports).

getOutPort

public PortID getOutPort(java.lang.String name)
Description copied from interface: EntityClass
Get an output port given a name
Specified by:
getOutPort in interface EntityClass
Tags copied from interface: EntityClass
Parameters:
name - the name of the port
Returns:
the id of the port

getInPort

public PortID getInPort(java.lang.String name)
Description copied from interface: EntityClass
Get an input port given a name. By default ports are named "in1, in2, ..." and "out1, out2, ..."
Specified by:
getInPort in interface EntityClass
Tags copied from interface: EntityClass
Parameters:
name - the name of the port
Returns:
the id of the port

getOutPorts

public java.util.Vector getOutPorts()
Specified by:
getOutPorts in interface EntityClass

getInPorts

public java.util.Vector getInPorts()
Specified by:
getInPorts in interface EntityClass

initModule

public void initModule(ScriptReader sr)
Description copied from interface: EntityClass
If this entity requires extra global initialisation (e.g. if it requires installing a C++ libxxx.so file on all processors) this method can be overridden to initialise the module. It is likely that this mechanism will be replaced by something more elegant.
Specified by:
initModule in interface EntityClass
Tags copied from interface: EntityClass
Parameters:
sr - the calling script reader