Class AiccPrerequisiteNode
- All Implemented Interfaces:
Serializable
This class is immutable and thread-safe.
The nodes are categorized by type using the AiccPrerequisiteNodeType, which defines their
logical or structural meaning, such as an identifier, logical operators, etc.
Attributes: - `type`: Indicates the type of the node (e.g. IDENTIFIER, AND, OR, NOT). - `value`: Represents the value associated with the node, if applicable (e.g. an identifier for a course/module). - `children`: A list of child nodes used to represent nested logical structures in the prerequisite expression.
Functionalities: - Supports creation of both leaf nodes and tree structures with children. - Provides equality, hash code, and string representation for comparing and describing the node. - Ensures immutability by copying and requiring non-null values for its components during initialization.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAiccPrerequisiteNode(AiccPrerequisiteNodeType type, String value, List<AiccPrerequisiteNode> children) Constructs an instance ofAiccPrerequisiteNoderepresenting a node in an AICC prerequisite expression tree. -
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieves the list of child nodes associated with this AICC prerequisite node.getType()Retrieves the type of this AICC prerequisite node.getValue()Retrieves the value of this AICC prerequisite node.inthashCode()static AiccPrerequisiteNodeCreates a newAiccPrerequisiteNoderepresenting a leaf node in the prerequisite expression tree.toString()
-
Constructor Details
-
AiccPrerequisiteNode
public AiccPrerequisiteNode(AiccPrerequisiteNodeType type, String value, List<AiccPrerequisiteNode> children) Constructs an instance ofAiccPrerequisiteNoderepresenting a node in an AICC prerequisite expression tree. A node can represent various logical operations (e.g., AND, OR, NOT) or a leaf node identified by an identifier value. The node may also have child nodes that define its hierarchical structure within the expression tree.- Parameters:
type- the type of the node, defining its role in the prerequisite expression tree. Must not be null.value- the value associated with the node. May be null for certain node types that do not require a specific value (e.g., AND, OR, NOT).children- the list of child nodes associated with this node. If null is provided, it will be replaced with an empty list.
-
-
Method Details
-
leaf
Creates a newAiccPrerequisiteNoderepresenting a leaf node in the prerequisite expression tree. The leaf node is identified by the specified value and is of typeAiccPrerequisiteNodeType.IDENTIFIER. It has no child nodes.- Parameters:
value- the identifier value for the leaf node, representing a specific course or module.- Returns:
- a new
AiccPrerequisiteNodeinstance of typeIDENTIFIERwith the specified value and no child nodes.
-
getType
Retrieves the type of this AICC prerequisite node. The type defines the role or behavior of the node within the prerequisite expression tree, such as whether it represents a logical operation (e.g., AND, OR, NOT) or an identifier.- Returns:
- the
AiccPrerequisiteNodeTyperepresenting the type of this prerequisite node
-
getValue
Retrieves the value of this AICC prerequisite node. The value typically represents an identifier or specific piece of data associated with the node.- Returns:
- the value of this node as a non-null string, or null if no value is assigned.
-
getChildren
Retrieves the list of child nodes associated with this AICC prerequisite node. The child nodes represent the subordinate elements in the prerequisite expression hierarchy.- Returns:
- a list of
AiccPrerequisiteNodeobjects representing the child nodes, or an empty list if this node has no children.
-
equals
-
hashCode
public int hashCode() -
toString
-