All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.lotspiech.poker.strategy.Pattern

java.lang.Object
   |
   +----com.lotspiech.poker.strategy.Pattern

public abstract class Pattern
extends Object
This is an abstract type that represents a particular rule pattern.

Copyright 2001, 2002 by Jeffrey B. Lotspiech. This program is open source; it is licensed under the Common Public License Version 0.5.

Author:
Jeffrey B. Lotspiech

Variable Index

 o COPYRIGHT
 o first
a table: "first" one bit in a byte 0:31
 o next
 o ones
a table: number of one-bits in a byte 0:31
 o rules
 o START_MASK

Constructor Index

 o Pattern(Rules)
This method was created in VisualAge.

Method Index

 o compile(String)
This method process the pattern string and does all the pre-calculation it can.
 o endingIndex(String, char)
This method was created in VisualAge.
 o matches(int)
This method returns true if the pattern matches the current hand.
 o next()
Given that this pattern matches, this moves to the next pattern in the rule and returns its value.

Variables

 o COPYRIGHT
 private static final String COPYRIGHT
 o START_MASK
 public static final int START_MASK
 o ones
 protected static final int ones[]
a table: number of one-bits in a byte 0:31

 o first
 protected static final int first[]
a table: "first" one bit in a byte 0:31

 o rules
 protected Rules rules
 o next
 protected Pattern next

Constructors

 o Pattern
 protected Pattern(Rules rules)
This method was created in VisualAge.

Parameters:
rules - com.lotspiech.poker.strategy.Rules

Methods

 o compile
 protected abstract void compile(String rule) throws PatternSyntaxException
This method process the pattern string and does all the pre-calculation it can.

Parameters:
rule - The pattern string.
Throws: PatternSyntaxException
If there is a syntax error in the pattern string.
 o endingIndex
 protected static final int endingIndex(String rule,
                                        char end) throws PatternSyntaxException
This method was created in VisualAge.

Parameters:
end - char
Returns:
int
Throws: PatternSyntaxException
The exception description.
 o matches
 protected abstract boolean matches(int mask)
This method returns true if the pattern matches the current hand.

Parameters:
mask - Cards available to use to match the pattern.
Returns:
true if the pattern matches the current hand.
 o next
 protected boolean next()
Given that this pattern matches, this moves to the next pattern in the rule and returns its value. If there is no next pattern, then it returns true.

Returns:
boolean

All Packages  Class Hierarchy  This Package  Previous  Next  Index