com.jdwsoftware.wfh.model
Class GameType

java.lang.Object
  |
  +--com.jdwsoftware.wfh.model.GameType
Direct Known Subclasses:
ColorGame, MathGame, NumberGame

public abstract class GameType
extends java.lang.Object

Title: Woody's Fishing Hole

Description: Educational Fishing Game

Copyright: Copyright (C) 2003 JDW Software, LLC

Company: JDW Software, LLC

This is the abstract class that all the various game types extend. The basic premise is that a game has an answer which is shown near the top of the screen, and many questions. Each fish will get a question (and hopefully at least one fish will have the correct answer.. :)

For many games the questions and answers are the same (blue box to blue box or the number 8 to the number 8). However the MathGame will display a math problem for the question and numbers for the answers. Other things like pictures matching to words or upper case letters to lower case letters are easily added also.

Version:
$Revision: 1.4 $
Author:
Jim Woodgate

Field Summary
protected  javax.swing.JComponent _caller
           
protected static int BORDER
           
protected static int HEIGHT
           
protected static int WIDTH
           
 
Constructor Summary
GameType(javax.swing.JComponent caller)
          Default constructor, note the component that is going to use this game needs to register itself so images can be created.
 
Method Summary
abstract  java.lang.String getAnswer()
          Get the string representation of the answer to getQuestion()
abstract  java.awt.Image getAnswer(java.lang.String s)
          Given an answer string, get the corresponding image to put on the fish.
 int getHeight()
          In general the height of all the questions, because these will actually go on the fish, this method probably shouldn't be overriden unless you really know what you are doing.
abstract  java.awt.Image getQuestion()
          Get the question image this is to be displayed on the passed component
abstract  java.lang.String[] getValidAnswers()
          Get a set of all possible answers.
 int getWidth()
          In general the width of all the questions, because these will actually go on the fish, this method probably shouldn't be overriden unless you really know what you are doing.
abstract  void newQuestion()
          Call new question to generate a new question and answer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_caller

protected javax.swing.JComponent _caller

WIDTH

protected static final int WIDTH
See Also:
Constant Field Values

HEIGHT

protected static final int HEIGHT
See Also:
Constant Field Values

BORDER

protected static final int BORDER
See Also:
Constant Field Values
Constructor Detail

GameType

public GameType(javax.swing.JComponent caller)
Default constructor, note the component that is going to use this game needs to register itself so images can be created.

Parameters:
caller -
Method Detail

getWidth

public int getWidth()
In general the width of all the questions, because these will actually go on the fish, this method probably shouldn't be overriden unless you really know what you are doing.

Returns:
Default question width

getHeight

public int getHeight()
In general the height of all the questions, because these will actually go on the fish, this method probably shouldn't be overriden unless you really know what you are doing.

Returns:
Default question height

getQuestion

public abstract java.awt.Image getQuestion()
Get the question image this is to be displayed on the passed component

Returns:
an image of the question

getAnswer

public abstract java.lang.String getAnswer()
Get the string representation of the answer to getQuestion()

Returns:
String answer

getValidAnswers

public abstract java.lang.String[] getValidAnswers()
Get a set of all possible answers. This is a set of string answers.

Returns:
Set of all possible answers

getAnswer

public abstract java.awt.Image getAnswer(java.lang.String s)
Given an answer string, get the corresponding image to put on the fish.

Parameters:
s - Answer
Returns:
Image for that answer

newQuestion

public abstract void newQuestion()
Call new question to generate a new question and answer