net.sf.colossus.appmain
Class Start

java.lang.Object
  extended by net.sf.colossus.appmain.Start

public final class Start
extends java.lang.Object

Class Start contains code to start the different types of games.

Author:
David Ripton, Clemens Katzer (rewritten big parts of the main() method)

Field Summary
private  CmdLine cmdLine
           
private static java.util.logging.Logger LOGGER
           
private  Options startOptions
           
private  WhatNextManager whatNextManager
           
 
Constructor Summary
Start(java.lang.String[] args)
          To create the one "Start" object which handles initiates the "whatToDoNext" action according to what the user wants.
 
Method Summary
private  void commandLineProcessing(java.lang.String[] args)
          Prepare the "Opts" object to parse all options from command line.
 Options getStartOptions()
           
 WhatNextManager getWhatNextManager()
           
 WhatNextManager.WhatToDoNext getWhatToDoNext()
           
static void main(java.lang.String[] args)
           
private  void runGetPlayersDialogAndWait(Options options)
          Bring up the GetPlayers dialog, and then wait until is has set startObject to the next action to do and notified us to continue.
private  void runNetClientDialogAndWait()
           
 void setInitialAction(Options serverOptions, Options netclientOptions)
          Based on command line options -c, -w, possibly -g, set startObject to the right "whatToDoNext" action and set in startOptions the related values.
private  void setupAndLoop()
          Do the setup of the various Options objects (server, netclient), some more preparations, and then it stays in the loop which - waits for user input what to do next - initiates that action and waits until it completes (or if canceled, like closing the network client dialog, bring up back the main (=GetPlayers) dialog, or if user requests Quit, exit the loop; and when it exited the loop control will return back to main() and the JVM should terminate sooner or later ;-)
private  boolean setupOptionsFromCommandLine(CmdLine cl, Options startOptions, Options options)
           
private  boolean startNetClient(Options startOptions)
           
private static void usage(Opts opts)
          Print a usage string to stdout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

cmdLine

private CmdLine cmdLine

whatNextManager

private final WhatNextManager whatNextManager

startOptions

private final Options startOptions
Constructor Detail

Start

public Start(java.lang.String[] args)
To create the one "Start" object which handles initiates the "whatToDoNext" action according to what the user wants. Brings up one of the dialogs, or starts a Game, a Network client or a Web Client.

Method Detail

getStartOptions

public Options getStartOptions()

getWhatNextManager

public WhatNextManager getWhatNextManager()

getWhatToDoNext

public WhatNextManager.WhatToDoNext getWhatToDoNext()

usage

private static void usage(Opts opts)
Print a usage string to stdout. (*Not* to the logfile, where casual users will miss it.)


commandLineProcessing

private void commandLineProcessing(java.lang.String[] args)
Prepare the "Opts" object to parse all options from command line. As result, creates/sets the instance variable CmdLine object "cmdLine" from which one can then query which options were set, and their value if they require one.

Parameters:
args - The String-Array given to main()

setInitialAction

public void setInitialAction(Options serverOptions,
                             Options netclientOptions)
Based on command line options -c, -w, possibly -g, set startObject to the right "whatToDoNext" action and set in startOptions the related values. Expects that server (cf) options are already loaded.


runGetPlayersDialogAndWait

private void runGetPlayersDialogAndWait(Options options)
Bring up the GetPlayers dialog, and then wait until is has set startObject to the next action to do and notified us to continue.

Parameters:
options - The "server side" main options Object which holds the information what kind of game to play next (variant, which players) and the "Game options" for the to-be-started game, like unlimitedMulligans, viewmode, balancedTowers, ...)

setupOptionsFromCommandLine

private boolean setupOptionsFromCommandLine(CmdLine cl,
                                            Options startOptions,
                                            Options options)

setupAndLoop

private void setupAndLoop()
Do the setup of the various Options objects (server, netclient), some more preparations, and then it stays in the loop which - waits for user input what to do next - initiates that action and waits until it completes (or if canceled, like closing the network client dialog, bring up back the main (=GetPlayers) dialog, or if user requests Quit, exit the loop; and when it exited the loop control will return back to main() and the JVM should terminate sooner or later ;-)


runNetClientDialogAndWait

private void runNetClientDialogAndWait()

startNetClient

private boolean startNetClient(Options startOptions)

main

public static void main(java.lang.String[] args)