Record Class AuctionResult

java.lang.Object
java.lang.Record
com.tnsai.coordination.auction.AuctionResult
Record Components:
success - whether the auction produced a winner
winner - the winning agent (null if no winner)
winningBid - the winning bid (null if no winner)
payPrice - the price the winner pays (may differ from bid in Vickrey)
allBids - all bids submitted during the auction
rounds - number of rounds executed
durationMs - total auction duration
reason - failure reason if unsuccessful

public record AuctionResult(boolean success, com.tnsai.agents.Agent winner, Bid winningBid, double payPrice, List<Bid> allBids, int rounds, long durationMs, String reason) extends Record
Result of an auction execution.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AuctionResult(boolean success, com.tnsai.agents.Agent winner, Bid winningBid, double payPrice, List<Bid> allBids, int rounds, long durationMs, String reason)
    Creates an instance of a AuctionResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the allBids record component.
    long
    Returns the value of the durationMs record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    noWinner(List<Bid> allBids, int rounds, long durationMs, String reason)
     
    double
    Returns the value of the payPrice record component.
    Returns the value of the reason record component.
    int
    Returns the value of the rounds record component.
    boolean
    Returns the value of the success record component.
    final String
    Returns a string representation of this record class.
    com.tnsai.agents.Agent
    Returns the value of the winner record component.
    Returns the value of the winningBid record component.
    won(com.tnsai.agents.Agent winner, Bid winningBid, double payPrice, List<Bid> allBids, int rounds, long durationMs)
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AuctionResult

      public AuctionResult(boolean success, com.tnsai.agents.Agent winner, Bid winningBid, double payPrice, List<Bid> allBids, int rounds, long durationMs, String reason)
      Creates an instance of a AuctionResult record class.
      Parameters:
      success - the value for the success record component
      winner - the value for the winner record component
      winningBid - the value for the winningBid record component
      payPrice - the value for the payPrice record component
      allBids - the value for the allBids record component
      rounds - the value for the rounds record component
      durationMs - the value for the durationMs record component
      reason - the value for the reason record component
  • Method Details

    • won

      public static AuctionResult won(com.tnsai.agents.Agent winner, Bid winningBid, double payPrice, List<Bid> allBids, int rounds, long durationMs)
    • noWinner

      public static AuctionResult noWinner(List<Bid> allBids, int rounds, long durationMs, String reason)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • success

      public boolean success()
      Returns the value of the success record component.
      Returns:
      the value of the success record component
    • winner

      public com.tnsai.agents.Agent winner()
      Returns the value of the winner record component.
      Returns:
      the value of the winner record component
    • winningBid

      public Bid winningBid()
      Returns the value of the winningBid record component.
      Returns:
      the value of the winningBid record component
    • payPrice

      public double payPrice()
      Returns the value of the payPrice record component.
      Returns:
      the value of the payPrice record component
    • allBids

      public List<Bid> allBids()
      Returns the value of the allBids record component.
      Returns:
      the value of the allBids record component
    • rounds

      public int rounds()
      Returns the value of the rounds record component.
      Returns:
      the value of the rounds record component
    • durationMs

      public long durationMs()
      Returns the value of the durationMs record component.
      Returns:
      the value of the durationMs record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component