| Package | com.whirled.contrib.card |
| Class | public class Card |
| Property | Defined by | ||
|---|---|---|---|
| faceDown : Boolean [read-only] Access whether the card is face down or not.
| Card | ||
| ordinal : int [read-only] Access the ordinal.
| Card | ||
| rank : int [read-only] Access the rank.
| Card | ||
| string : String [read-only] Get a unique string representation of this card for debugging or naming conventions.
| Card | ||
| suit : int [read-only] Access the suit.
| Card | ||
| Property | Defined by | ||
|---|---|---|---|
| _ordinal : int The rank (3 high bits) and suit (5 low bits).
| Card | ||
| Method | Defined by | ||
|---|---|---|---|
|
Card(suit:int, rank:int)
Create a new card.
| Card | ||
|
compareRanks(rank1:int, rank2:int, ordering:int):int
[static] Compare two ranks in the given ordering.
| Card | ||
|
createCardFromOrdinal(ordinal:int):Card
[static] Create a new Card object from an ordinal.
| Card | ||
|
[static] Create a new face down card.
| Card | ||
|
Compare for eqaulity to another card.
| Card | ||
|
isBetterRank(rhs:Card, ordering:int):Boolean
Check if this card has a better rank than the other.
| Card | ||
|
rankString(rank:int):String
[static] Return a short string for a RANK_constant for use in debugging or naming
conventions.
| Card | ||
|
suitString(suit:int):String
[static] Return a short string for a SUIT_constant for use in debugging or naming
conventions.
| Card | ||
|
toString():String
| Card | ||
| Method | Defined by | ||
|---|---|---|---|
|
validate(type:String, value:int, num:int):void
[static] Throw an exception if the value is less than zero or larger than max.
| Card | ||
| Constant | Defined by | ||
|---|---|---|---|
| MAX_ORDINAL : int = 255 [static] Number or ordinals.
| Card | ||
| MAX_RANK : int = 31 [static] Maximum rank value.
| Card | ||
| MAX_SUIT : int = 7 [static] Number of suits.
| Card | ||
| NUM_RANK_ORDERS : int = 2 [static] Number of ranks.
| Card | ||
| RANK_ACE : int = 0 [static] Constant for the rank of ace.
| Card | ||
| RANK_EIGHT : int = 7 [static] Constant for the rank of eight.
| Card | ||
| RANK_FIVE : int = 4 [static] Constant for the rank of five.
| Card | ||
| RANK_FOUR : int = 3 [static] Constant for the rank of four.
| Card | ||
| RANK_JACK : int = 10 [static] Constant for the rank of jack.
| Card | ||
| RANK_KING : int = 12 [static] Constant for the rank of king.
| Card | ||
| RANK_NINE : int = 8 [static] Constant for the rank of nine.
| Card | ||
| RANK_ORDER_ACES_HIGH : int = 1 [static] Constant for aces high rank ordering.
| Card | ||
| RANK_ORDER_NORMAL : int = 0 [static] Constant for straight rank ordering.
| Card | ||
| RANK_QUEEN : int = 11 [static] Constant for the rank of queen.
| Card | ||
| RANKS : Array [static]
| Card | ||
| RANK_SEVEN : int = 6 [static] Constant for the rank of seven.
| Card | ||
| RANK_SIX : int = 5 [static] Constant for the rank of six.
| Card | ||
| RANK_TEN : int = 9 [static] Constant for the rank of ten.
| Card | ||
| RANK_THREE : int = 2 [static] Constant for the rank of three.
| Card | ||
| RANK_TWO : int = 1 [static] Constant for the rank of deuce.
| Card | ||
| SPRITE_HEIGHT : int = 100 [static] Placeholder value for the height of a card sprite.
| Card | ||
| SPRITE_WIDTH : int = 70 [static] Placeholder value for the width of a card sprite.
| Card | ||
| SUIT_CLUBS : int = 2 [static] Constant for the suit of clubs.
| Card | ||
| SUIT_DIAMONDS : int = 3 [static] Constant for the suit of diamonds.
| Card | ||
| SUIT_HEARTS : int = 0 [static] Constant for the suit of hearts.
| Card | ||
| SUITS : Array [static] Array of standard suits.
| Card | ||
| SUIT_SPADES : int = 1 [static] Constant for the suit of spades.
| Card | ||
| faceDown | property |
faceDown:Boolean [read-only]Access whether the card is face down or not.
Implementation public function get faceDown():Boolean
| _ordinal | property |
protected var _ordinal:intThe rank (3 high bits) and suit (5 low bits).
| ordinal | property |
ordinal:int [read-only]Access the ordinal.
Implementation public function get ordinal():int
| rank | property |
rank:int [read-only]Access the rank.
Implementation public function get rank():int
| string | property |
string:String [read-only]Get a unique string representation of this card for debugging or naming conventions. E.g. "two of hearts" is "2H".
Implementation public function get string():String
| suit | property |
suit:int [read-only]Access the suit.
Implementation public function get suit():int
| Card | () | constructor |
public function Card(suit:int, rank:int)Create a new card.
Parameterssuit:int — the suit of the card (one of the SUIT_constants)
|
|
rank:int — the rank of the card (one of the RANK_constants)
|
— if the suit or rank is invalid.
|
| compareRanks | () | method |
public static function compareRanks(rank1:int, rank2:int, ordering:int):intCompare two ranks in the given ordering.
Parametersrank1:int — the first rank to compare, one of the RANK_constants
|
|
rank2:int — the second rank to compare, one of the RANK_constants
|
|
ordering:int — how to compare, one of the RANK_ORDER_constants
|
int — a negative number if rank1 < rank2, positive if rank1 > rank2 and zero
if rank1 == rank2 |
— if any constant is not in the predefined set
|
| createCardFromOrdinal | () | method |
public static function createCardFromOrdinal(ordinal:int):CardCreate a new Card object from an ordinal.
Parametersordinal:int |
Card |
— if the ordinal is not valid. |
| createFaceDownCard | () | method |
public static function createFaceDownCard():CardCreate a new face down card. A face down card usually means that the local player "has" the card but cannot yet see its value, i.e. the value is not known.
ReturnsCard |
| equals | () | method |
public function equals(rhs:Card):BooleanCompare for eqaulity to another card.
Parametersrhs:Card |
Boolean — true if the this is equal to the other card |
| isBetterRank | () | method |
public function isBetterRank(rhs:Card, ordering:int):BooleanCheck if this card has a better rank than the other.
Parametersrhs:Card — how to compare, one of the RANK_ORDER_constants
|
|
ordering:int — card to compare against |
Boolean |
| rankString | () | method |
public static function rankString(rank:int):StringReturn a short string for a RANK_constant for use in debugging or naming conventions. For example, RANK_ACE is "A". If the rank is not one defined by this class, the string is calculated from the numeric value.
Parametersrank:int |
String |
| suitString | () | method |
public static function suitString(suit:int):StringReturn a short string for a SUIT_constant for use in debugging or naming conventions. For example, SUIT_HEARTS is "H". If the suit is not one defined in this class, the string is calcualted from the numeric value.
Parameterssuit:int |
String |
| toString | () | method |
public function toString():StringReturns
String |
| validate | () | method |
protected static function validate(type:String, value:int, num:int):voidThrow an exception if the value is less than zero or larger than max.
Parameterstype:String — the ordinal name of the value set |
|
value:int |
|
num:int |
| MAX_ORDINAL | constant |
public static const MAX_ORDINAL:int = 255Number or ordinals. NOTE: also used as a bit mask
| MAX_RANK | constant |
public static const MAX_RANK:int = 31Maximum rank value. NOTE: also used as a bit mask.
| MAX_SUIT | constant |
public static const MAX_SUIT:int = 7Number of suits. NOTE: also used as a bit mask.
| NUM_RANK_ORDERS | constant |
public static const NUM_RANK_ORDERS:int = 2Number of ranks.
| RANK_ACE | constant |
public static const RANK_ACE:int = 0Constant for the rank of ace.
| RANK_EIGHT | constant |
public static const RANK_EIGHT:int = 7Constant for the rank of eight.
| RANK_FIVE | constant |
public static const RANK_FIVE:int = 4Constant for the rank of five.
| RANK_FOUR | constant |
public static const RANK_FOUR:int = 3Constant for the rank of four.
| RANK_JACK | constant |
public static const RANK_JACK:int = 10Constant for the rank of jack.
| RANK_KING | constant |
public static const RANK_KING:int = 12Constant for the rank of king.
| RANK_NINE | constant |
public static const RANK_NINE:int = 8Constant for the rank of nine.
| RANK_ORDER_ACES_HIGH | constant |
public static const RANK_ORDER_ACES_HIGH:int = 1Constant for aces high rank ordering.
| RANK_ORDER_NORMAL | constant |
public static const RANK_ORDER_NORMAL:int = 0Constant for straight rank ordering.
| RANK_QUEEN | constant |
public static const RANK_QUEEN:int = 11Constant for the rank of queen.
| RANKS | constant |
public static const RANKS:Array
| RANK_SEVEN | constant |
public static const RANK_SEVEN:int = 6Constant for the rank of seven.
| RANK_SIX | constant |
public static const RANK_SIX:int = 5Constant for the rank of six.
| RANK_TEN | constant |
public static const RANK_TEN:int = 9Constant for the rank of ten.
| RANK_THREE | constant |
public static const RANK_THREE:int = 2Constant for the rank of three.
| RANK_TWO | constant |
public static const RANK_TWO:int = 1Constant for the rank of deuce.
| SPRITE_HEIGHT | constant |
public static const SPRITE_HEIGHT:int = 100Placeholder value for the height of a card sprite.
| SPRITE_WIDTH | constant |
public static const SPRITE_WIDTH:int = 70Placeholder value for the width of a card sprite.
| SUIT_CLUBS | constant |
public static const SUIT_CLUBS:int = 2Constant for the suit of clubs.
| SUIT_DIAMONDS | constant |
public static const SUIT_DIAMONDS:int = 3Constant for the suit of diamonds.
| SUIT_HEARTS | constant |
public static const SUIT_HEARTS:int = 0Constant for the suit of hearts.
| SUITS | constant |
public static const SUITS:ArrayArray of standard suits.
| SUIT_SPADES | constant |
public static const SUIT_SPADES:int = 1Constant for the suit of spades.