Class PrefixTree


  • public class PrefixTree
    extends java.lang.Object
    Prefix tree for paths: if you step on a path prefix that exists, you are good to go. This class parses a text file that has a prefix on each line:
    • ignored/formatting - each line starting with '#' (hash) or being empty/blank is ignored.
    • a path prefix ie "/org/apache/maven".
    By default, artifact is allowed if layout converted path of it has a matching prefix in this file.

    Example prefix files:

    • Constructor Summary

      Constructors 
      Constructor Description
      PrefixTree​(java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acceptedPath​(java.lang.String path)  
      boolean isLeaf()  
      boolean loadNode​(java.lang.String line)
      Adds a line to the tree: it parses the URI-path-like element into list of segments elementsOfPath(String) cycles over the list, and marks last node added as leaf=true if already on leaf node, processing stops (shorter path wins)
      int loadNodes​(java.util.stream.Stream<java.lang.String> linesStream)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrefixTree

        public PrefixTree​(java.lang.String name)
    • Method Detail

      • isLeaf

        public boolean isLeaf()
      • loadNodes

        public int loadNodes​(java.util.stream.Stream<java.lang.String> linesStream)
      • loadNode

        public boolean loadNode​(java.lang.String line)
        Adds a line to the tree:
        • it parses the URI-path-like element into list of segments elementsOfPath(String)
        • cycles over the list, and marks last node added as leaf=true
        • if already on leaf node, processing stops (shorter path wins)
      • acceptedPath

        public boolean acceptedPath​(java.lang.String path)