org.dartra.standard.visitor
Class LastCompletedGameVisitor

java.lang.Object
  extended byorg.dartra.standard.visitor.LastCompletedGameVisitor
All Implemented Interfaces:
GameVisitor

public class LastCompletedGameVisitor
extends java.lang.Object
implements GameVisitor

Visitor that searches for the last completed game (or set) at every level of the game-match tree. A completed game is a game where the winner has been determined.

Author:
Erwin Vervaet

Constructor Summary
LastCompletedGameVisitor()
           
 
Method Summary
 Game getLastCompletedGame(int level)
          Returns the last completed game at given level of the game-match tree.
 int getMaxLevel()
          Returns the level number for the game-match tree.
 void visitGame(Game game)
          Process game data.
 void visitMatch(Match match)
          Process match data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LastCompletedGameVisitor

public LastCompletedGameVisitor()
Method Detail

visitGame

public void visitGame(Game game)
Description copied from interface: GameVisitor

Process game data.

Specified by:
visitGame in interface GameVisitor

visitMatch

public void visitMatch(Match match)
Description copied from interface: GameVisitor

Process match data.

Specified by:
visitMatch in interface GameVisitor

getLastCompletedGame

public Game getLastCompletedGame(int level)

Returns the last completed game at given level of the game-match tree. When no corresponding game can be found, null is returned.


getMaxLevel

public int getMaxLevel()

Returns the level number for the game-match tree. For instance, for a game/set/match system, this would be 2.