edu.jhu.cs.oose.elevel.dataModel
Class Card

java.lang.Object
  extended by edu.jhu.cs.oose.elevel.dataModel.Card
All Implemented Interfaces:
java.io.Serializable

public class Card
extends java.lang.Object
implements java.io.Serializable

Card represents the high-level intuition of a flash card. Card represents a single card in a Deck and maintains all the features of a real flash-card as well as additional, computer-only possibilities.

Author:
Jesse Yates, H. Parker Shelton
See Also:
Serialized Form

Field Summary
 java.lang.String answer
          A String representing the answer associated with this Card
 java.lang.String question
          A String representing the question associated with this Card
 
Constructor Summary
Card()
          Instantiates a new Card
Card(java.lang.String q, java.lang.String a, java.lang.String h, java.lang.String i)
          Instantiates a Card with the specified parameters.
 
Method Summary
 boolean checkAnswer(java.lang.String a)
          Compares the provided String with this Card's correct answer
 boolean equals(Card other)
          a comparison on hash codes
 java.lang.String getAdditionalInfo()
          Returns the additional information associated with this card
 java.lang.String getAnswer()
          Returns the answer associated with this Card
 java.lang.String getHint()
          Get this Card's current hint
 int getID()
          gets the card's deck-dependent ID.
 java.util.Map<java.lang.String,java.lang.Boolean> getOptions()
          Gets the cards options
 java.lang.String getQuestion()
          Returns this Card's question
 int hashCode()
          Computes the hash code of this card based on its question, answer, hint, additional information, and options fields.
 void setAdditionalInfo(java.lang.String i)
          Sets the additional information associated with this card to the specified String
 void setHint(java.lang.String h)
          Sets the hint associated with this card to the specified String
 void setSetting(java.lang.String key, java.lang.Boolean value)
          Set the provided setting.
 void setValues(java.lang.String q, java.lang.String a, java.lang.String h, java.lang.String i, java.util.Map<java.lang.String,java.lang.Boolean> pref)
          Set the values of this Card
 java.lang.String toString()
          Writes out the properties of the card
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

question

public java.lang.String question
A String representing the question associated with this Card


answer

public java.lang.String answer
A String representing the answer associated with this Card

Constructor Detail

Card

public Card()
Instantiates a new Card


Card

public Card(java.lang.String q,
            java.lang.String a,
            java.lang.String h,
            java.lang.String i)
Instantiates a Card with the specified parameters.

Parameters:
q - a String representing the question associated with this Card
a - a String representing the answer associated with this Card
h - a String representing the hint associated with this Card
i - a String representing the additional information associated with this Card
Method Detail

checkAnswer

public boolean checkAnswer(java.lang.String a)
Compares the provided String with this Card's correct answer

Parameters:
a - a String representing the provided answer
Returns:
true if the answer sent matches, false otherwise

equals

public boolean equals(Card other)
a comparison on hash codes

Parameters:
other - the card to be compared to this card
Returns:
true if this card's hashcode equals other's hashcode, false otherwise.

getID

public int getID()
gets the card's deck-dependent ID.

Returns:
the ID

getAdditionalInfo

public java.lang.String getAdditionalInfo()
Returns the additional information associated with this card

Returns:
a String representing the additional information associated with this Card

getAnswer

public java.lang.String getAnswer()
Returns the answer associated with this Card

Returns:
a String representing this Card's answer

getHint

public java.lang.String getHint()
Get this Card's current hint

Returns:
The current hint

getOptions

public java.util.Map<java.lang.String,java.lang.Boolean> getOptions()
Gets the cards options

Returns:
A map from strings (options) to boolean values (enabled vs disabled).

getQuestion

public java.lang.String getQuestion()
Returns this Card's question

Returns:
the question

hashCode

public int hashCode()
Computes the hash code of this card based on its question, answer, hint, additional information, and options fields.

Overrides:
hashCode in class java.lang.Object

setAdditionalInfo

public void setAdditionalInfo(java.lang.String i)
Sets the additional information associated with this card to the specified String

Parameters:
i - a String representing the card's additional information

setHint

public void setHint(java.lang.String h)
Sets the hint associated with this card to the specified String

Parameters:
h - a String representing the card's hint

setSetting

public void setSetting(java.lang.String key,
                       java.lang.Boolean value)
Set the provided setting. Update the setting if it already exists.

Parameters:
key - The setting name
value - the Boolean value

setValues

public void setValues(java.lang.String q,
                      java.lang.String a,
                      java.lang.String h,
                      java.lang.String i,
                      java.util.Map<java.lang.String,java.lang.Boolean> pref)
Set the values of this Card

Parameters:
q - a String representing the question associated with this Card
a - a String representing the answer associated with this Card
h - a String representing the hint associated with this Card
i - a String representing the additional information associated with this Card
pref - A Map representing the options associated with this Card

toString

public java.lang.String toString()
Writes out the properties of the card

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()