neosim.iface
Interface Entity

All Known Implementing Classes:
EntityImpl

public interface Entity
extends java.io.Serializable, java.lang.Comparable


Method Summary
 ConnectionID addInConnection(Connection c)
          Add an input connection
 PortID addInPort(EventClass ec)
          Add an input port
 PortID addInPort(java.util.Vector vec)
          Add an input port
 void addOutConnection(PortID outport, Time delay, EntityID dest, PortID destinport)
          Add an output connection from an output port to a given dest
 PortID addOutPort(EventClass ec)
          Add an output port
 PortID addOutPort(java.util.Vector vec)
          Add an output port
 void connect(Time t, Projection p, Callback c)
          Make connections at a given time
 void construct(Time t, PopulationBuilder p, Callback c)
          Build a population at a given time
 void defaultEventHandler(Event e)
          This method deals with built in events, used for querying and updating entity state.
 void deleteInConnection(ConnectionID cid)
          Delete an input connection
 void deleteInPort(PortID inport)
          Delete an input port
 void deleteOutConnection(PortID outport, EntityID dest, PortID destinport)
           
 void deleteOutPort(PortID outport)
          Delete an output port
 void destroy()
          This method is called when the entity is deleted.
 void destroy(Time t, Population p, Callback c)
          Destroy a population at a given time.
 void disconnect(Time t, Projection p, Callback c)
          Delete connections at a given time
 java.util.Vector getClassesOfInPort(PortID pid)
          Return the class of events accepted by an input port
 java.util.Vector getClassesOfOutPort(PortID pid)
          Return the class of events produced by an output port
 EntityClass getEntityClass()
           
 EventList getEventList()
          Return the list of incoming events
 EntityID getID()
           
 java.util.Vector getInConnections(PortID inport)
          Return the input connections to a port
 int getIndex()
           
 Time getLocalTime()
          Get the current local time
 Time getMinOutputDelay()
          Get the minimum output delay
 java.lang.String getName()
           
 NeosimClasses getNeosimClasses()
          Return the set of user defined classes.
 int getNumInConnections(PortID inport)
          Return the number of input connections on a port
 int getNumOutConnections(PortID outport)
          Return the number of output connections from a port
 Population getPopulation()
           
 PopulationTree getPopulationTree(Time t)
          Return the top level population tree.
 Time getRightWindowTime()
          Get the right window time ( local time + o/p delay )
 Time handleEvents(EventList el, Time t)
          User entities MUST extend this method : deal with events in el up to time t, and advance the entity's time to at least t and return the time actually advanced to (which may be later than t, as long as the state can be rewound back to t and no new events are generated after t).
 void init(Population p, int index)
          User entities can extend this method
 EntityClass lookupEntityClass(java.lang.String name)
          Look up an EntityClass object given a name, e.g.
 EntityID lookupEntityID(Time t, java.lang.String name)
          Look up an Entity handle given a name, e.g.
 Population lookupPopulation(Time t, java.lang.String name)
          Look up a Population given a name, e.g.
 void queryEntity(Time t, EntityID e, EntityQuery eq, Callback c)
          Query another entity at a given time
 void queryOutputConnections(Time t, PortID p, ConnectionQuery cq, Callback cb)
          Query output connections of a port
 void queryPopulation(Time t, Population p, EntityQuery eq, Callback c)
          Query a population of entities at a given time
 void reset()
          This method is called when simulation time is rest to zero.
 void resetOutputDelay()
          Set output delay to its previous value
 void sendEvent(EntityID deste, PortID destp, Event e)
          This method sends an event to input port p of entity deste.
 void sendEvent(PortID c, Event e)
          This method sends an event from output port c.
 void setDstConnectionParams(Connection c, ConnectionID destcid, java.util.Hashtable params)
          Set additional connection parameters at dst end Called by ParamConnectionSpec.setDstParams
 void setMinOutputDelay(Time t)
          Set the minimum output delay
 void setSrcConnectionParams(Connection c, PortID srcpid, java.util.Hashtable params)
          Set additional connection parameters at src end Called by ParamConnectionSpec.setSrcParams
 void trace(java.lang.String msg)
          Write a trace message
 void updateEntity(Time t, EntityID e, EntityUpdate eu, Callback c)
          Update another entity at a given time
 void updatePopulation(Time t, Population p, EntityUpdate eu, Callback c)
          Update a population of entities at a given time
 void zeroOutputDelay()
          Zero delay on system output port
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

init

public void init(Population p,
                 int index)
User entities can extend this method

handleEvents

public Time handleEvents(EventList el,
                         Time t)
User entities MUST extend this method : deal with events in el up to time t, and advance the entity's time to at least t and return the time actually advanced to (which may be later than t, as long as the state can be rewound back to t and no new events are generated after t). If the event type of incoming events is not recognised, the method defaultEventHandler() should be called.
Parameters:
el - The (possible empty) event list in time stamp order
t - The time to advance to
Returns:
the time actually advanced to (must be >= t)
See Also:
defaultEventHandler(neosim.iface.Event)

reset

public void reset()
This method is called when simulation time is rest to zero. User entities can extend this method to perform a local reset.

destroy

public void destroy()
This method is called when the entity is deleted. User entities can extend this to remove any locally allocated storage.

sendEvent

public void sendEvent(PortID c,
                      Event e)
This method sends an event from output port c.
Parameters:
c - The output port to send the event to.
e - The event to send. Its timestamp should be the sending time

sendEvent

public void sendEvent(EntityID deste,
                      PortID destp,
                      Event e)
This method sends an event to input port p of entity deste.
Parameters:
deste - The destination entity
destp - The destination input port
e - The event to send. Its timestamp should be the sending time

defaultEventHandler

public void defaultEventHandler(Event e)
This method deals with built in events, used for querying and updating entity state.
Parameters:
e - The event to handle

getPopulation

public Population getPopulation()
Returns:
the population this entity was created in.

getIndex

public int getIndex()
Returns:
the index of this entity in its population/

getEntityClass

public EntityClass getEntityClass()
Returns:
the class of this entity.

getID

public EntityID getID()
Returns:
the ID of this entity.

getName

public java.lang.String getName()
Returns:
the name pf this entity.

getPopulationTree

public PopulationTree getPopulationTree(Time t)
Return the top level population tree.
Parameters:
t - the time of the request (needed as the population tree changes with time)
Returns:
the top level population tree

getNeosimClasses

public NeosimClasses getNeosimClasses()
Return the set of user defined classes.
Returns:
the set of user classes.

lookupEntityClass

public EntityClass lookupEntityClass(java.lang.String name)
Look up an EntityClass object given a name, e.g. "CompartmentalEntity"
Parameters:
name - The fully qualified name of the class
Returns:
the entity class, if found, or null if not.

lookupEntityID

public EntityID lookupEntityID(Time t,
                               java.lang.String name)
Look up an Entity handle given a name, e.g. "cortex.layer1.pyramidal1234"
Parameters:
t - The time of the request
name - The fully qualified name of the entity
Returns:
the entity handle, if found, or null if not.

lookupPopulation

public Population lookupPopulation(Time t,
                                   java.lang.String name)
Look up a Population given a name, e.g. "cortex.layer1"
Parameters:
t - The time of the request
name - The fully qualified name of the population
Returns:
the population if found, or null if not.

construct

public void construct(Time t,
                      PopulationBuilder p,
                      Callback c)
Build a population at a given time
Parameters:
t - the time to build the population ( must be >= localTime() + getMinOutputDelay())
p - the population to build
c - the callback to call when the population has been built.

destroy

public void destroy(Time t,
                    Population p,
                    Callback c)
Destroy a population at a given time. Calls every member's destroy() method.
Parameters:
t - the time to build the population ( must be >= localTime() + getMinOutputDelay())
p - the population to destroy
c - the callback to call when the population has been destroyed

connect

public void connect(Time t,
                    Projection p,
                    Callback c)
Make connections at a given time
Parameters:
t - the time to make the connections ( must be >= localTime() + getMinOutputDelay())
p - the projection to make
c - the callback to call when the connections have been made

disconnect

public void disconnect(Time t,
                       Projection p,
                       Callback c)
Delete connections at a given time
Parameters:
t - the time to delete the connections ( must be >= localTime() + getMinOutputDelay())
p - the population to destroy
c - the callback to call when the population has been destroyed

updateEntity

public void updateEntity(Time t,
                         EntityID e,
                         EntityUpdate eu,
                         Callback c)
Update another entity at a given time
Parameters:
t - the time to update the entity ( must be >= localTime() + getMinOutputDelay())
e - the handle of the entity to update
eu - the update to perform
c - the callback to call when the update has been done

queryEntity

public void queryEntity(Time t,
                        EntityID e,
                        EntityQuery eq,
                        Callback c)
Query another entity at a given time
Parameters:
t - the time to query the entity ( must be >= localTime() + getMinOutputDelay())
e - the handle of the entity to query
eq - the query to perform
c - the callback to call with the results of the query

updatePopulation

public void updatePopulation(Time t,
                             Population p,
                             EntityUpdate eu,
                             Callback c)
Update a population of entities at a given time
Parameters:
t - the time to update the entity ( must be >= localTime() + getMinOutputDelay())
p - the population to update
eu - the update to perform
c - the callback to call when the update has been done

queryPopulation

public void queryPopulation(Time t,
                            Population p,
                            EntityQuery eq,
                            Callback c)
Query a population of entities at a given time
Parameters:
t - the time to query the population( must be >= localTime() + getMinOutputDelay())
p - the population to query
eq - the query to perform
c - the callback to call with the results of the query. The results will be in the form of a vector of objects, indexed by entities' index in the population.

queryOutputConnections

public void queryOutputConnections(Time t,
                                   PortID p,
                                   ConnectionQuery cq,
                                   Callback cb)
Query output connections of a port
Parameters:
t - the time to query the connections( must be >= localTime() + getMinOutputDelay())
p - the output port
cq - the query to run on each output connection
c - the callback to call with the results of the query. The results will be in the form of a vector of objects, ordered by entity handle/input connection id.

addOutPort

public PortID addOutPort(java.util.Vector vec)
Add an output port
Parameters:
vec - the vector of EventClass events the port generates
Returns:
the id of the output port (from 1..#output ports).

addOutPort

public PortID addOutPort(EventClass ec)
Add an output port
Parameters:
ec - the EventClass the port generates
Returns:
the id of the output port (from 1..#output ports).

addInPort

public PortID addInPort(EventClass ec)
Add an input port
Parameters:
ec - the EventClass the port accepts

addInPort

public PortID addInPort(java.util.Vector vec)
Add an input port
Parameters:
vec - the vector of EventClass the port accepts
Returns:
the id of the input port (from 1..#input ports).

getClassesOfInPort

public java.util.Vector getClassesOfInPort(PortID pid)
Return the class of events accepted by an input port
Parameters:
pid - the input port id
Returns:
the vector of EventClass

getClassesOfOutPort

public java.util.Vector getClassesOfOutPort(PortID pid)
Return the class of events produced by an output port
Parameters:
pid - the output port id
Returns:
the classes of events produced

getNumInConnections

public int getNumInConnections(PortID inport)
Return the number of input connections on a port
Parameters:
inport - the input port id
Returns:
the number of connections

getNumOutConnections

public int getNumOutConnections(PortID outport)
Return the number of output connections from a port
Parameters:
outport - the output port id
Returns:
the number of connections

getInConnections

public java.util.Vector getInConnections(PortID inport)
Return the input connections to a port
Parameters:
outport - the output port id
Returns:
the number of connections

addOutConnection

public void addOutConnection(PortID outport,
                             Time delay,
                             EntityID dest,
                             PortID destinport)
Add an output connection from an output port to a given dest
Parameters:
outport - the output port id
delay - the delay on the connection
dest - the destination entity
destinport - the destination port id

deleteOutConnection

public void deleteOutConnection(PortID outport,
                                EntityID dest,
                                PortID destinport)

addInConnection

public ConnectionID addInConnection(Connection c)
Add an input connection
Parameters:
c - the input connection to add

setSrcConnectionParams

public void setSrcConnectionParams(Connection c,
                                   PortID srcpid,
                                   java.util.Hashtable params)
Set additional connection parameters at src end Called by ParamConnectionSpec.setSrcParams

setDstConnectionParams

public void setDstConnectionParams(Connection c,
                                   ConnectionID destcid,
                                   java.util.Hashtable params)
Set additional connection parameters at dst end Called by ParamConnectionSpec.setDstParams

deleteInConnection

public void deleteInConnection(ConnectionID cid)
Delete an input connection
Parameters:
cid - the input connection to delete

deleteInPort

public void deleteInPort(PortID inport)
Delete an input port
Parameters:
inport - the input port id

deleteOutPort

public void deleteOutPort(PortID outport)
Delete an output port
Parameters:
inport - the input port id

getEventList

public EventList getEventList()
Return the list of incoming events

zeroOutputDelay

public void zeroOutputDelay()
Zero delay on system output port

resetOutputDelay

public void resetOutputDelay()
Set output delay to its previous value

getMinOutputDelay

public Time getMinOutputDelay()
Get the minimum output delay

setMinOutputDelay

public void setMinOutputDelay(Time t)
Set the minimum output delay

getRightWindowTime

public Time getRightWindowTime()
Get the right window time ( local time + o/p delay )

getLocalTime

public Time getLocalTime()
Get the current local time

trace

public void trace(java.lang.String msg)
Write a trace message