Package epidemic.model
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final ColorThe field for thehighlightColorrecord component.private final StringThe field for thelabelrecord component.private final IntegerThe field for theprogressMaxrecord component.private final IntegerThe field for theprogressValuerecord component.private final StringThe field for thestringValuerecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thehighlightColorrecord component.label()Returns the value of thelabelrecord component.static InspectionPropertyprogressBar(String label, int value, int max, Color color) Statyczna metoda fabrykująca nakazująca warstwie GUI wygenerowanie paska postępu.Returns the value of theprogressMaxrecord component.Returns the value of theprogressValuerecord component.Returns the value of thestringValuerecord component.static InspectionPropertyStatyczna metoda fabrykująca do tworzenia standardowych etykiet tekstowych.static InspectionPropertytextColored(String label, String value, Color color) Statyczna metoda fabrykująca do tworzenia etykiet z wyróżnieniem kolorystycznym.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
label
The field for thelabelrecord component. -
stringValue
The field for thestringValuerecord component. -
progressValue
The field for theprogressValuerecord component. -
progressMax
The field for theprogressMaxrecord component. -
highlightColor
The field for thehighlightColorrecord component.
-
-
Constructor Details
-
InspectionProperty
public InspectionProperty(String label, String stringValue, Integer progressValue, Integer progressMax, Color highlightColor) Creates an instance of aInspectionPropertyrecord class.- Parameters:
label- the value for thelabelrecord componentstringValue- the value for thestringValuerecord componentprogressValue- the value for theprogressValuerecord componentprogressMax- the value for theprogressMaxrecord componenthighlightColor- the value for thehighlightColorrecord component
-
-
Method Details
-
text
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
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
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
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. All components in this record class are compared withObjects::equals(Object,Object). -
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-
stringValue
Returns the value of thestringValuerecord component.- Returns:
- the value of the
stringValuerecord component
-
progressValue
Returns the value of theprogressValuerecord component.- Returns:
- the value of the
progressValuerecord component
-
progressMax
Returns the value of theprogressMaxrecord component.- Returns:
- the value of the
progressMaxrecord component
-
highlightColor
Returns the value of thehighlightColorrecord component.- Returns:
- the value of the
highlightColorrecord component
-