java.lang.Object
dev.jcputney.elearning.parser.input.scorm2004.sequencing.ActivityTree
All Implemented Interfaces:
Serializable

public final class ActivityTree extends Object implements Serializable
Represents a SCORM 2004 Activity Tree.

An ActivityTree is a hierarchical structure of ActivityNodes that represents the organization of learning activities in a SCORM 2004 content package. It is built from the manifest and provides methods to navigate and manipulate the tree.

See Also:
  • Method Details

    • buildFromManifest

      public static ActivityTree buildFromManifest(Scorm2004Manifest manifest)
      Builds an ActivityTree from a SCORM 2004 manifest.
      Parameters:
      manifest - The manifest to build the tree from
      Returns:
      The built ActivityTree, or empty if no default organization is found
    • getNodeByIdentifier

      public ActivityNode getNodeByIdentifier(String identifier)
      Gets a node by its identifier.
      Parameters:
      identifier - The identifier of the node to get
      Returns:
      An Optional containing the node or empty if not found
    • getLeafNodes

      public List<ActivityNode> getLeafNodes()
      Gets all leaf nodes in the tree.
      Returns:
      A list of all leaf nodes
    • getRoot

      public ActivityNode getRoot()
      Gets the root node of the tree.
      Returns:
      The root node
    • setRoot

      public void setRoot(ActivityNode root)
      Sets the root node of the activity tree.
      Parameters:
      root - The new root node to be set for the activity tree
    • getNodeMap

      public Map<String,ActivityNode> getNodeMap()
      Retrieves the mapping of node identifiers to their corresponding activity nodes.
      Returns:
      A map where the keys are node identifiers and the values are ActivityNode objects.
    • setNodeMap

      public void setNodeMap(Map<String,ActivityNode> nodeMap)
      Sets the mapping of node identifiers to their corresponding activity nodes.
      Parameters:
      nodeMap - The map where the keys are node identifiers (as Strings) and the values are the corresponding ActivityNode objects.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object