TickableGroup
, CMRunnable
, java.lang.Cloneable
, java.lang.Runnable
public class StdTickGroup extends java.lang.Object implements TickableGroup, java.lang.Cloneable
TickableGroup.LocalType
Constructor | Description |
---|---|
StdTickGroup(long sleep,
java.lang.String threadGroupName,
boolean isSolitary) |
|
StdTickGroup(ThreadEngine theEngine,
long sleep,
java.lang.String threadGroupName,
boolean isSolitary) |
|
StdTickGroup(java.lang.String a_name,
long sleep,
java.lang.String threadGroupName,
boolean isSolitary) |
Modifier and Type | Method | Description |
---|---|---|
long |
activeTimeMillis() |
Returns the number of milliseconds this runnable
has been running.
|
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.
|
StdTickGroup |
copyOf() |
|
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
|
int |
getCounter() |
|
java.lang.Thread |
getCurrentThread() |
If this group is currently getting thread time, this will
return a reference to that thread object, or null otherwise.
|
int |
getGroupID() |
The group identifier for this runnable, which may be used
for executor selection
|
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(TickableGroup.LocalType 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.
|
long |
getStartTime() |
Either the time this runnable did start running, or
will start running, depending on whether it's scheduled
|
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 |
run() |
|
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
|
public StdTickGroup(long sleep, java.lang.String threadGroupName, boolean isSolitary)
public StdTickGroup(java.lang.String a_name, long sleep, java.lang.String threadGroupName, boolean isSolitary)
public StdTickGroup(ThreadEngine theEngine, long sleep, java.lang.String threadGroupName, boolean isSolitary)
public StdTickGroup copyOf()
public long getStartTime()
CMRunnable
getStartTime
in interface CMRunnable
public int getGroupID()
CMRunnable
getGroupID
in interface CMRunnable
public TickClient fetchTickerByIndex(int i)
TickableGroup
fetchTickerByIndex
in interface TickableGroup
i
- the indexTickableGroup.numTickers()
public java.lang.Thread getCurrentThread()
TickableGroup
getCurrentThread
in interface TickableGroup
public java.lang.String getThreadGroupName()
TickableGroup
getThreadGroupName
in interface TickableGroup
public long getLastStartTime()
TickableGroup
getLastStartTime
in interface TickableGroup
public long getLastStopTime()
TickableGroup
getLastStopTime
in interface TickableGroup
public long getMilliTotal()
TickableGroup
getMilliTotal
in interface TickableGroup
public long getTickTotal()
TickableGroup
getTickTotal
in interface TickableGroup
public boolean isSolitaryTicker()
TickableGroup
isSolitaryTicker
in interface TickableGroup
public boolean isAwake()
TickableGroup
isAwake
in interface TickableGroup
public java.util.Iterator<TickClient> tickers()
TickableGroup
tickers
in interface TickableGroup
public int numTickers()
TickableGroup
numTickers
in interface TickableGroup
public java.util.Iterator<TickClient> getTickSet(Tickable T, int tickID)
TickableGroup
getTickSet
in interface TickableGroup
T
- the tickable object to look fortickID
- the tickid to match, or -1 for allpublic java.util.Iterator<TickClient> getLocalItems(TickableGroup.LocalType itemTypes, Room R)
TickableGroup
getLocalItems
in interface TickableGroup
itemTypes
- 0=mobs or items, 1=items, 2=mobsR
- the room to look inpublic java.lang.String getName()
TickableGroup
getName
in interface TickableGroup
public long getTickInterval()
TickableGroup
getTickInterval
in interface TickableGroup
public long getNextTickTime()
TickableGroup
getNextTickTime
in interface TickableGroup
public boolean contains(Tickable T, int tickID)
TickableGroup
contains
in interface TickableGroup
T
- the tickable objecttickID
- the tickid to match, or -1 for anypublic int getCounter()
public boolean delTicker(TickClient C)
TickableGroup
delTicker
in interface TickableGroup
C
- the client to removeTickClient
public void addTicker(TickClient C)
TickableGroup
addTicker
in interface TickableGroup
C
- the client to addTickClient
public TickClient getLastTicked()
TickableGroup
getLastTicked
in interface TickableGroup
Tickable
,
Tickable.tick(Tickable, int)
public java.lang.String getStatus()
TickableGroup
getStatus
in interface TickableGroup
public void shutdown()
TickableGroup
shutdown
in interface TickableGroup
public void run()
run
in interface java.lang.Runnable
public long activeTimeMillis()
CMRunnable
activeTimeMillis
in interface CMRunnable