java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
edu.mit.media.hive.agent.AgentImpl
edu.mit.media.hive.agent.EventReceivingAgentImpl
edu.mit.media.hive.agent.filter.MovingAverageAgentImpl
- All Implemented Interfaces:
- edu.mit.media.hive.agent.Agent, edu.mit.media.hive.rdf.Describable, EventFloatTranslatingAgent, java.util.EventListener, edu.mit.media.hive.agent.EventReceivingAgent, edu.mit.media.hive.agent.FloatSourceAgent, java.rmi.Remote, edu.mit.media.hive.event.RemoteEventListener, java.io.Serializable
- public class MovingAverageAgentImpl
- extends edu.mit.media.hive.agent.EventReceivingAgentImpl
- implements EventFloatTranslatingAgent
Chaining agent - takes in event input from an agent, produces a
time average. This has two parameters - how many milliseconds to
remember, and how many milliseconds to average over. If
historyLength is 300000 and averageWindow is 10000, then what we
get is a 5 minute moving average of the number of events per 10
seconds.
Fields inherited from class edu.mit.media.hive.agent.AgentImpl |
AGENTKILLED, AGENTMOVED, agentThreadGroup, commandList, commands, description, icon, iconName, myCell, readyFlag, stopCode, timeToStop |
Methods inherited from class edu.mit.media.hive.agent.AgentImpl |
addActionCommand, blockUntilReady, configure, doBehaviour, doLocalCleanup, getActionCommands, getCell, getComponentManagerShadow, getDescription, getIcon, getIconName, getName, getThreadGroup, invokeActionCommand, isReady, isTimeToStop, listAllOutgoingConnections, loadIcon, moveTo, onDying, onMoving, setCell, setDescription, setIconName, setIsReady, setThreadGroup, setTimeToStop, waitUntilDeath |
Methods inherited from interface edu.mit.media.hive.agent.Agent |
blockUntilReady, configure, connectTo, diePlease, disconnectFrom, disconnectFromAll, getActionCommands, getCell, getDescription, getIcon, getName, invokeActionCommand, isReady, listAllIncomingConnections, listAllOutgoingConnections |
eventCounts
protected int[] eventCounts
eventCountScan
protected int eventCountScan
lastValidNumber
protected int lastValidNumber
movingAverage
protected float movingAverage
historyLength
protected int historyLength
averageWindow
protected int averageWindow
MovingAverageAgentImpl
public MovingAverageAgentImpl()
throws java.rmi.RemoteException
doLocalSetup
public void doLocalSetup()
- Description copied from class:
edu.mit.media.hive.agent.AgentImpl
- Handle the setup when an agent arrives on a host -- it is
appropriate to allocate system resources (file descriptors,
etc) here and even to locate other agents that this agent needs
to communicate with.
This method replaces arriveAt
setAverageWindow
public void setAverageWindow(int aw)
setHistoryLength
public void setHistoryLength(int hl)
buildEventCounts
protected void buildEventCounts()
doBehavior
public void doBehavior()
- Description copied from class:
edu.mit.media.hive.agent.AgentImpl
- Do the basic behavior for an agent, the agent's main loop.
Override this to provide your particular agent's behavior.
Note: the doBehavior loop should not exit. Please call
waitUntilDeath() at the end of this method, this will prevent
the Cell from believing this agent prematurely exited.
updateAverage
protected void updateAverage()
getFloat
public float getFloat(edu.mit.media.hive.agent.Agent sender)
- Specified by:
getFloat
in interface edu.mit.media.hive.agent.FloatSourceAgent
notify
public void notify(edu.mit.media.hive.event.HiveEvent event)
- Description copied from interface:
edu.mit.media.hive.agent.EventReceivingAgent
- Called when an event is sent from a source.
- Specified by:
notify
in interface edu.mit.media.hive.agent.EventReceivingAgent
getAverageWindow
public int getAverageWindow()
getHistoryLength
public int getHistoryLength()