Definition: A Game is a unique type object.  It is unique in the fact that it belongs to a Series object, which is unique, and it has several unusual properties.  A Series object will be unique because it is traceable to a particular League, a particular Season, a particular Member/Bowler, a particular Contest number, a particular Team, and a particular position within the Team.  These combine to make the Series unique.  In addition, the Game is unique because it is a member of a unique Series object, and it also has a unique game number (1, 2, 3, ...) position within the Series.

Game objects are stored in the file system within a Series object.  Since a Game has two characteristics, I use a colon (:) to separate them, rather than the tab which separates the Games and other characteristics in the Series.  The Games are positioned within the Series object in proper order.

There are many types of games in bowling:
  Type Description
Regular A Team member bowling normally.  The pins count toward the member and team pins, handicap, and awards.
Absent Also called a Blind.  The team member is absent, so the league specifies the penalty in pins, that are subtracted from the member’s average.  Pins count toward the team, but not for the member.
Substitute The team member was not present, so another league member, who is not a team member, bowled.  The pins count for the member and the team.
Forfeit A game is forfeit because a rule infraction requires it, or because a legal lineup was not available by one or both teams.  There are known, and unknown forfeits, but there isn’t any difference in how the scores are used.  If a game is in forfeit, the team score for that game is zero. If an eligible player completes the game, that score counts for the individual, (awards, average, etc.) but not the team.  The team always gets zero pins for any forfeited game. 
Partial A partial game occurs when a member starts, but cannot finish a game, usually due to injury.  The pins count for the team, but not for the member, because a portion of the game was effectively a blind game.
Vacant Teams without a full roster of permanent members has one or more vacancies.  The pins, as defined by the League, count for the team, but not for any member.
Bye One option for an uneven number of teams.  A bye means the team did not bowl because there is no opponent.  There are no pins to consider.
Draw Another option for an uneven number of teams.  A draw is when this team has no opponent, but they bowl as if contesting against a team whose number they draw out of a hat.  The pins count for both team and member.
Earned Another option for an uneven number of teams.  In this case the team must bowl better than their absent score to earn the points.  If the absent score is not bowled, they earn “unearned” points.

Issues:  I seriously considered making it an inner class of the Series object, but a Game object has a lot of complexity, so I decided to make it a separate class.  There is one time when it may be important for a Game to be it’s own object, rather than an inner class, and that is for the GUI, when editing game scores.  Since each Game will have it’s own screen GUI component, it is probably better that it be a separate object.

A Game object, having only two characterisitics, may appear equal to many other Game objects, even within a Series.  This may mean that the compare() and compareTo() methods are meaningless and not needed.  It is important that Game objects aways stay associated with their parent Series object.  Within the Series object the Game objects will be inside of some array or list, with the index position within the array or list identifying the games position within the Series.  Thus the first Game should never be confused with the second Game, and so on, even if their characteristics are identical.

Storage of Game objects within a Series object allows the possibility of storing the GameType as either a localized word(s), or as a single letter.  My original intent was to just use a letter, as this reduces the space required.  There are lots of Games and Series for a given League!  But, using a letter makes it more difficult for a person to “read” the file.  Since each Series object will be stored on a separate line in the scores file, and since space is usually not at a premium these days, I believe using localized word(s) will be best.

Variables:

  Modifier Class Name Value
    Integer serializableVersionUID 1234567

Characteristics:

  Tic name object
GameType Enum
Pins Integer

Requirements:

 
  • Ticable
  • Serializable
  • Comparable and Comparator
  • Observable
  • new, to create a new instance using Tic default values.

Required Methods:

 
  • A no argument constructor.
  • Setters and getters for the characteristics.
  • The compare(Object, Object), compareTo(Object), and equals(Object) methods. (Comparable and Comparator)
  • Save() and Load() methods for saving/loading to a delimited file.
  • Methods to determine, based on the GameType, whether the pins will count towards team pins, member average, and awards.