Record Class InspectionProperty

java.lang.Object
java.lang.Record
epidemic.model.InspectionProperty
Record Components:
label - Etykieta opisująca statystykę.
stringValue - Wartość tekstowa (używana dla standardowych etykiet).
progressValue - Obecna wartość postępu (używana dla pasków ładowania).
progressMax - Maksymalna dopuszczalna wartość postępu.
highlightColor - Opcjonalny kolor akcentujący dla tekstu lub wypełnienia paska.

public record InspectionProperty(String label, String stringValue, Integer progressValue, Integer progressMax, Color highlightColor) extends Record
Niemutowalna struktura danych (wzorzec Data Transfer Object - DTO) reprezentująca pojedynczą statystykę obiektu na mapie symulacji. Agreguje parametry niezbędne do dynamicznego wygenerowania i ostylowania odpowiednich komponentów biblioteki Swing w Inspektorze (JLabel, JProgressBar).
  • Field Details

    • label

      private final String label
      The field for the label record component.
    • stringValue

      private final String stringValue
      The field for the stringValue record component.
    • progressValue

      private final Integer progressValue
      The field for the progressValue record component.
    • progressMax

      private final Integer progressMax
      The field for the progressMax record component.
    • highlightColor

      private final Color highlightColor
      The field for the highlightColor record component.
  • Constructor Details

    • InspectionProperty

      public InspectionProperty(String label, String stringValue, Integer progressValue, Integer progressMax, Color highlightColor)
      Creates an instance of a InspectionProperty record class.
      Parameters:
      label - the value for the label record component
      stringValue - the value for the stringValue record component
      progressValue - the value for the progressValue record component
      progressMax - the value for the progressMax record component
      highlightColor - the value for the highlightColor record component
  • Method Details

    • text

      public static InspectionProperty text(String label, String value)
      Statyczna metoda fabrykująca do tworzenia standardowych etykiet tekstowych.
      Parameters:
      label - Nazwa metryki.
      value - Reprezentacja tekstowa odczytu.
      Returns:
      Nowa instancja DTO skonfigurowana jako zwykły tekst.
    • textColored

      public static InspectionProperty textColored(String label, String value, Color color)
      Statyczna metoda fabrykująca do tworzenia etykiet z wyróżnieniem kolorystycznym.
      Parameters:
      label - Nazwa metryki.
      value - Reprezentacja tekstowa odczytu.
      color - Kolor użyty do renderowania tekstu wartości.
      Returns:
      Nowa instancja DTO skonfigurowana jako kolorowy tekst.
    • progressBar

      public static InspectionProperty progressBar(String label, int value, int max, Color color)
      Statyczna metoda fabrykująca nakazująca warstwie GUI wygenerowanie paska postępu.
      Parameters:
      label - Opis umieszczany nad lub na pasku postępu.
      value - Bieżący stan wypełnienia.
      max - Maksymalna wartość skali.
      color - Kolor wypełnienia paska.
      Returns:
      Nowa instancja DTO skonfigurowana jako wskaźnik postępu.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • label

      public String label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • stringValue

      public String stringValue()
      Returns the value of the stringValue record component.
      Returns:
      the value of the stringValue record component
    • progressValue

      public Integer progressValue()
      Returns the value of the progressValue record component.
      Returns:
      the value of the progressValue record component
    • progressMax

      public Integer progressMax()
      Returns the value of the progressMax record component.
      Returns:
      the value of the progressMax record component
    • highlightColor

      public Color highlightColor()
      Returns the value of the highlightColor record component.
      Returns:
      the value of the highlightColor record component