Record Class TSPTWState
java.lang.Object
java.lang.Record
org.ddolib.examples.nolayer.tsptw.TSPTWState
- Record Components:
currentCity- the index of the current city the vehicle is located attime- the current arrival time at the current citymustVisit- the set of remaining cities that must be visited
State for the NoLayer formulation of the Traveling Salesman Problem with Time Windows.
-
Constructor Summary
ConstructorsConstructorDescriptionTSPTWState(int currentCity, int time, BitSet mustVisit) Defensively copiesmustVisitso the state cannot be mutated through a reference held outside the record. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecurrentCityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themustVisitrecord component.inttime()Returns the value of thetimerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
TSPTWState
Defensively copiesmustVisitso the state cannot be mutated through a reference held outside the record.
-
-
Method Details
-
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 '=='. -
currentCity
public int currentCity()Returns the value of thecurrentCityrecord component.- Returns:
- the value of the
currentCityrecord component
-
time
public int time()Returns the value of thetimerecord component.- Returns:
- the value of the
timerecord component
-
mustVisit
Returns the value of themustVisitrecord component.- Returns:
- the value of the
mustVisitrecord component
-