Class ModuleNode

  • All Implemented Interfaces:
    Serializable

    public final class ModuleNode
    extends Node
    A Node which represents a module of a project.
    Author:
    Melissa Bauer
    See Also:
    Serialized Form
    • Constructor Detail

      • ModuleNode

        public ModuleNode​(String name)
        Creates a new module node with the given name.
        Parameters:
        name - the name of the module
    • Method Detail

      • copy

        public ModuleNode copy()
        Description copied from class: Node
        Creates a copy of this instance that has no children and no parent yet. Node properties from the parent class Node must not be copied. All other immutable properties need to be copied one by one.
        Specified by:
        copy in class Node
        Returns:
        the copied node
      • getSourceFolders

        public Set<String> getSourceFolders()
        Description copied from class: Node
        Returns a collection of source folders that contain the source code files of all file nodes.
        Overrides:
        getSourceFolders in class Node
        Returns:
        a collection of source folders
      • addSource

        public void addSource​(String source)
        Appends the specified source to the list of sources.
        Parameters:
        source - the source to add
      • splitPackages

        public void splitPackages()
        Splits flat packages into a package hierarchy. Changes the internal tree structure of package nodes in place.

        Examples:

        • A package name "edu" will produce a single node with the name "edu".
        • A package name "edu.hm.hafner" will produce three package nodes, that are linked together, starting with the "edu" package ("edu" -> "hm" -> "hafner").
      • createPackageNode

        public PackageNode createPackageNode​(String packageName)
        Create a new package node with the given name and add it to the list of children.
        Parameters:
        packageName - the package name
        Returns:
        the created and linked package node
      • findOrCreatePackageNode

        public PackageNode findOrCreatePackageNode​(String packageName)
        Searches for the specified package node. If the package node is not found then a new package node will be created and linked to this module node.
        Parameters:
        packageName - the package name
        Returns:
        the existing or created package node
        See Also:
        createPackageNode(String)
      • equals

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

        public int hashCode()
        Overrides:
        hashCode in class Node