Holger's
Java API

com.antelmann.game.quiz
Class Question

java.lang.Object
  extended by com.antelmann.game.quiz.Question
All Implemented Interfaces:
Serializable

public class Question
extends Object
implements Serializable

Author:
Holger Antelmann
See Also:
Serialized Form

Field Summary
static int NO_CORRECT_ANSWER
           
 
Constructor Summary
Question(String display, int answer, long timeout, String... option)
          constructor for a quiz question
Question(String display, int answer, String... option)
           
 
Method Summary
 boolean equals(Object obj)
          based on getDisplay()
 int getAnswer()
           
 String getDisplay()
           
 String[] getOptions()
           
 long getTimeout()
          denotes the time allowed to answer the question (in milliseconds)
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_CORRECT_ANSWER

public static final int NO_CORRECT_ANSWER
See Also:
Constant Field Values
Constructor Detail

Question

public Question(String display,
                int answer,
                String... option)
         throws IllegalArgumentException
Throws:
IllegalArgumentException

Question

public Question(String display,
                int answer,
                long timeout,
                String... option)
         throws IllegalArgumentException
constructor for a quiz question

Parameters:
display - the question to be asked
answer - the index of the correct answer within the given options (must be 0 <= index < option.length or NO_CORRECT_ANSWER, if there is no correct answer to the question)
option - an array of possible answers, also containing the correct answer
timeout - time in milliseconds: allowed time to answer the question (a negative number indicates no time limit)
Throws:
IllegalArgumentException
Method Detail

getDisplay

public String getDisplay()

getOptions

public String[] getOptions()

getAnswer

public int getAnswer()

getTimeout

public long getTimeout()
denotes the time allowed to answer the question (in milliseconds)


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
based on getDisplay()

Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads