Class ListOfNodes

java.lang.Object
spoon.pattern.internal.node.AbstractNode
spoon.pattern.internal.node.ListOfNodes
All Implemented Interfaces:
Matchers, RootNode

public class ListOfNodes extends AbstractNode
List of RootNodes. The RootNodes are processed in same order like they were inserted in the list
  • Field Details

  • Constructor Details

  • Method Details

    • forEachParameterInfo

      public void forEachParameterInfo(BiConsumer<ParameterInfo,​RootNode> consumer)
      Description copied from interface: RootNode
      Calls consumer for each pair of parameter definition (ParameterInfo) and RootNode, which uses it
      Parameters:
      consumer - the receiver of pairs of ParameterInfo and RootNode
    • generateTargets

      public <T> void generateTargets(DefaultGenerator generator, ResultHolder<T> result, ImmutableMap parameters)
      Description copied from interface: RootNode
      Generates zero, one or more target depending on kind of this RootNode, expected `result` and input `parameters`
      Parameters:
      generator - Generator which drives generation process
      result - holder for the generated objects
      parameters - a ImmutableMap holding parameters
    • matchTargets

      public TobeMatched matchTargets(TobeMatched targets, Matchers nextMatchers)
      Parameters:
      targets - to be matched target nodes and input parameters
      nextMatchers - Chain of matchers which has to be processed after this RootNode
      Returns:
      new parameters and container with remaining targets
    • replaceNode

      public boolean replaceNode(RootNode oldNode, RootNode newNode)
      Description copied from interface: RootNode
      Call it to modify Pattern structure. It is actually called mainly by PatternBuilder. TODO: May be we can move this method into some internal interface?
      Parameters:
      oldNode - old RootNode
      newNode - new RootNode
      Returns:
      a true if `oldNode` was found in this RootNode or it's children and replaced by `newNode` false if `oldNode` was not found
    • getNodes

      public List<RootNode> getNodes()
      Returns:
      List of RootNodes of this ListOfNodes