net.thestump.ghronos.timing.ot
Class OvertimeStyle

java.lang.Object
  extended bynet.thestump.ghronos.timing.TimingStyle
      extended bynet.thestump.ghronos.timing.ot.OvertimeStyle
All Implemented Interfaces:
superwaba.ext.xplat.io.Storable
Direct Known Subclasses:
CanadianBY, JapaneseBY, Scrabble

public abstract class OvertimeStyle
extends TimingStyle

Base class for overtime-oriented timing styles

Author:
Christopher C. Stump

Field Summary
protected  boolean bottomClockInOt
           
protected  boolean clockIsInOvertime
           
protected  boolean isAppliedTo
           
protected  byte[] overtime
           
protected  boolean topClockInOt
           
protected  boolean topClockIsTicking
           
 
Fields inherited from class net.thestump.ghronos.timing.TimingStyle
appliedToBottomClock, appliedToTopClock, toStart, toStop
 
Constructor Summary
OvertimeStyle()
           
 
Method Summary
protected  void evaluate(Clock topClock, Clock bottomClock)
          Helper method used to set members describing current state
abstract  void execute(Clock tickingClock)
          Runs an overtime check on tickingClock when it runs out of time to see if it should go into overtime or not
abstract  void execute(Clock topClock, Clock bottomClock)
          Applies the timing style to the appropriate clocks on a clock switch
abstract  byte getID()
           
abstract  superwaba.ext.xplat.io.Storable getInstance()
           
 byte[] getOvertime()
          Returns an array of the current overtime.
 boolean isInOvertime(char clock)
          Tells if a clock is currently in overtime
 void loadState(superwaba.ext.xplat.io.DataStream ds)
           
 void reset()
          Perform any resetting the timing style may need in between usages.
 void saveState(superwaba.ext.xplat.io.DataStream ds)
           
 void setOvertime(byte[] ot)
          Sets the overtime to the time given in the array.
 void setOvertime(char clock, boolean inOvertime)
          Sets the overtime state of a clock
 
Methods inherited from class net.thestump.ghronos.timing.TimingStyle
applyTo, getDescription, isAppliedTo, onRegister, onUnRegister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

overtime

protected byte[] overtime

topClockInOt

protected boolean topClockInOt

bottomClockInOt

protected boolean bottomClockInOt

topClockIsTicking

protected boolean topClockIsTicking

clockIsInOvertime

protected boolean clockIsInOvertime

isAppliedTo

protected boolean isAppliedTo
Constructor Detail

OvertimeStyle

public OvertimeStyle()
Method Detail

execute

public abstract void execute(Clock tickingClock)
Runs an overtime check on tickingClock when it runs out of time to see if it should go into overtime or not

Parameters:
tickingClock - The currently ticking clock which should be checked for overtime

reset

public void reset()
Perform any resetting the timing style may need in between usages.


getOvertime

public byte[] getOvertime()
Returns an array of the current overtime. Array index[0] is the first hour digit, index[2] is the first minute digit, etc.

Returns:
An array of length 6 with the current overtime

setOvertime

public void setOvertime(byte[] ot)
Sets the overtime to the time given in the array. Array index[0] is the first hour digit, index[2] is the first minute digit, etc.

Parameters:
ot - The time to be set
Throws:
BadArgumentException - If ot is not of length 6

setOvertime

public void setOvertime(char clock,
                        boolean inOvertime)
Sets the overtime state of a clock

Parameters:
clock - 't' if we want to configure the top clock, 'b' if we want to configure the bottom clock
inOvertime - true if clock should be in overtime, false otherwise
Throws:
BadArgumentException - If clock is not 't' or 'b'

isInOvertime

public boolean isInOvertime(char clock)
Tells if a clock is currently in overtime

Parameters:
clock - 't' if we want to test for the top clock, 'b' if we want to test for the bottom clock
Returns:
true if the queried clock is in overtime, false otherwise
Throws:
BadArgumentException - If clock is not 't' or 'b'

execute

public abstract void execute(Clock topClock,
                             Clock bottomClock)
Description copied from class: TimingStyle
Applies the timing style to the appropriate clocks on a clock switch

Specified by:
execute in class TimingStyle
Parameters:
topClock - The application's top clock
bottomClock - The application's bottom clock

getID

public abstract byte getID()
Specified by:
getID in interface superwaba.ext.xplat.io.Storable
Specified by:
getID in class TimingStyle

getInstance

public abstract superwaba.ext.xplat.io.Storable getInstance()
Specified by:
getInstance in interface superwaba.ext.xplat.io.Storable
Specified by:
getInstance in class TimingStyle

saveState

public void saveState(superwaba.ext.xplat.io.DataStream ds)
Specified by:
saveState in interface superwaba.ext.xplat.io.Storable
Overrides:
saveState in class TimingStyle

loadState

public void loadState(superwaba.ext.xplat.io.DataStream ds)
Specified by:
loadState in interface superwaba.ext.xplat.io.Storable
Overrides:
loadState in class TimingStyle

evaluate

protected void evaluate(Clock topClock,
                        Clock bottomClock)
Description copied from class: TimingStyle
Helper method used to set members describing current state

Overrides:
evaluate in class TimingStyle
Parameters:
topClock - The application's topmost clock
bottomClock - The application's bottommost clock


Copyright © 2004 Christopher C. Stump. All Rights Reserved.