m3g10
Class Card

java.lang.Object
  extended by m3g10.Card

public class Card
extends java.lang.Object

Data related to a card in the memory game.

Author:
Claus Hoefele

Field Summary
private  java.lang.String description
          The card's description.
private  boolean isMatched
          Flag whether card was succesfully matched.
private  boolean isOpen
          State of the card.
private  boolean isTrigger
          Whether this card triggers an action.
private  int keyCode
          Key code to open/close a card.
private  javax.microedition.m3g.Mesh mesh
          Mesh object representing the look of the card.
private static int USER_PARAM_DESCRIPTION
          User parameter for description.
private static int USER_PARAM_KEYCODE
          User parameter for key code.
private static int USER_PARAM_TRIGGER
          User parameter for trigger.
 
Constructor Summary
Card(javax.microedition.m3g.Mesh mesh)
          Creates a new card with information from the mesh's user object.
 
Method Summary
 java.lang.String getDescription()
          Getter for description.
 int getKeyCode()
          Getter for key code.
 javax.microedition.m3g.Mesh getMesh()
          Getter for mesh.
static boolean isCard(javax.microedition.m3g.Object3D object)
          Checks whether a scene object is a card.
 boolean isMatch(Card card)
          Checks if this card pairs with the given card.
 boolean isMatched()
          Getter for match flag.
 boolean isOpen()
          Getter for card state.
 boolean isTrigger()
          Getter for action trigger.
 void setKeyCode(int keyCode)
          Setter for key code.
 void setMatched(boolean isMatched)
          Setter for match flag.
 void setOpen(boolean isOpen)
          Opens (image is visible) or closes (cover is visible) a card.
 void swap(Card card)
          Swaps places between this card and the given card.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_PARAM_KEYCODE

private static final int USER_PARAM_KEYCODE
User parameter for key code.

See Also:
Constant Field Values

USER_PARAM_DESCRIPTION

private static final int USER_PARAM_DESCRIPTION
User parameter for description.

See Also:
Constant Field Values

USER_PARAM_TRIGGER

private static final int USER_PARAM_TRIGGER
User parameter for trigger.

See Also:
Constant Field Values

mesh

private javax.microedition.m3g.Mesh mesh
Mesh object representing the look of the card.


isOpen

private boolean isOpen
State of the card.


isMatched

private boolean isMatched
Flag whether card was succesfully matched.


keyCode

private int keyCode
Key code to open/close a card.


description

private java.lang.String description
The card's description.


isTrigger

private boolean isTrigger
Whether this card triggers an action.

Constructor Detail

Card

public Card(javax.microedition.m3g.Mesh mesh)
Creates a new card with information from the mesh's user object.

Parameters:
mesh - mesh object of the card.
Method Detail

setOpen

public void setOpen(boolean isOpen)
Opens (image is visible) or closes (cover is visible) a card.

Parameters:
isOpen - state of the card.

swap

public void swap(Card card)
Swaps places between this card and the given card.

Parameters:
card - second card involved in the process.

isMatch

public boolean isMatch(Card card)
Checks if this card pairs with the given card.

Parameters:
card - second card involved in the process.
Returns:
true if cards match.

isCard

public static boolean isCard(javax.microedition.m3g.Object3D object)
Checks whether a scene object is a card.

Parameters:
object - object to check.
Returns:
true if object is a card.

getKeyCode

public int getKeyCode()
Getter for key code.

Returns:
key code.

setKeyCode

public void setKeyCode(int keyCode)
Setter for key code.

Parameters:
keyCode - key code.

getDescription

public java.lang.String getDescription()
Getter for description.

Returns:
description.

isOpen

public boolean isOpen()
Getter for card state.

Returns:
card state.

getMesh

public javax.microedition.m3g.Mesh getMesh()
Getter for mesh.

Returns:
mesh.

isTrigger

public boolean isTrigger()
Getter for action trigger.

Returns:
trigger value.

isMatched

public boolean isMatched()
Getter for match flag.

Returns:
flag.

setMatched

public void setMatched(boolean isMatched)
Setter for match flag.

Parameters:
isMatched - flag.