Class AiccPrerequisiteToken

java.lang.Object
dev.jcputney.elearning.parser.input.aicc.prereq.AiccPrerequisiteToken
All Implemented Interfaces:
Serializable

public final class AiccPrerequisiteToken extends Object implements Serializable
Represents a token parsed from an AICC prerequisite expression. Each token has a specific type that determines its role in the expression, such as an identifier, operator, or parenthesis.

The token optionally supports additional characteristics, such as being optional or unary, to further describe its behavior and usage within the expression.

Instances of this class are immutable and thread-safe.

See Also:
  • Constructor Details

    • AiccPrerequisiteToken

      public AiccPrerequisiteToken(AiccPrerequisiteTokenType type, String value)
      Constructs an AiccPrerequisiteToken with the specified type and value. The optional and unary attributes default to false.
      Parameters:
      type - the type of the AICC prerequisite token, represented as AiccPrerequisiteTokenType. It must not be null.
      value - the value of the AICC prerequisite token, which may be null or a string representing a learning object, literal value, or other token-related content.
    • AiccPrerequisiteToken

      public AiccPrerequisiteToken(AiccPrerequisiteTokenType type, String value, boolean optional, boolean unary)
      Constructs an AiccPrerequisiteToken with the specified type, value, optional, and unary attributes.
      Parameters:
      type - the type of the AICC prerequisite token, represented as AiccPrerequisiteTokenType. It must not be null.
      value - the value of the AICC prerequisite token, which may be null or a string representing a learning object, literal value, or other token-related content.
      optional - a boolean value indicating whether the token is optional. If true, the token is optional; otherwise, it is required.
      unary - a boolean value indicating whether the token is unary. If true, the token is unary; otherwise, it is not.
  • Method Details

    • getType

      public AiccPrerequisiteTokenType getType()
      Retrieves the token type of this AICC prerequisite token.
      Returns:
      the type of the AICC prerequisite token, represented as an AiccPrerequisiteTokenType.
    • getValue

      public String getValue()
      Retrieves the value of this object.
      Returns:
      a string representing the value of this object, or null if no value is assigned.
    • isOptional

      public boolean isOptional()
      Indicates whether this token is optional.
      Returns:
      true if the token is optional, false otherwise
    • isUnary

      public boolean isUnary()
      Indicates whether this token is a unary token.
      Returns:
      true if the token is unary, false otherwise
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object