org.cb.jset
Class CardProperties

java.lang.Object
  extended byorg.cb.jset.CardProperties
All Implemented Interfaces:
java.io.Serializable

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

Represents a card used in the game.

A card has 4 properties: a type, a color, a number of shapes and a number of fills. Each property has 3 different values, making for 81 different cards in the game.

Version:
$Id: CardProperties.java 129 2004-04-15 05:00:43Z jerome $
Author:
jerome@coffeebreaks.org - last modified by $LastChangedBy: jerome $
See Also:
Serialized Form

Field Summary
static int CARDSNB
          Number of cards.
static int COLOR_BLUE
           
static int COLOR_GREEN
           
static int COLOR_RED
           
static int FILL_DOTTED
           
static int FILL_EMPTY
           
static int FILL_FULL
           
static int SHAPE_ODD
           
static int SHAPE_OVALE
           
static int SHAPE_RECTANGLE
           
 
Constructor Summary
CardProperties(byte shape, byte color, byte number, byte fill)
          Creates a new instance of CardProperties, given the specified shape, color number and fill.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
static CardProperties findCard(CardProperties card)
           
static CardProperties getCard(int idx)
          Get the card given the specified index.
 byte getColor()
           
 byte getFill()
           
 byte getNumber()
           
 byte getShape()
           
 int hashCode()
           
 java.lang.String toString()
           
static java.lang.String toString(CardProperties[] cards)
          A helper function that generates a String representation for the specified array of CardProperties.
static java.lang.String toString(java.util.List cards)
          A helper function that generates a String representation for the specified list of CardProperties.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COLOR_RED

public static final int COLOR_RED
See Also:
Constant Field Values

COLOR_GREEN

public static final int COLOR_GREEN
See Also:
Constant Field Values

COLOR_BLUE

public static final int COLOR_BLUE
See Also:
Constant Field Values

SHAPE_RECTANGLE

public static final int SHAPE_RECTANGLE
See Also:
Constant Field Values

SHAPE_OVALE

public static final int SHAPE_OVALE
See Also:
Constant Field Values

SHAPE_ODD

public static final int SHAPE_ODD
See Also:
Constant Field Values

FILL_EMPTY

public static final int FILL_EMPTY
See Also:
Constant Field Values

FILL_DOTTED

public static final int FILL_DOTTED
See Also:
Constant Field Values

FILL_FULL

public static final int FILL_FULL
See Also:
Constant Field Values

CARDSNB

public static final int CARDSNB
Number of cards.

See Also:
Constant Field Values
Constructor Detail

CardProperties

public CardProperties(byte shape,
                      byte color,
                      byte number,
                      byte fill)
Creates a new instance of CardProperties, given the specified shape, color number and fill. Each property has a value between 1 and 3.

Parameters:
shape - the card shape type
color - the card color type
number - the card shape number type
fill - the card shape fill type
Method Detail

getShape

public byte getShape()
Returns:
the shape property identifier

getColor

public byte getColor()
Returns:
the color property identifier

getNumber

public byte getNumber()
Returns:
the shape number property identifier

getFill

public byte getFill()
Returns:
the shape fill property identifier

getCard

public static CardProperties getCard(int idx)
Get the card given the specified index.

Parameters:
idx - the index of the card.
Returns:
the card matching the index.
Throws:
java.lang.IllegalStateException - if index is invalid.

findCard

public static CardProperties findCard(CardProperties card)
Parameters:
card -
Returns:
the CardProperties

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Parameters:
o - the other object
Returns:
true if both instances are equal.

hashCode

public int hashCode()
Returns:
a hash code value for the object.

toString

public java.lang.String toString()
Returns:
a String representation of that object.

toString

public static java.lang.String toString(CardProperties[] cards)
A helper function that generates a String representation for the specified array of CardProperties.

Parameters:
cards - the cards for which we want a String representation.
Returns:
the String representation

toString

public static java.lang.String toString(java.util.List cards)
A helper function that generates a String representation for the specified list of CardProperties.

Parameters:
cards - the cards for which we want a String representation.
Returns:
the String representation


Copyright © 2004 CoffeeBreaks. All Rights Reserved.