java.lang.Object
com.aquima.interactions.expressions.tsl.evaluator.nodes.ForeachNode
All Implemented Interfaces:
ITslNode

public class ForeachNode extends Object implements ITslNode
This node is responsible for iterating over instances and evaluating the contents for each instance.
Since:
5.0
Author:
O. Kerpershoek
  • Constructor Details

    • ForeachNode

      public ForeachNode(String typeName, IExpr fromNode, IExpr whereCondition, String orderBy, boolean ascending, ITslNode contentNode)
      Constructs the node with the required arguments.
      Parameters:
      typeName - The type of the instance that is iterated over.
      fromNode - The expression that results in a list of instances.
      whereCondition - The condition that should be evaluated for each instance.
      orderBy - The attribute and direction that should be used to sort the instances.
      ascending - a boolean indicating if the instances should be sorted ascending.
      contentNode - The contents that should be expanded for each instance.
  • Method Details

    • getTypeName

      public String getTypeName()
      This method returns the type of the instance that is iterated over.
      Returns:
      the type of the instance that is iterated over.
    • getFromExpression

      public IExpr getFromExpression()
      This method returns the expression that should be used to collect the instances.
      Returns:
      the expression that should be used to collect the instances.
    • getWhereCondition

      public IExpr getWhereCondition()
      This method returns the condition that should be applied to each instance.
      Returns:
      the condition that should be applied to each instance.
    • getOrderBy

      public String getOrderBy()
      This method returns the name of the attribute that should be used to sort the instances on.
      Returns:
      the name of the attribute that should be used to sort the instances on.
    • isOrderedAscending

      public boolean isOrderedAscending()
      This method returns a boolean indicating if the instances should be sorted ascending.
      Returns:
      a boolean indicating if the instances should be sorted ascending.
    • getContent

      public ITslNode getContent()
      This method returns the contents that should be expanded for each instance.
      Returns:
      the contents that should be expanded for each instance.
    • expand

      public void expand(IValueSource source, OutputBuffer output, ILanguage language)
      Description copied from interface: ITslNode
      The expand method should evaluate the node for the given language, and append the result to the output buffer supplied. When the node also contains child elements, this expand method should invoke the child elements too.
      Specified by:
      expand in interface ITslNode
      Parameters:
      source - Object containing the values for the current domain.
      output - The output buffer the result of this node should be appended to.
      language - The language for which the node should be evaluated.
    • sortValues

      protected IValue[] sortValues(IValue... values)
    • visit

      public void visit(ITslNodeVisitor visitor)
      Description copied from interface: ITslNode
      This method allows visitation of the node. The visit method will not invoke the visitor for any child nodes.
      Specified by:
      visit in interface ITslNode
      Parameters:
      visitor - The visitor that should be invoked for this node.
    • toString

      public String toString()
      Overrides:
      toString in class Object