Record Class NegotiationOffer
java.lang.Object
java.lang.Record
com.tnsai.coordination.negotiation.NegotiationOffer
- Record Components:
offerId- unique offer identifierfromAgentId- agent making the offertoAgentId- agent receiving the offervalue- numeric offer valueround- negotiation round number (1-based)terms- additional offer termstimestamp- when the offer was made
public record NegotiationOffer(String offerId, String fromAgentId, String toAgentId, double value, int round, Map<String,Object> terms, Instant timestamp)
extends Record
An offer made during a negotiation.
- Since:
- 0.0.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of thefromAgentIdrecord component.final inthashCode()Returns a hash code value for this object.static NegotiationOfferCreates an offer with auto-generated ID and timestamp.static NegotiationOfferCreates an offer with terms.offerId()Returns the value of theofferIdrecord component.intround()Returns the value of theroundrecord component.terms()Returns the value of thetermsrecord component.Returns the value of thetimestamprecord component.Returns the value of thetoAgentIdrecord component.final StringtoString()Returns a string representation of this record class.doublevalue()Returns the value of thevaluerecord component.
-
Constructor Details
-
NegotiationOffer
public NegotiationOffer(String offerId, String fromAgentId, String toAgentId, double value, int round, Map<String, Object> terms, Instant timestamp) Creates an instance of aNegotiationOfferrecord class.- Parameters:
offerId- the value for theofferIdrecord componentfromAgentId- the value for thefromAgentIdrecord componenttoAgentId- the value for thetoAgentIdrecord componentvalue- the value for thevaluerecord componentround- the value for theroundrecord componentterms- the value for thetermsrecord componenttimestamp- the value for thetimestamprecord component
-
-
Method Details
-
of
Creates an offer with auto-generated ID and timestamp. -
of
public static NegotiationOffer of(String from, String to, double value, int round, Map<String, Object> terms) Creates an offer with terms. -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
offerId
Returns the value of theofferIdrecord component.- Returns:
- the value of the
offerIdrecord component
-
fromAgentId
Returns the value of thefromAgentIdrecord component.- Returns:
- the value of the
fromAgentIdrecord component
-
toAgentId
Returns the value of thetoAgentIdrecord component.- Returns:
- the value of the
toAgentIdrecord component
-
value
public double value()Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
round
public int round()Returns the value of theroundrecord component.- Returns:
- the value of the
roundrecord component
-
terms
Returns the value of thetermsrecord component.- Returns:
- the value of the
termsrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-