org.pokersource.enumerate
Class ThresholdHandGroup

java.lang.Object
  extended by org.pokersource.enumerate.BaseHandGroup
      extended by org.pokersource.enumerate.ThresholdHandGroup
All Implemented Interfaces:
java.lang.Comparable, HandGroup
Direct Known Subclasses:
HoldemThresholdGroup

public class ThresholdHandGroup
extends BaseHandGroup

Given a mapping from hand groups G_i to numeric values, this class allows you to build a new hand group as the union of those G_i whose numeric values are less than or greater than a certain threshold. For example, you could assign a numeric 'strength' to each canonical hand G_i and then create a new group consisting of those G_i whose strength exceeds some minimum value.

Author:
Michael Maurer <mjmaurer@yahoo.com>

Field Summary
private static org.apache.oro.text.regex.Perl5Compiler compiler
           
private static org.apache.oro.text.regex.Perl5Matcher matcher
           
private static org.apache.oro.text.regex.Pattern pattern
           
private static java.util.HashMap valuations
          Map of {String, HandValuation} pairs that have been registered via registerHandValuation().
 
Fields inherited from class org.pokersource.enumerate.BaseHandGroup
myhands, myspec
 
Constructor Summary
ThresholdHandGroup(java.lang.String groupSpec)
          Create a set of hands corresponding to those whose value compares either less than or greater than a threshold value, where the value of each hand is defined by a HandValuation.
 
Method Summary
static void main(java.lang.String[] args)
           
static void registerHandValuation(java.lang.String valuationName, HandValuation valuation)
          Register a new HandValuation that will be referred to as valuationName.
 
Methods inherited from class org.pokersource.enumerate.BaseHandGroup
compareTo, getGroupSpec, getHands, getHandSet, isHandInGroup, numHands, toString, toStringAtomic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

compiler

private static org.apache.oro.text.regex.Perl5Compiler compiler

matcher

private static org.apache.oro.text.regex.Perl5Matcher matcher

pattern

private static org.apache.oro.text.regex.Pattern pattern

valuations

private static java.util.HashMap valuations
Map of {String, HandValuation} pairs that have been registered via registerHandValuation().

Constructor Detail

ThresholdHandGroup

public ThresholdHandGroup(java.lang.String groupSpec)
Create a set of hands corresponding to those whose value compares either less than or greater than a threshold value, where the value of each hand is defined by a HandValuation.

Parameters:
groupSpec - Defines a hand valuation, a threshold value, and a comparator. The hand valuation is referred to by a string previously registered with registerHandValuation(). The threshold value is a number in decimal form. The comparator is one of '<', '<=', '>', '>='.
Method Detail

registerHandValuation

public static void registerHandValuation(java.lang.String valuationName,
                                         HandValuation valuation)
Register a new HandValuation that will be referred to as valuationName. For example, if you register a valuation as 'MYVAL', one can later instantiate a hand group using a syntax like 'MYVAL>0.80'; the hand group will include all hands to which the registered valuation assigns a numeric value greater than 0.80.


main

public static void main(java.lang.String[] args)