Class Scorm12Prerequisites

java.lang.Object
dev.jcputney.elearning.parser.input.scorm12.adl.Scorm12Prerequisites
All Implemented Interfaces:
Serializable

public final class Scorm12Prerequisites extends Object implements Serializable
Represents the <adlcp:prerequisites> element in SCORM 1.2. This element includes a string value and an optional type attribute.
See Also:
  • Constructor Details

    • Scorm12Prerequisites

      public Scorm12Prerequisites()
      Default constructor for the Scorm12Prerequisites class.

      This constructor initializes a new instance of the Scorm12Prerequisites class without assigning any initial values to its attributes. It is primarily used for creating an object in its default state.

  • Method Details

    • getValue

      public String getValue()
      Retrieves the string value of the prerequisites element.
      Returns:
      The string content of the "prerequisites" element.
    • setValue

      public void setValue(String value)
      Sets the string value of the prerequisites element.
      Parameters:
      value - The string content to set for the "prerequisites" element.
    • getType

      public String getType()
      Retrieves the type attribute of the "prerequisites" element.
      Returns:
      The type attribute of the "prerequisites" element, or null if not specified.
    • setType

      public void setType(String type)
      Sets the type attribute of the "prerequisites" element.
      Parameters:
      type - The type attribute to set for the "prerequisites" element. This value may represent a specification-dependent string, such as "aicc_script".
    • getParsedExpression

      public PrerequisiteExpression getParsedExpression()
      Parses the prerequisite value and returns a structured expression tree.

      This method parses the AICC script format used in SCORM 1.2 prerequisites. The AICC script supports:

      • & - AND operator
      • | - OR operator
      • ~ - NOT operator
      • Parentheses for grouping

      If the value is null or empty, or if the type is not "aicc_script", this method returns null. For malformed expressions, it returns a ParseError instead of throwing an exception.

      Returns:
      the parsed expression tree, a ParseError for invalid expressions, or null if no parsing is needed
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object