Class AiccPrerequisiteExpression
java.lang.Object
dev.jcputney.elearning.parser.input.aicc.prereq.AiccPrerequisiteExpression
- All Implemented Interfaces:
Serializable
Represents an AICC prerequisite expression used in specifying conditions for course
prerequisites. This class encapsulates raw expressions, metadata about required and optional
course components, and parsed details of the expression syntax and structure to facilitate
evaluation and validation.
- Raw Expression: The original prerequisite expression in string form.
- Mandatory: Whether the prerequisite is a mandatory condition.
- Referenced AU IDs: A list of course component identifiers referenced in the expression.
- Optional AU IDs: A list of course components marked as optional within the expression.
- Tokens: A set of tokens obtained from parsing the prerequisite expression in infix form.
- Postfix Tokens: A set of tokens in postfix form for evaluation purposes.
- Abstract Syntax Tree (AST): A representation of the expression's structure for conditional evaluation.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAiccPrerequisiteExpression(String rawExpression, boolean mandatory, List<String> referencedAuIds, List<String> optionalAuIds, List<AiccPrerequisiteToken> tokens, List<AiccPrerequisiteToken> postfixTokens, AiccPrerequisiteNode ast) Constructs an instance of AiccPrerequisiteExpression with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAst()Retrieves the abstract syntax tree (AST) representation of the AICC prerequisite expression.Retrieves the list of optional AU (Assignable Unit) IDs that are part of the prerequisite expression.Retrieves the list of tokens that represent the postfix notation of the AICC prerequisite expression.Retrieves the raw prerequisite expression as provided during the creation of this instance.Retrieves the list of referenced AU (Assignable Unit) IDs that are part of the prerequisite expression.Retrieves the list of tokens that are part of the AICC prerequisite expression.inthashCode()booleanDetermines whether the prerequisite expression is mandatory.static AiccPrerequisiteExpressionCreates a minimal instance of the AiccPrerequisiteExpression by initializing only the essential fields.toString()
-
Constructor Details
-
AiccPrerequisiteExpression
public AiccPrerequisiteExpression(String rawExpression, boolean mandatory, List<String> referencedAuIds, List<String> optionalAuIds, List<AiccPrerequisiteToken> tokens, List<AiccPrerequisiteToken> postfixTokens, AiccPrerequisiteNode ast) Constructs an instance of AiccPrerequisiteExpression with the specified parameters.- Parameters:
rawExpression- the raw prerequisite expression as a stringmandatory- a boolean indicating whether the prerequisite expression is mandatoryreferencedAuIds- a list of strings representing the referenced AU (Assignable Unit) IDs in the prerequisite expression; can be nulloptionalAuIds- a list of strings representing the optional AU (Assignable Unit) IDs in the prerequisite expression; can be nulltokens- a list of AiccPrerequisiteToken objects representing the tokens in the expression; can be nullpostfixTokens- a list of AiccPrerequisiteToken objects representing the tokens in postfix notation; can be nullast- the abstract syntax tree (AST) representing the prerequisite expression, as an AiccPrerequisiteNode instance; can be null
-
-
Method Details
-
minimal
Creates a minimal instance of the AiccPrerequisiteExpression by initializing only the essential fields.- Parameters:
rawExpression- the raw prerequisite expression as a stringmandatory- a boolean indicating whether the prerequisite expression is mandatory- Returns:
- an instance of AiccPrerequisiteExpression with minimal configuration
-
getRawExpression
Retrieves the raw prerequisite expression as provided during the creation of this instance.- Returns:
- the raw prerequisite expression as a string
-
isMandatory
public boolean isMandatory()Determines whether the prerequisite expression is mandatory.- Returns:
- true if the prerequisite is mandatory, false otherwise
-
getReferencedAuIds
Retrieves the list of referenced AU (Assignable Unit) IDs that are part of the prerequisite expression.- Returns:
- a list of strings, each representing a referenced AU ID.
-
getOptionalAuIds
Retrieves the list of optional AU (Assignable Unit) IDs that are part of the prerequisite expression.- Returns:
- a list of strings, each representing an optional AU ID.
-
getTokens
Retrieves the list of tokens that are part of the AICC prerequisite expression.- Returns:
- a list of
AiccPrerequisiteTokenobjects representing the tokens in the expression.
-
getPostfixTokens
Retrieves the list of tokens that represent the postfix notation of the AICC prerequisite expression. Postfix notation is a mathematical notation in which operators follow their operands. This list represents the parsed expression in a format suitable for evaluation or further processing.- Returns:
- a list of
AiccPrerequisiteTokenobjects, each representing a token in the postfix notation of the prerequisite expression.
-
getAst
Retrieves the abstract syntax tree (AST) representation of the AICC prerequisite expression. The AST is a hierarchical structure ofAiccPrerequisiteNodeobjects that defines the logical composition of the prerequisite expression, including its operators and components.- Returns:
- the root node of the abstract syntax tree, represented as an instance of
AiccPrerequisiteNode.
-
equals
-
hashCode
public int hashCode() -
toString
-