Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pokersource.enumerate
Class HoldemHandGroupFactory

    java.lang.Object
      org.pokersource.enumerate.HoldemHandGroupFactory

    public class HoldemHandGroupFactory

extends java.lang.Object

Creates instances of HoldemHandGroup-implementing objects from their string representations. Use of this factory is preferred to directly calling the constructors of subclasses, as the factory maintains a cache of immutable instances.

Author:
  Michael Maurer <mjmaurer@yahoo.com>

Field Summary
`private static java.util.HashMap` | `cache` Cache of hand groups already instantiated.
`private static java.lang.Class[]` | `groupClasses` Set of registered classes that we know how to instantiate.

Constructor Summary
`private` | `HoldemHandGroupFactory()`

Method Summary
`static HoldemHandGroup` | `getInstance(java.lang.String groupSpec)` Tries to parse groupSpec into a hand group using the constructors of the list of known classes.
`static HoldemHandGroup` | `getInstance(java.lang.String groupSpec, java.lang.Class gclass)` Tries to parse groupSpec into a hand group using the gclass constructor.
`private static HoldemHandGroup` | `tryGetInstance(java.lang.Class gclass, java.lang.String groupSpec)` Try to parse groupSpec using class gclass.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### groupClasses

    private static java.lang.Class[] groupClasses

  Set of registered classes that we know how to instantiate.

### cache

    private static java.util.HashMap cache

  Cache of hand groups already instantiated.

Constructor Detail

### HoldemHandGroupFactory

    private HoldemHandGroupFactory()

Method Detail

### tryGetInstance

    private static HoldemHandGroup tryGetInstance(java.lang.Class gclass,
                                                  java.lang.String groupSpec)

  Try to parse groupSpec using class gclass. If parsing succeeds, returns new group object; if parsing fails, returns null; if something unexpected happens, throws a runtime exception.

### getInstance

    public static HoldemHandGroup getInstance(java.lang.String groupSpec,
                                              java.lang.Class gclass)

  Tries to parse groupSpec into a hand group using the gclass constructor. If gclass fails to parse groupSpec, throws a runtime exception.

### getInstance

    public static HoldemHandGroup getInstance(java.lang.String groupSpec)

  Tries to parse groupSpec into a hand group using the constructors of the list of known classes. If all known classes fail to parse groupSpec, throws a runtime exception.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD