org.pokersource.enum

Class BaseHandGroup

Implemented Interfaces:
Comparable, HandGroup
Known Direct Subclasses:
HoldemAbdulGroup, HoldemAtomicGroup, HoldemCanonGroup, HoldemSMGroup, HoldemUniversalGroup, ThresholdHandGroup

public class BaseHandGroup
extends java.lang.Object
implements HandGroup, Comparable

Implements the HandGroup interface in a way that will work for most poker games. Subclasses can override if necessary.
Author:
Michael Maurer <mjmaurer@yahoo.com>
See Also:
HandGroup, HoldemHandGroup

Field Summary

(package private) HashSet
myhands
Set of Long objects, each a bitmask for one hand.
(package private) String
myspec
String representation of hand group.

Method Summary

int
compareTo(Object o)
Define default sort order based on string representation.
String
getGroupSpec()
Set
getHandSet()
long[]
getHands()
Returns an array of atomic hands (each encoded as a long).
boolean
isHandInGroup(long hand)
int
numHands()
String
toString()
String
toStringAtomic()

Field Details

myhands

(package private)  HashSet myhands
Set of Long objects, each a bitmask for one hand. Subclasses should, in their constructor, convert myspec into the set of corresponding hands. The set should be immutable once set in the constructor.

myspec

(package private)  String myspec
String representation of hand group. Subclasses should accept this string in the constructor and save it here.

Method Details

compareTo

public int compareTo(Object o)
Define default sort order based on string representation.

getGroupSpec

public String getGroupSpec()
Specified by:
getGroupSpec in interface HandGroup

getHandSet

public Set getHandSet()
Specified by:
getHandSet in interface HandGroup

getHands

public long[] getHands()
Returns an array of atomic hands (each encoded as a long).
Specified by:
getHands in interface HandGroup
See Also:
Deck

isHandInGroup

public boolean isHandInGroup(long hand)
Specified by:
isHandInGroup in interface HandGroup

numHands

public int numHands()
Specified by:
numHands in interface HandGroup

toString

public String toString()
Specified by:
toString in interface HandGroup

toStringAtomic

public String toStringAtomic()
Specified by:
toStringAtomic in interface HandGroup

PokerSource Home Page - Learn how you can contribute!