Class LevelIndex<T>

java.lang.Object
io.higson.runtime.engine.core.index.LevelIndex<T>
Type Parameters:
T - leaf type

public class LevelIndex<T> extends Object
Parameter index - tree structure for efficient parameter lookup.
Since:
1.0.0
Version:
1.0.6
Author:
Przemek Hertel
  • Constructor Details

    • LevelIndex

      public LevelIndex(int levelCount, Type<? extends ValueHolder>[] types, Matcher... matchers)
      Create new empty index with parameter metadata.
      Parameters:
      levelCount - number of levels (depth)
      types - types defined in levels
      matchers - used matchers
    • LevelIndex

      public LevelIndex(int levelCount)
      Create new empty index with default matchers and types.
      Parameters:
      levelCount - depth
  • Method Details

    • add

      public void add(String[] levelValues, T leaf)
      Add pattern along with returned value to index tree.
      Parameters:
      levelValues - table with String values
      leaf - leaf value
    • find

      public List<T> find(String[]... levelValues)
    • find

      public List<T> find(String... levelValues)
    • trim

      public void trim()
      Trims all leaf nodes.
    • printTree

      public String printTree()
    • getMatcher

      public Matcher getMatcher(int depth)
      Parameters:
      depth - size of matchers table
      Returns:
      matcher for given level index.
    • getType

      public Type<? extends ValueHolder> getType(int depth)
      Parameters:
      depth - size of types table
      Returns:
      type for given level index.
    • setUnion

      public void setUnion(boolean... union)
    • setMatchModes

      public void setMatchModes(MatchMode... modes)
    • getMatchMode

      public MatchMode getMatchMode(int depth)