GameHistory

model.entities.games.GameHistory
case class GameHistory(gains: List[Gain])

Maintains the complete history of all gains and losses for a game.

Tracks all monetary transactions that have occurred during the game's lifetime, providing methods to calculate overall performance and add new entries. The history is immutable - updates create new instances.

Value parameters

gains

chronological list of all gain/loss records

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def overallGains: Double

Calculates the total cumulative gains across all recorded transactions.

Calculates the total cumulative gains across all recorded transactions.

Sums all individual gains and losses to determine the overall financial performance of the game.

Attributes

Returns

the sum of all gains and losses, representing net game performance

def update(customerId: String, gain: Double): GameHistory

Creates a new GameHistory with an additional gain/loss record.

Creates a new GameHistory with an additional gain/loss record.

Appends a new gain entry to the existing history, maintaining chronological order

Value parameters

customerId

the unique identifier of the customer

gain

the monetary amount (positive for winnings, negative for losses)

Attributes

Returns

new GameHistory instance with the additional record

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product