Class LhsRhsMatchLoop


  • public class LhsRhsMatchLoop
    extends java.lang.Object
    A generic loop over LHS/RHS matches determining which combinations need a build. Upon such collections, an Applicator is called to perform specific actions.
    Author:
    Holger Eichelberger
    • Constructor Summary

      Constructors 
      Constructor Description
      LhsRhsMatchLoop()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean buildNeeded​(java.lang.Object lhsValue, java.lang.Object rhsValue)
      Returns whether a build is needed to turn rhsValue into lhsValue.
      static void matchLoop​(Rule rule, java.lang.Object[] rhsValues, Applicator applicator, ITracer tracer)
      Loops over the LHS/RHS matches and calls the applicator for each match.
      • Methods inherited from class java.lang.Object

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

      • LhsRhsMatchLoop

        public LhsRhsMatchLoop()
    • Method Detail

      • matchLoop

        public static void matchLoop​(Rule rule,
                                     java.lang.Object[] rhsValues,
                                     Applicator applicator,
                                     ITracer tracer)
                              throws VilException
        Loops over the LHS/RHS matches and calls the applicator for each match.
        Parameters:
        rule - the rule to loop over
        rhsValues - the already determined values for the RHS matching conditions (in case that there are multiple, may be null or empty)
        applicator - the applicator instance to be called on each match requiring a build
        tracer - the tracer instance (needed to reorder the match sequence if required)
        Throws:
        VilException - in case that determining the expected LHS value or applying the applicator fails
      • buildNeeded

        private static boolean buildNeeded​(java.lang.Object lhsValue,
                                           java.lang.Object rhsValue)
        Returns whether a build is needed to turn rhsValue into lhsValue. Actually, both values are determined as values from visiting AbstractRuleMatchExpressions and, therefore, are objects (internally artifacts).
        Parameters:
        lhsValue - the (expected) individual value to be produced by a rule
        rhsValue - the individual input determined by a matching precondition
        Returns:
        true if a build is needed because lhsValue does not exist or is outdated, false if a build is not needed