Class State

java.lang.Object
it.univr.wordautomata.model.State
All Implemented Interfaces:
Serializable, Comparable<State>

public class State extends Object implements Comparable<State>, Serializable
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

    Properties
    Type
    Property
    Description
    javafx.beans.property.SimpleBooleanProperty
    Returns the final property of the state.
  • Constructor Summary

    Constructors
    Constructor
    Description
    State(String label)
    Constructs a state with the given label and default final status (false).
    State(String label, boolean isFinal)
    Constructs a state with the given label and final status.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    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
    Returns the label of the state.
    boolean
    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.
    Returns the string representation of the state (its label).

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Property Details

  • Constructor Details

    • State

      public State(String label)
      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

      public State(String label, boolean isFinal)
      Constructs a state with the given label and final status.
      Parameters:
      label - the label of the state
      isFinal - 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

      public void setLabel(String label)
      Sets the label of the state.
      Parameters:
      label - the label of the state
    • toString

      public String toString()
      Returns the string representation of the state (its label).
      Overrides:
      toString in class Object
      Returns:
      the string representation of the state
    • compareTo

      public int compareTo(State other)
      Compares this state to another state based on their labels.
      Specified by:
      compareTo in interface Comparable<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

      public boolean equals(Object o)
      Check if this state is equal to another object.
      Overrides:
      equals in class Object
      Returns:
      true if the object is a state and has the same label, false otherwise