Package com.cedarsoft.commons.struct

Examples of com.cedarsoft.commons.struct.Node


  public Node findNode( @NotNull Path path ) throws ChildNotFoundException {
    if ( !path.isAbsolute() ) {
      throw new IllegalArgumentException( "Path must be absolute to be resolved within the repository" );
    }

    Node current = getRootNode();
    for ( String element : path.getElements() ) {
      current = findChild( current, element );
    }
    return current;
  }
View Full Code Here


   * @param path the path
   * @return the node
   */
  @NotNull
  public Node getNode( @NotNull Path path ) {
    Node current = getRootNode();
    for ( String element : path.getElements() ) {
      try {
        current = findChild( current, element );
      } catch ( ChildNotFoundException ignore ) {
        DefaultNode created = new DefaultNode( element );
        current.addChild( created );
        current = created;
      }
    }
    return current;
  }
View Full Code Here

  public Node findNode( @Nonnull Path path ) throws ChildNotFoundException {
    if ( !path.isAbsolute() ) {
      throw new IllegalArgumentException( "Path must be absolute to be resolved within the repository" );
    }

    Node current = getRootNode();
    for ( String element : path.getElements() ) {
      current = findChild( current, element );
    }
    return current;
  }
View Full Code Here

   * @param path the path
   * @return the node
   */
  @Nonnull
  public Node getNode( @Nonnull Path path ) {
    Node current = getRootNode();
    for ( String element : path.getElements() ) {
      try {
        current = findChild( current, element );
      } catch ( ChildNotFoundException ignore ) {
        DefaultNode created = new DefaultNode( element );
        current.addChild( created );
        current = created;
      }
    }
    return current;
  }
View Full Code Here

    }

    for ( File dir : listDirsSorted( currentDir ) ) {
      String name = dir.getName();

      Node child = nodeFactory.createNode( name, Lookups.dynamicLookup( dir, node ) );
      node.addChild( child );

      parse( child, dir, nodeFactory, maxDepth - 1 );
    }
  }
View Full Code Here

  public Node findNode( @Nonnull Path path ) throws ChildNotFoundException {
    if ( !path.isAbsolute() ) {
      throw new IllegalArgumentException( "Path must be absolute to be resolved within the repository" );
    }

    Node current = getRootNode();
    for ( String element : path.getElements() ) {
      current = findChild( current, element );
    }
    return current;
  }
View Full Code Here

   * @param path the path
   * @return the node
   */
  @Nonnull
  public Node getNode( @Nonnull Path path ) {
    Node current = getRootNode();
    for ( String element : path.getElements() ) {
      try {
        current = findChild( current, element );
      } catch ( ChildNotFoundException ignore ) {
        DefaultNode created = new DefaultNode( element );
        current.addChild( created );
        current = created;
      }
    }
    return current;
  }
View Full Code Here

    }

    for ( File dir : listDirsSorted( currentDir ) ) {
      String name = dir.getName();

      Node child = nodeFactory.createNode( name, Lookups.dynamicLookup( dir, node ) );
      node.addChild( child );

      parse( child, dir, nodeFactory, maxDepth - 1 );
    }
  }
View Full Code Here

  public Node findNode( @Nonnull Class<? extends Page> pageClass ) {
    Queue<Node> queue = new ArrayDeque<Node>();
    queue.add( rootNode );

    while ( !queue.isEmpty() ) {
      Node current = queue.poll();
      if ( pageClass.equals( current.getLookup().lookup( Class.class ) ) ) {
        return current;
      }
      queue.addAll( current.getChildren() );
    }
    throw new IllegalArgumentException( "No Node found for " + pageClass );
  }
View Full Code Here

  public Node findNode( @NotNull Path path ) throws ChildNotFoundException {
    if ( !path.isAbsolute() ) {
      throw new IllegalArgumentException( "Path must be absolute to be resolved within the repository" );
    }

    Node current = getRootNode();
    for ( String element : path.getElements() ) {
      current = findChild( current, element );
    }
    return current;
  }
View Full Code Here

TOP

Related Classes of com.cedarsoft.commons.struct.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.