Record Class TasksTUI.State
java.lang.Object
java.lang.Record
com.guinetik.hexafun.examples.tasks.tui.TasksTUI.State
- Enclosing class:
- TasksTUI
public static record TasksTUI.State(TaskApp app, int width, String status, String statusColor, boolean running)
extends Record
Immutable TUI state. All state transitions return new State instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapp()Returns the value of theapprecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static TasksTUI.StateCreate initial statebooleanisKanban()Derived statebooleanrunning()Returns the value of therunningrecord component.status()Returns the value of thestatusrecord component.Returns the value of thestatusColorrecord component.stop()tasks()final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.withStatus(String msg, String color) State transitions - all return new StatewithWidth(int w)
-
Constructor Details
-
State
Creates an instance of aStaterecord class.- Parameters:
app- the value for theapprecord componentwidth- the value for thewidthrecord componentstatus- the value for thestatusrecord componentstatusColor- the value for thestatusColorrecord componentrunning- the value for therunningrecord component
-
-
Method Details
-
initial
Create initial state -
withStatus
State transitions - all return new State -
withWidth
-
refreshWidth
-
stop
-
isKanban
public boolean isKanban()Derived state -
tasks
-
byStatus
-
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 '=='. -
app
Returns the value of theapprecord component.- Returns:
- the value of the
apprecord component
-
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
statusColor
Returns the value of thestatusColorrecord component.- Returns:
- the value of the
statusColorrecord component
-
running
public boolean running()Returns the value of therunningrecord component.- Returns:
- the value of the
runningrecord component
-