com.blackledge.david.game.crossword
Class QuizlandCrossword

java.lang.Object
  extended by com.blackledge.david.game.crossword.QuizlandCrossword
All Implemented Interfaces:
CrosswordSource
Direct Known Subclasses:
QuizlandHardCrossword

public class QuizlandCrossword
extends Object
implements CrosswordSource

Interface to download the quizland crossword-of-the-day data and build a CrosswordPuzzle object with that data.

Version:
$Revision: 1.4 $

Constructor Summary
QuizlandCrossword()
           
 
Method Summary
 CrosswordPuzzle getGame()
          Return the game object.
protected  URL getGridURL()
           
 HashMap getParamMap()
          All the params of the quizland page
 String getPuzzleId()
          Returns a unique id (if available) representing the current puzzle.
protected  String getUrlContent(URL _url, String contentTypeSubstring)
           
 void load()
          Load the quizland crossword-of-the-day into the game object and validate it.
 void load(String puzzleId)
          Load the source into the game object and validate it.
static void main(String[] args)
          Simple main to show it work and spit it out to the command line.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuizlandCrossword

public QuizlandCrossword()
Method Detail

main

public static void main(String[] args)
Simple main to show it work and spit it out to the command line.

Parameters:
args -

getGame

public CrosswordPuzzle getGame()
Return the game object. Called after CrosswordSource.load()

Specified by:
getGame in interface CrosswordSource
Returns:
the game object
See Also:
CrosswordSource.getGame()

getParamMap

public HashMap getParamMap()
All the params of the quizland page

Specified by:
getParamMap in interface CrosswordSource
Returns:
hashmap of name to value
See Also:
CrosswordSource.getParamMap()

toString

public String toString()
Overrides:
toString in class Object

load

public void load()
Load the quizland crossword-of-the-day into the game object and validate it.

Specified by:
load in interface CrosswordSource
See Also:
CrosswordSource.load()

getGridURL

protected URL getGridURL()
                  throws MalformedURLException,
                         IOException
Throws:
MalformedURLException
IOException

getUrlContent

protected String getUrlContent(URL _url,
                               String contentTypeSubstring)
                        throws IOException
Throws:
IOException

getPuzzleId

public String getPuzzleId()
Description copied from interface: CrosswordSource
Returns a unique id (if available) representing the current puzzle. If passed to CrosswordSource.load(String), this same puzzle will be loaded at that time.

Specified by:
getPuzzleId in interface CrosswordSource
Returns:
a String, or null if one is not available.

load

public void load(String puzzleId)
Description copied from interface: CrosswordSource
Load the source into the game object and validate it.

Specified by:
load in interface CrosswordSource
Parameters:
puzzleId - a string previuosly returned from CrosswordSource.getPuzzleId() for this source.