Class PrologRuleEvaluator


  • public class PrologRuleEvaluator
    extends Object
    Evaluates a submit-like Prolog rule found in the rules.pl file of the current project and filters the results through rules found in the parent projects, all the way up to All-Projects.
    • Method Detail

      • evaluate

        public SubmitRecord evaluate()
        Evaluate the submit rules.
        Returns:
        SubmitRecord returned from the evaluated rules. Can include errors.
      • resultsToSubmitRecord

        public SubmitRecord resultsToSubmitRecord​(com.googlecode.prolog_cafe.lang.Term submitRule,
                                                  List<com.googlecode.prolog_cafe.lang.Term> results)
        Convert the results from Prolog Cafe's format to Gerrit's common format.

        can_submit/1 terminates when an ok(P) record is found. Therefore walk the results backwards, using only that ok(P) record if it exists. This skips partial results that occur early in the output. Later after the loop the out collection is reversed to restore it to the original ordering.

      • getSubmitType

        public SubmitTypeRecord getSubmitType()
        Evaluate the submit type rules to get the submit type.
        Returns:
        record from the evaluated rules.