Record Class MSCTState

java.lang.Object
java.lang.Record
org.ddolib.examples.msct.MSCTState
Record Components:
remainingJobs - the set of job indices that have not yet been scheduled.
currentTime - the current time (sum of processing times of scheduled jobs).

public record MSCTState(Set<Integer> remainingJobs, int currentTime) extends Record
Represents a state in the MSCTProblem (Minimum Sum of Completion Times) scheduling problem.

A state captures the current status of the scheduling process: it stores the set of jobs that remain to be scheduled and the current simulation time (i.e., the total time elapsed so far in the partial schedule).

Structure:

  • remainingJobs: the set of jobs that have not yet been scheduled.
  • currentTime: the time at which the next job can start, representing the accumulated processing time of all scheduled jobs so far.

This class is implemented as a Java record, meaning it is immutable and provides automatically generated implementations for equals, hashCode, and accessors.

Example:


 Set<Integer> jobs = Set.of(0, 1, 2);
 MSCTState state = new MSCTState(jobs, 5);
 System.out.println(state);
 // Output: RemainingJobs [0, 1, 2] ----> currentTime 5
 
See Also:
  • Constructor Details

    • MSCTState

      public MSCTState(Set<Integer> remainingJobs, int currentTime)
      Creates an instance of a MSCTState record class.
      Parameters:
      remainingJobs - the value for the remainingJobs record component
      currentTime - the value for the currentTime record component
  • Method Details

    • toString

      public String toString()
      Returns a string representation of the state for debugging or logging purposes.

      The output includes the list of remaining jobs and the current simulation time.

      Specified by:
      toString in class Record
      Returns:
      a formatted string describing this state.
    • 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.
    • remainingJobs

      public Set<Integer> remainingJobs()
      Returns the value of the remainingJobs record component.
      Returns:
      the value of the remainingJobs record component
    • currentTime

      public int currentTime()
      Returns the value of the currentTime record component.
      Returns:
      the value of the currentTime record component