Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 968293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:27:21+00:00 2026-05-16T02:27:21+00:00

I’m learning OO principles and for practice I’m developing an application in Java. The

  • 0

I’m learning OO principles and for practice I’m developing an application in Java.

The application is to parse the hand history text files issued by poker sites after every poker hand is played and to extract the same types of data from the file no matter which site the hand history is from.

The hand history files can be in very different formats depending on the poker site. Some sites have each hand in a very human-readable style eg:

NL $0.25/$0.50 Texas Hold'em - Tuesday, June 22, 19:55:24 GMT 2010

and others have an XML style.

My question is: When parsing the above line from the text, should I have separate classes to parse each element? For instance should I have a StakesParser class with a parseStakes() method and then a CurrencyParser class with a parseCurrency() method etc. Or should I have a single class that can parse that line and get all the different bits of info from it?

To have a separate class for each thing I want to parse seems more OO, but less efficient. Any advice?

What I want as a result of the parsing process is a GameState class which would hold all the info for one hand of Poker. So no matter what site the hand history file was from I would be able to make an object of type GameState with all the relevant info parsed for it by an HHParser class.

To this end, I thought it would be a good idea to have an interface which would have to be implemented which would ensure that the HHParser for each poker site would end up producing a GameState class. So the interface would have methods such as parseStakes(), parseCurrency() etc. Is this the right approach?

What makes it more confusing for me is that on different sites, the information is in a different order so I possibly need a controller class that makes sure that each method is called in the right order depending on what site the text file is from.

Sorry about the waffle, but I’d be grateful for any pointers on what is might be best to do.

Many thanks in advance. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:27:21+00:00Added an answer on May 16, 2026 at 2:27 am

    I wonder if a “class per element” strategy is too granular. I’m thinking maybe some sort of factory that returns the correct parser implementation for a particular site.

    public class ParserFactory {
      public static Parser get(String url) {...};
    }
    

    So you end up with a Parser interface responsible for returning some sort of java bean encapsulating the attributes of a poker hand.

    public interface Parser {
      public Collection<Hand> parse();
    }
    

    And you implement Parser for each site from which you can obtain hands, returning the correct one from the factory. I might use Commons Digester for the XML sites and ANTLR or even regular expressions for the non-XML ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
i want to parse a xhtml file and display in UITableView. what is the
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.