org.eclipse.aether.util.graph.visitor

## Class PreorderNodeListGenerator

- java.lang.Object
- - org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator

- All Implemented Interfaces:
    DependencyVisitor

      public final class PreorderNodeListGenerator
      extends Object

  Generates a sequence of dependency nodes from a dependeny graph by traversing the graph in preorder. This visitor visits each node exactly once regardless how many paths within the dependency graph lead to the node such that the resulting node sequence is free of duplicates.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<DependencyNode>` | `nodes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PreorderNodeListGenerator()` Creates a new preorder list generator.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<Artifact>` | `getArtifacts(boolean includeUnresolved)` Gets the artifacts associated with the list of dependency nodes generated during the graph traversal.
    `String` | `getClassPath()` Gets a class path by concatenating the artifact files of the visited dependency nodes.
    `List<Dependency>` | `getDependencies(boolean includeUnresolved)` Gets the dependencies seen during the graph traversal.
    `List<File>` | `getFiles()` Gets the files of resolved artifacts seen during the graph traversal.
    `List<DependencyNode>` | `getNodes()` Gets the list of dependency nodes that was generated during the graph traversal.
    `protected boolean` | `setVisited(DependencyNode node)` Marks the specified node as being visited and determines whether the node has been visited before.
    `boolean` | `visitEnter(DependencyNode node)` Notifies the visitor of a node visit before its children have been processed.
    `boolean` | `visitLeave(DependencyNode node)` Notifies the visitor of a node visit after its children have been processed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### nodes

          protected final List<DependencyNode> nodes

  - ### Constructor Detail

    - #### PreorderNodeListGenerator

          public PreorderNodeListGenerator()

      Creates a new preorder list generator.

  - ### Method Detail

    - #### visitEnter

          public boolean visitEnter(DependencyNode node)

      Description copied from interface: `DependencyVisitor`
      Notifies the visitor of a node visit before its children have been processed.
      Specified by:
        `visitEnter` in interface `DependencyVisitor`
      Parameters:
        `node` - The dependency node being visited, must not be `null`.
      Returns:
        `true` to visit child nodes of the specified node as well, `false` to skip children.

    - #### visitLeave

          public boolean visitLeave(DependencyNode node)

      Description copied from interface: `DependencyVisitor`
      Notifies the visitor of a node visit after its children have been processed. Note that this method is always invoked regardless whether any children have actually been visited.
      Specified by:
        `visitLeave` in interface `DependencyVisitor`
      Parameters:
        `node` - The dependency node being visited, must not be `null`.
      Returns:
        `true` to visit siblings nodes of the specified node as well, `false` to skip siblings.

    - #### getNodes

          public List<DependencyNode> getNodes()

      Gets the list of dependency nodes that was generated during the graph traversal.
      Returns:
        The list of dependency nodes, never `null`.

    - #### getDependencies

          public List<Dependency> getDependencies(boolean includeUnresolved)

      Gets the dependencies seen during the graph traversal.
      Parameters:
        `includeUnresolved` - Whether unresolved dependencies shall be included in the result or not.
      Returns:
        The list of dependencies, never `null`.

    - #### getArtifacts

          public List<Artifact> getArtifacts(boolean includeUnresolved)

      Gets the artifacts associated with the list of dependency nodes generated during the graph traversal.
      Parameters:
        `includeUnresolved` - Whether unresolved artifacts shall be included in the result or not.
      Returns:
        The list of artifacts, never `null`.

    - #### getFiles

          public List<File> getFiles()

      Gets the files of resolved artifacts seen during the graph traversal.
      Returns:
        The list of artifact files, never `null`.

    - #### getClassPath

          public String getClassPath()

      Gets a class path by concatenating the artifact files of the visited dependency nodes. Nodes with unresolved artifacts are automatically skipped.
      Returns:
        The class path, using the platform-specific path separator, never `null`.

    - #### setVisited

          protected boolean setVisited(DependencyNode node)

      Marks the specified node as being visited and determines whether the node has been visited before.
      Parameters:
        `node` - The node being visited, must not be `null`.
      Returns:
        `true` if the node has not been visited before, `false` if the node was already visited.

Copyright © 2010-2014 The Eclipse Foundation. All Rights Reserved.