com.planet_ink.coffee_mud.Common.interfaces
Class Session.TickingCallback

java.lang.Object
  extended by com.planet_ink.coffee_mud.Common.interfaces.Session.InputCallback
      extended by com.planet_ink.coffee_mud.Common.interfaces.Session.TickingCallback
Enclosing interface:
Session

public abstract static class Session.TickingCallback
extends Session.InputCallback


Nested Class Summary
 
Nested classes/interfaces inherited from class com.planet_ink.coffee_mud.Common.interfaces.Session.InputCallback
Session.InputCallback.Type
 
Field Summary
protected  java.lang.StringBuilder collectedInput
           
protected  int counter
           
 
Fields inherited from class com.planet_ink.coffee_mud.Common.interfaces.Session.InputCallback
confirmed, input, noTrim, timeout, timeoutMs, waiting
 
Constructor Summary
Session.TickingCallback(long tickerMs)
          Only constructor is the one to tell out often to call back.
 
Method Summary
 void callBack()
          This method is called if the user hits ENTER, and their input data is valid (one of the choices for CHOOSE or CONFIRM), or anything else for PROMPT.
 void setInput(java.lang.String input)
          Forces user-input into this class, potentially changing its user input waiting state.
 void showPrompt()
          TimeOutCallback has no prompt
abstract  boolean tick(int counter)
          This method id called every ticker ms with an incremented counter.
 void timedOut()
          This method is call by InputCallback if a timeout value greater than 0 is given and that amount of time has been exceeded.
 
Methods inherited from class com.planet_ink.coffee_mud.Common.interfaces.Session.InputCallback
isTimedOut, reset, waitForInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

counter

protected volatile int counter

collectedInput

protected final java.lang.StringBuilder collectedInput
Constructor Detail

Session.TickingCallback

public Session.TickingCallback(long tickerMs)
Only constructor is the one to tell out often to call back.

Parameters:
tickerMs - the time is ms between timeouts
Method Detail

showPrompt

public void showPrompt()
TimeOutCallback has no prompt

Specified by:
showPrompt in class Session.InputCallback

callBack

public void callBack()
Description copied from class: Session.InputCallback
This method is called if the user hits ENTER, and their input data is valid (one of the choices for CHOOSE or CONFIRM), or anything else for PROMPT. If the user has entered nothing, and a default value has been given, the default value is returned. The user entry is available to this method in this.input variable.

Specified by:
callBack in class Session.InputCallback

setInput

public void setInput(java.lang.String input)
Description copied from class: Session.InputCallback
Forces user-input into this class, potentially changing its user input waiting state. If the input is invalid for CONFIRM or CHOOSE, then this will call ShowPrompt and go back to waiting. Otherwise, waiting is set to false and it becomes very likely that callBack() will be called.

Overrides:
setInput in class Session.InputCallback
Parameters:
input - the user input to force

timedOut

public void timedOut()
Description copied from class: Session.InputCallback
This method is call by InputCallback if a timeout value greater than 0 is given and that amount of time has been exceeded.

Specified by:
timedOut in class Session.InputCallback

tick

public abstract boolean tick(int counter)
This method id called every ticker ms with an incremented counter. This is also where you control the process.

Parameters:
counter - the counter, higher than the last time
Returns:
true to keep ticking, false to finally stop.