Project structure - ousou/Javalabra-2013 GitHub Wiki

See also Class and sequence diagrams

AbstractPokerHandSimulator

The main logic class in the project is AbstractPokerHandSimulator, which has two subclasses PokerHandSimulatorOriginal and PokerHandSimulatorVersion2. The subclasses differ only in how they find the best hand from a set of hands, with PokerHandSimulatorVersion2 doing it much more effectively.

The class AbstractPokerHandSimulator contains two or more instances of subclasses of AbstractStartingHand. These instances represent the starting hands the user has chosen for the simulation. If the simulated poker game type is a community card game, AbstractPokerHandSimulator also contains an instance of the class FiveCardBoard, which represents the community cards, i.e. the board.

AbstractPokerHandSimulator uses instances of the class PossibleHandsCreator to find all five card poker hands that can be created by combining cards from a starting hand and the board cards. After that, an instance of the Comparator-class FiveCardPokerHandComparator is used to determine the best possible hand for the starting hand in question. When the best possible hand for every starting hand has been determined, the winning hand is determined by again using FiveCardPokerHandComparator.

The result (i.e. winning hands) from every simulation is recorded in an instance of the class SimulationResult. This instance is then returned to the user interface, which can then show the results to the user by calling methods in SimulationResult.

AbstractCardCollection

All classes that represent any kind of poker hands or boards are subclasses to the class AbstractCardCollection. The class AbstractStartingHand, which represents a starting hand, has subclasses for every poker game type the program supports. The classes FiveCardPokerHand, which represents a complete five card hand, and FiveCardBoard, which represents the community cards, also extend the class AbstractCardCollection.