Package it.univr.wordautomata.model
Class State
java.lang.Object
it.univr.wordautomata.model.State
- All Implemented Interfaces:
Serializable
,Comparable<State>
Represents a state in a
WordAutomata
.
It contains a label that identifies the state and a boolean property that
indicates if the state is final (accepting).- See Also:
-
Property Summary
TypePropertyDescriptionjavafx.beans.property.SimpleBooleanProperty
Returns the final property of the state. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Compares this state to another state based on their labels.boolean
Check if this state is equal to another object.javafx.beans.property.SimpleBooleanProperty
Returns the final property of the state.javafx.beans.property.SimpleStringProperty
getLabel()
Returns the label of the state.boolean
isFinal()
Returns true if the state is final, false otherwise.void
setFinal
(boolean value) Sets the final status of the state.void
Sets the label of the state.toString()
Returns the string representation of the state (its label).
-
Property Details
-
final
public javafx.beans.property.SimpleBooleanProperty finalPropertyReturns the final property of the state.- See Also:
-
-
Constructor Details
-
State
Constructs a state with the given label and default final status (false).- Parameters:
label
- the label of the state- Throws:
IllegalArgumentException
- if the label is null or blank
-
State
Constructs a state with the given label and final status.- Parameters:
label
- the label of the stateisFinal
- true if the state is final, false otherwise- Throws:
IllegalArgumentException
- if the label is null or blank
-
-
Method Details
-
getLabel
public javafx.beans.property.SimpleStringProperty getLabel()Returns the label of the state.- Returns:
- the label of the state
-
isFinal
public boolean isFinal()Returns true if the state is final, false otherwise.- Returns:
- true if the state is final, false otherwise
-
setFinal
public void setFinal(boolean value) Sets the final status of the state.- Parameters:
value
- true if the state is final, false otherwise
-
finalProperty
public javafx.beans.property.SimpleBooleanProperty finalProperty()Returns the final property of the state.- Returns:
- the final property of the state
- See Also:
-
setLabel
Sets the label of the state.- Parameters:
label
- the label of the state
-
toString
Returns the string representation of the state (its label). -
compareTo
Compares this state to another state based on their labels.- Specified by:
compareTo
in interfaceComparable<State>
- Parameters:
other
- the other state to compare to- Returns:
- a negative integer, zero, or a positive integer as this state is less than, equal to, or greater than the other state
-
equals
Check if this state is equal to another object.
-