heurgame.event
Class RoundRobinIterator

java.lang.Object
  extended byheurgame.event.RoundRobinIterator
All Implemented Interfaces:
LogWriter

public class RoundRobinIterator
extends java.lang.Object
implements LogWriter

Author:
David Kaplin TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Field Summary
protected  int currentRound
           
protected  PlayerToken currentToken
           
protected  java.util.Vector latestTokens
           
protected  java.util.Vector mylisteners
           
protected  java.util.Vector normalLog
           
protected  java.util.ListIterator playerHelper
           
protected  java.util.Vector playerTokens
           
protected  int totalRounds
           
protected  java.util.Vector urgentLog
           
 
Constructor Summary
RoundRobinIterator()
           
 
Method Summary
 void addTurnListener(TurnListener t)
          Adds a Turn Listener to be notified of changes
 java.util.List getEntries()
          This is the normal method for adding information to the log.
 java.lang.String getLogName()
          Usually a particular LogWriter is going to send more than one message to the log during the life of a program.
 boolean hasMore()
           
protected  void logState(java.lang.String shortMessage)
           
 void next()
           
 void removeAllTurnListeners()
           
 void removeTurnListener(TurnListener t)
          Removes a Turn Listener
 void setup(int totalRounds, java.util.Vector pTokens)
           
 void updateActiveTokens(java.util.Vector newTokens)
           
 java.util.List urgentEntries()
          Normally logs are stored in a FIFO manner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mylisteners

protected java.util.Vector mylisteners

normalLog

protected java.util.Vector normalLog

urgentLog

protected java.util.Vector urgentLog

playerTokens

protected java.util.Vector playerTokens

currentRound

protected int currentRound

totalRounds

protected int totalRounds

playerHelper

protected java.util.ListIterator playerHelper

currentToken

protected PlayerToken currentToken

latestTokens

protected java.util.Vector latestTokens
Constructor Detail

RoundRobinIterator

public RoundRobinIterator()
Method Detail

setup

public void setup(int totalRounds,
                  java.util.Vector pTokens)

addTurnListener

public void addTurnListener(TurnListener t)
Adds a Turn Listener to be notified of changes

Parameters:
t - to be added

removeTurnListener

public void removeTurnListener(TurnListener t)
Removes a Turn Listener

Parameters:
t - to be removed

removeAllTurnListeners

public void removeAllTurnListeners()

next

public void next()

hasMore

public boolean hasMore()

updateActiveTokens

public void updateActiveTokens(java.util.Vector newTokens)

logState

protected void logState(java.lang.String shortMessage)

getLogName

public java.lang.String getLogName()
Description copied from interface: LogWriter
Usually a particular LogWriter is going to send more than one message to the log during the life of a program. To avoid constantly sending the sender's name during updates a LogWriter should identify itself through this message.

Specified by:
getLogName in interface LogWriter
Returns:
Descriptive name of the reporting component.
See Also:
LogWriter.getLogName()

getEntries

public java.util.List getEntries()
Description copied from interface: LogWriter
This is the normal method for adding information to the log.

Specified by:
getEntries in interface LogWriter
See Also:
LogWriter.getEntries()

urgentEntries

public java.util.List urgentEntries()
Description copied from interface: LogWriter
Normally logs are stored in a FIFO manner. Using this method will give your message the opportunity to reach the highest point in the log.

Specified by:
urgentEntries in interface LogWriter
Returns:
A List of urgent entires for the log
See Also:
LogWriter.urgentEntries()