Class WeeklySubject

java.lang.Object
at.htl.timetableGenerator.model.WeeklySubject

public class WeeklySubject extends Object
This class represents a subject that is taught a certain number of times per week. A WeeklySubjects object is defined by a subject and the number of times it is taught per week.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WeeklySubject(Subject subject, int noPerWeek)
    Constructs a new WeeklySubjects with the given subject and number of times it is taught per week.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(@Nullable Object o)
    Checks if the given object is equal to this WeeklySubjects.
    int
    Returns the number of times the subject is taught per week.
    Returns the subject that is taught.
    int
    Returns a hash code value for this WeeklySubjects.
    void
    setNoPerWeek(int noPerWeek)
    Sets the number of times the subject is taught per week.
    void
    Sets the subject that is taught.
    Returns a string representation of this WeeklySubjects.

    Methods inherited from class java.lang.Object

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

    • WeeklySubject

      public WeeklySubject(Subject subject, int noPerWeek)
      Constructs a new WeeklySubjects with the given subject and number of times it is taught per week.
      Parameters:
      subject - The subject that is taught.
      noPerWeek - The number of times the subject is taught per week.
  • Method Details

    • equals

      public boolean equals(@Nullable @Nullable Object o)
      Checks if the given object is equal to this WeeklySubjects. Two WeeklySubjects are considered equal if their subjects and amount of them are equal .
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare this WeeklySubjects against.
      Returns:
      true if the given object represents a WeeklySubjects with the same subject and noPerWeek as this WeeklySubjects, false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this WeeklySubjects. This method is supported for the benefit of hash tables such as those provided by HashMap.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object.
    • getSubject

      public Subject getSubject()
      Returns the subject that is taught.
      Returns:
      The subject that is taught.
    • setSubject

      public void setSubject(Subject subject)
      Sets the subject that is taught.
      Parameters:
      subject - The subject to set.
    • getNoPerWeek

      public int getNoPerWeek()
      Returns the number of times the subject is taught per week.
      Returns:
      The number of times the subject is taught per week.
    • setNoPerWeek

      public void setNoPerWeek(int noPerWeek)
      Sets the number of times the subject is taught per week.
      Parameters:
      noPerWeek - The number of times to set.
    • toString

      public String toString()
      Returns a string representation of this WeeklySubjects. The string representation is the subject and the number of times it is taught per week.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this WeeklySubjects.