Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class neosim.implementation.NeosimEntityImpl

java.lang.Object
  |
  +--neosim.implementation.NeosimEntityImpl

public class NeosimEntityImpl
extends java.lang.Object
implements NeosimEntity

Constructor Summary
NeosimEntityImpl(EntityClass ec, Population p, int index)
          Make an entity of population p, class ec, handle h
 
Method Summary
ConnectionID addInConnection(Connection c)
          Add an input connection
PortID addInPort(EventClass ec)
          Add an input port
void addOutConnection(PortID outport, Time delay, EntityHandle dest, PortID destinport)
          Add an output connection from an output port to a given dest
PortID addOutPort(EventClass ec)
          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, EntityHandle 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
EventClass getClassOfInPort(PortID pid)
          Return the class of events accepted by an input port
EventClass getClassOfOutPort(PortID pid)
          Return the class of events produced by an output port
EntityClass getEntityClass()
           
EventList getEventList()
          Get EventList
EntityHandle getHandle()
           
java.util.Vector getInConnections(PortID inport)
          Return the input connections to a port
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 getNumInPorts()
           
int getNumOutConnections(PortID outport)
          Return the number of output connections from a port
int getNumOutPorts()
           
neosim.kernel.OutPortTable getOutConnection(PortID outport)
           
Population getPopulation()
           
PopulationTree getPopulationTree(Time t)
          Return the top level population tree.
Time getRightWindowTime()
          Get the right window time
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.
EntityHandle lookupEntity(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 postEvent(Event e)
          Post event, connection id is coded in event.
void queryEntity(Time t, EntityHandle e, EntityQuery eq, Callback c)
          Query another entity at a given time
void queryOutputConnections(Time t, PortID p, ConnectionQuery cq, Callback cb)
           
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(PortID c, Event e)
          This method sends an event on output port c.
void sendEvent(EntityHandle deste, PortID destp, Event e)
          This method sends an event to input port p of entity e.
void setHandle(EntityHandle h)
          Sets the handle of this entity.
void setLocalTime(Time t)
          Set the current local time
void setMinOutputDelay(Time t)
          Set the minimum output delay
void setProvLocalTime(Time t)
          Set the provisional local time
void trace(java.lang.String msg)
           
void updateEntity(Time t, EntityHandle 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

NeosimEntityImpl

public NeosimEntityImpl(EntityClass ec,
                        Population p,
                        int index)
Make an entity of population p, class ec, handle h
Method Detail

init

public void init(Population p,
                 int index)
User entities can extend this method
Specified by:
init in interface NeosimEntity

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.
Specified by:
handleEvents in interface NeosimEntity
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

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.
Specified by:
reset in interface NeosimEntity

destroy

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

sendEvent

public final void sendEvent(PortID c,
                            Event e)
This method sends an event on output port c.
Specified by:
sendEvent in interface NeosimEntity
Parameters:
c - The output port to send the event to.
e - The event to send. Its timestamp should be the sending time

sendEvent

public final void sendEvent(EntityHandle deste,
                            PortID destp,
                            Event e)
This method sends an event to input port p of entity e.
Specified by:
sendEvent in interface NeosimEntity
Parameters:
c - The output port to send the event from.
deste - The destination entity
destp - The destination input port
e - The event to send. Its timestamp should be the sending time

defaultEventHandler

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

getPopulation

public final Population getPopulation()
Description copied from interface:
 
Specified by:
getPopulation in interface NeosimEntity
Returns:
the population this entity was created in.

getEntityClass

public final EntityClass getEntityClass()
Description copied from interface:
 
Specified by:
getEntityClass in interface NeosimEntity
Returns:
the class of this entity.

getHandle

public final EntityHandle getHandle()
Description copied from interface:
 
Specified by:
getHandle in interface NeosimEntity
Returns:
the handle of this entity.

setHandle

public final void setHandle(EntityHandle h)
Sets the handle of this entity.
Parameters:
h - the new handle

getName

public final java.lang.String getName()
Description copied from interface:
 
Specified by:
getName in interface NeosimEntity

getPopulationTree

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

getNeosimClasses

public final NeosimClasses getNeosimClasses()
Return the set of user defined classes.
Specified by:
getNeosimClasses in interface NeosimEntity
Returns:
the set of user classes.

lookupEntityClass

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

lookupEntity

public final EntityHandle lookupEntity(Time t,
                                       java.lang.String name)
Look up an Entity handle given a name, e.g. "cortex.layer1.pyramidal1234"
Specified by:
lookupEntity in interface NeosimEntity
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 final Population lookupPopulation(Time t,
                                         java.lang.String name)
Look up a Population given a name, e.g. "cortex.layer1"
Specified by:
lookupPopulation in interface NeosimEntity
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 final void construct(Time t,
                            PopulationBuilder p,
                            Callback c)
Build a population at a given time
Specified by:
construct in interface NeosimEntity
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 final void destroy(Time t,
                          Population p,
                          Callback c)
Destroy a population at a given time. Calls every member's destroy() method.
Specified by:
destroy in interface NeosimEntity
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 final void connect(Time t,
                          Projection p,
                          Callback c)
Make connections at a given time
Specified by:
connect in interface NeosimEntity
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 final void disconnect(Time t,
                             Projection p,
                             Callback c)
Delete connections at a given time
Specified by:
disconnect in interface NeosimEntity
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 final void updateEntity(Time t,
                               EntityHandle e,
                               EntityUpdate eu,
                               Callback c)
Update another entity at a given time
Specified by:
updateEntity in interface NeosimEntity
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 final void queryEntity(Time t,
                              EntityHandle e,
                              EntityQuery eq,
                              Callback c)
Query another entity at a given time
Specified by:
queryEntity in interface NeosimEntity
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 final void updatePopulation(Time t,
                                   Population p,
                                   EntityUpdate eu,
                                   Callback c)
Update a population of entities at a given time
Specified by:
updatePopulation in interface NeosimEntity
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 final void queryPopulation(Time t,
                                  Population p,
                                  EntityQuery eq,
                                  Callback c)
Query a population of entities at a given time
Specified by:
queryPopulation in interface NeosimEntity
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 entties' index in the population.

queryOutputConnections

public final void queryOutputConnections(Time t,
                                         PortID p,
                                         ConnectionQuery cq,
                                         Callback cb)
Description copied from interface:
Query output connections of a port
Specified by:
queryOutputConnections in interface NeosimEntity

addOutPort

public final PortID addOutPort(EventClass ec)
Add an output port
Specified by:
addOutPort in interface NeosimEntity
Parameters:
ec - the class of events the port generates
Returns:
the id of the output port (from 1..#output ports).

addInPort

public final PortID addInPort(EventClass ec)
Add an input port
Specified by:
addInPort in interface NeosimEntity
Parameters:
ec - the class of events the port accepts
Returns:
the id of the input port (from 1..#input ports).

getClassOfInPort

public final EventClass getClassOfInPort(PortID pid)
Return the class of events accepted by an input port
Specified by:
getClassOfInPort in interface NeosimEntity
Parameters:
pid - the input port id
Returns:
the class of events

getClassOfOutPort

public final EventClass getClassOfOutPort(PortID pid)
Return the class of events produced by an output port
Specified by:
getClassOfOutPort in interface NeosimEntity
Parameters:
pid - the output port id
Returns:
the class of events

getNumInConnections

public final int getNumInConnections(PortID inport)
Return the number of input connections on a port
Specified by:
getNumInConnections in interface NeosimEntity
Parameters:
inport - the input port id
Returns:
the number of connections

getNumOutConnections

public final int getNumOutConnections(PortID outport)
Return the number of output connections from a port
Specified by:
getNumOutConnections in interface NeosimEntity
Parameters:
outport - the output port id
Returns:
the number of connections

getOutConnection

public final neosim.kernel.OutPortTable getOutConnection(PortID outport)

getNumOutPorts

public final int getNumOutPorts()

getNumInPorts

public final int getNumInPorts()

getInConnections

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

addOutConnection

public final void addOutConnection(PortID outport,
                                   Time delay,
                                   EntityHandle dest,
                                   PortID destinport)
Add an output connection from an output port to a given dest
Specified by:
addOutConnection in interface NeosimEntity
Parameters:
outport - the output port id
delay - the delay on the connection
dest - the destination entity
destinport - the destination port id

deleteOutConnection

public final void deleteOutConnection(PortID outport,
                                      EntityHandle dest,
                                      PortID destinport)
Description copied from interface:
 
Specified by:
deleteOutConnection in interface NeosimEntity

addInConnection

public final ConnectionID addInConnection(Connection c)
Add an input connection
Specified by:
addInConnection in interface NeosimEntity
Parameters:
c - the input connection to add
Returns:
the connection id

deleteInConnection

public final void deleteInConnection(ConnectionID cid)
Delete an input connection
Specified by:
deleteInConnection in interface NeosimEntity
Parameters:
cid - the input connection to delete

deleteInPort

public final void deleteInPort(PortID inport)
Delete an input port
Specified by:
deleteInPort in interface NeosimEntity
Parameters:
inport - the input port id

deleteOutPort

public final void deleteOutPort(PortID outport)
Delete an output port
Specified by:
deleteOutPort in interface NeosimEntity
Parameters:
inport - the input port id

zeroOutputDelay

public final void zeroOutputDelay()
Zero delay on system output port
Specified by:
zeroOutputDelay in interface NeosimEntity

resetOutputDelay

public void resetOutputDelay()
Set output delay to its previous value
Specified by:
resetOutputDelay in interface NeosimEntity

getMinOutputDelay

public Time getMinOutputDelay()
Get the minimum output delay
Specified by:
getMinOutputDelay in interface NeosimEntity

setMinOutputDelay

public void setMinOutputDelay(Time t)
Set the minimum output delay
Specified by:
setMinOutputDelay in interface NeosimEntity

getLocalTime

public Time getLocalTime()
Get the current local time
Specified by:
getLocalTime in interface NeosimEntity

setLocalTime

public void setLocalTime(Time t)
Set the current local time

setProvLocalTime

public void setProvLocalTime(Time t)
Set the provisional local time

getRightWindowTime

public Time getRightWindowTime()
Get the right window time
Specified by:
getRightWindowTime in interface NeosimEntity

getEventList

public EventList getEventList()
Get EventList
Specified by:
getEventList in interface NeosimEntity

postEvent

public void postEvent(Event e)
Post event, connection id is coded in event.

trace

public void trace(java.lang.String msg)
Description copied from interface:
Write a trace message
Specified by:
trace in interface NeosimEntity

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD