com.planet_ink.coffee_mud.core.interfaces
Interface TickableGroup

All Superinterfaces:
CMRunnable, java.lang.Runnable
All Known Implementing Classes:
StdTickGroup

public interface TickableGroup
extends CMRunnable

This class represents a thread, consisting of a group of Tickable objects receiving periodic calls to their tick(Tickable,int) methods by this thread object

See Also:
Tickable, Tickable.tick(Tickable, int)

Method Summary
 void addTicker(TickClient C)
          Adds another ticking object to this group
 boolean contains(Tickable T, int tickID)
          Returns true if this group contains the given ticking object with the given tickID.
 boolean delTicker(TickClient C)
          Removes the given ticking object from this group
 TickClient fetchTickerByIndex(int i)
          Returns the tickclient at the given index from 0 to numTickers
 java.lang.Thread getCurrentThread()
          If this group is currently getting thread time, this will return a reference to that thread object, or null otherwise.
 long getLastStartTime()
          Returns the time, in ms, that this object last ticked.
 long getLastStopTime()
          Returns the time, in ms, that this object last stopped ticking.
 TickClient getLastTicked()
          Returns the current or last TickClient object which this thread made a tick(Tickable,int) method call to.
 java.util.Iterator<TickClient> getLocalItems(int itemTypes, Room R)
          Returns an iterator of all the items of the given type in the given room.
 long getMilliTotal()
          Returns the number of ms that this object has ticked in total
 java.lang.String getName()
          Returns the name of this group
 long getNextTickTime()
          Returns the next time, in ms, when this group should tick.
 java.lang.String getStatus()
          Returns the displayable status of this ticking object
 java.lang.String getThreadGroupName()
          Returns the name of the thread group that this ticking group belongs to (and thus, under which it should run later)
 long getTickInterval()
          Returns the amount of time, in ms, between calls to this group
 java.util.Iterator<TickClient> getTickSet(Tickable T, int tickID)
          Returns an iterator of all clients matching the given criteria
 long getTickTotal()
          Returns the number of times that this object has ticked in total
 boolean isAwake()
          Returns true if this group currently is getting thread time
 boolean isSolitaryTicker()
          Returns whether this group is only permitted a single object
 int numTickers()
          Returns the number of ticking objects in this group
 void shutdown()
          Orders this group to do any necessary cleanup before going away.
 java.util.Iterator<TickClient> tickers()
          Returns an iterator of all the ticking objects
 
Methods inherited from interface com.planet_ink.coffee_mud.core.threads.CMRunnable
activeTimeMillis, getGroupID, getStartTime
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

getLastTicked

TickClient getLastTicked()
Returns the current or last TickClient object which this thread made a tick(Tickable,int) method call to.

Returns:
the TickClient object last accessed
See Also:
Tickable, Tickable.tick(Tickable, int)

getName

java.lang.String getName()
Returns the name of this group

Returns:
the name

getTickInterval

long getTickInterval()
Returns the amount of time, in ms, between calls to this group

Returns:
the time between ticks

getNextTickTime

long getNextTickTime()
Returns the next time, in ms, when this group should tick.

Returns:
the next time, in ms, when this group should tick.

shutdown

void shutdown()
Orders this group to do any necessary cleanup before going away.


addTicker

void addTicker(TickClient C)
Adds another ticking object to this group

Parameters:
C - the client to add
See Also:
TickClient

delTicker

boolean delTicker(TickClient C)
Removes the given ticking object from this group

Parameters:
C - the client to remove
Returns:
whether anything was deleted.
See Also:
TickClient

tickers

java.util.Iterator<TickClient> tickers()
Returns an iterator of all the ticking objects

Returns:
an iterator of all the ticking objects

numTickers

int numTickers()
Returns the number of ticking objects in this group

Returns:
the number of ticking objects in this group

getTickSet

java.util.Iterator<TickClient> getTickSet(Tickable T,
                                          int tickID)
Returns an iterator of all clients matching the given criteria

Parameters:
T - the tickable object to look for
tickID - the tickid to match, or -1 for all
Returns:
an iterator of all clients matching the given criteria

getLocalItems

java.util.Iterator<TickClient> getLocalItems(int itemTypes,
                                             Room R)
Returns an iterator of all the items of the given type in the given room.

Parameters:
itemTypes - 0=mobs or items, 1=items, 2=mobs
R - the room to look in
Returns:
an iterator of all the items of the given type in the given room.

contains

boolean contains(Tickable T,
                 int tickID)
Returns true if this group contains the given ticking object with the given tickID.

Parameters:
T - the tickable object
tickID - the tickid to match, or -1 for any
Returns:
true if its in here, false otherwise

fetchTickerByIndex

TickClient fetchTickerByIndex(int i)
Returns the tickclient at the given index from 0 to numTickers

Parameters:
i - the index
Returns:
the tickclient, or null
See Also:
numTickers()

getStatus

java.lang.String getStatus()
Returns the displayable status of this ticking object

Returns:
the displayable status of this ticking object

getLastStartTime

long getLastStartTime()
Returns the time, in ms, that this object last ticked.

Returns:
the time, in ms, that this object last ticked.

getLastStopTime

long getLastStopTime()
Returns the time, in ms, that this object last stopped ticking.

Returns:
the time, in ms, that this object last stopped ticking

getMilliTotal

long getMilliTotal()
Returns the number of ms that this object has ticked in total

Returns:
the number of ms that this object has ticked in total

getTickTotal

long getTickTotal()
Returns the number of times that this object has ticked in total

Returns:
the number of times that this object has ticked in total

isSolitaryTicker

boolean isSolitaryTicker()
Returns whether this group is only permitted a single object

Returns:
true if this group is only permitted a single object

isAwake

boolean isAwake()
Returns true if this group currently is getting thread time

Returns:
true if this group currently is getting thread time

getThreadGroupName

java.lang.String getThreadGroupName()
Returns the name of the thread group that this ticking group belongs to (and thus, under which it should run later)

Returns:
the name of the thread group

getCurrentThread

java.lang.Thread getCurrentThread()
If this group is currently getting thread time, this will return a reference to that thread object, or null otherwise.

Returns:
the thread currently giving this group time, or null