Document Prolog predicate classes

For describing predicate parameters in the javadoc we use '+' as
indicator for input mode and '-' as indicator for output mode (see
[1,2]).

[1] https://www.swi-prolog.org/pldoc/man?section=preddesc
[2] https://stackoverflow.com/questions/4220651/question-mark-plus-minus-preceding-prolog-variable-names

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I3195563311fbca02b7f42100fa1e90a8fc90746d
This commit is contained in:
Edwin Kempin
2019-12-30 14:52:44 +01:00
parent 5a099946ac
commit e8e79c94cc
12 changed files with 141 additions and 2 deletions

View File

@@ -30,6 +30,20 @@ import com.googlecode.prolog_cafe.lang.Term;
import java.io.IOException;
import org.eclipse.jgit.lib.PersonIdent;
/**
* Abstract Prolog predicate for a Git person identity of a change.
*
* <p>Checks that the terms that are provided as input to this Prolog predicate match a Git person
* identity of the change (either author or committer).
*
* <p>The terms that are provided as input to this Prolog predicate are:
*
* <ul>
* <li>a user ID term that matches the account ID of the Git person identity
* <li>a string atom that matches the full name of the Git person identity
* <li>a string atom that matches the email of the Git person identity
* </ul>
*/
abstract class AbstractCommitUserIdentityPredicate extends Predicate.P3 {
private static final SymbolTerm user = SymbolTerm.intern("user", 1);
private static final SymbolTerm anonymous = SymbolTerm.intern("anonymous");

View File

@@ -23,6 +23,16 @@ import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.SymbolTerm;
import com.googlecode.prolog_cafe.lang.Term;
/**
* Prolog predicate for the destination branch of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is a string atom that
* matches the destination branch of the change.
*
* <pre>
* 'change_branch'(-Branch)
* </pre>
*/
public class PRED_change_branch_1 extends Predicate.P1 {
public PRED_change_branch_1(Term a1, Operation n) {
arg1 = a1;

View File

@@ -25,6 +25,16 @@ import com.googlecode.prolog_cafe.lang.StructureTerm;
import com.googlecode.prolog_cafe.lang.SymbolTerm;
import com.googlecode.prolog_cafe.lang.Term;
/**
* Prolog predicate for the owner of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is a user ID term that
* matches the account ID of the change owner.
*
* <pre>
* 'change_owner'(user(-ID))
* </pre>
*/
public class PRED_change_owner_1 extends Predicate.P1 {
private static final SymbolTerm user = SymbolTerm.intern("user", 1);

View File

@@ -23,6 +23,16 @@ import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.SymbolTerm;
import com.googlecode.prolog_cafe.lang.Term;
/**
* Prolog predicate for the project of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is a string atom that
* matches the project of the change.
*
* <pre>
* 'change_project'(-Project)
* </pre>
*/
public class PRED_change_project_1 extends Predicate.P1 {
public PRED_change_project_1(Term a1, Operation n) {
arg1 = a1;

View File

@@ -23,6 +23,16 @@ import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.SymbolTerm;
import com.googlecode.prolog_cafe.lang.Term;
/**
* Prolog predicate for the topic of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is a string atom that
* matches the topic of the change.
*
* <pre>
* 'change_topic'(-Topic)
* </pre>
*/
public class PRED_change_topic_1 extends Predicate.P1 {
public PRED_change_topic_1(Term a1, Operation n) {
arg1 = a1;

View File

@@ -21,6 +21,27 @@ import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.Term;
import org.eclipse.jgit.revwalk.RevCommit;
/**
* Prolog predicate for the Git author of the current patch set of a change.
*
* <p>Checks that the terms that are provided as input to this Prolog predicate match the Git author
* of the current patch set of the change.
*
* <p>The terms that are provided as input to this Prolog predicate are:
*
* <ul>
* <li>a user ID term that matches the account ID of the Git author of the current patch set of
* the change
* <li>a string atom that matches the full name of the Git author of the current patch set of the
* change
* <li>a string atom that matches the email of the Git author of the current patch set of the
* change
* </ul>
*
* <pre>
* 'commit_author'(user(-ID), -FullName, -Email)
* </pre>
*/
public class PRED_commit_author_3 extends AbstractCommitUserIdentityPredicate {
public PRED_commit_author_3(Term a1, Term a2, Term a3, Operation n) {
super(a1, a2, a3, n);

View File

@@ -21,6 +21,27 @@ import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.Term;
import org.eclipse.jgit.revwalk.RevCommit;
/**
* Prolog predicate for the Git committer of the current patch set of a change.
*
* <p>Checks that the terms that are provided as input to this Prolog predicate match the Git
* committer of the current patch set of the change.
*
* <p>The terms that are provided as input to this Prolog predicate are:
*
* <ul>
* <li>a user ID term that matches the account ID of the Git committer of the current patch set of
* the change
* <li>a string atom that matches the full name of the Git committer of the current patch set of
* the change
* <li>a string atom that matches the email of the Git committer of the current patch set of the
* change
* </ul>
*
* <pre>
* 'commit_committer'(user(-ID), -FullName, -Email)
* </pre>
*/
public class PRED_commit_committer_3 extends AbstractCommitUserIdentityPredicate {
public PRED_commit_committer_3(Term a1, Term a2, Term a3, Operation n) {
super(a1, a2, a3, n);

View File

@@ -24,7 +24,10 @@ import com.googlecode.prolog_cafe.lang.Term;
import org.eclipse.jgit.revwalk.RevCommit;
/**
* Returns the commit message as a symbol
* Prolog predicate for the commit message of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is a string atom that
* matches the commit message of the change.
*
* <pre>
* 'commit_message'(-Msg)

View File

@@ -24,6 +24,16 @@ import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.SymbolTerm;
import com.googlecode.prolog_cafe.lang.Term;
/**
* Prolog predicate for the default submit type of the project of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is a string atom that
* matches the default submit type of the change's project.
*
* <pre>
* 'project_default_submit_type'(-SubmitType)
* </pre>
*/
public class PRED_project_default_submit_type_1 extends Predicate.P1 {
private static final SymbolTerm[] term;

View File

@@ -22,7 +22,17 @@ import com.googlecode.prolog_cafe.lang.Predicate;
import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.Term;
/** Checks if change is a pure revert of the change it references in 'revertOf'. */
/**
* Prolog Predicate that checks if the change is a pure revert of the change it references in
* 'revertOf'.
*
* <p>The input is an integer atom where '1' represents a pure revert and '0' represents a non-pure
* revert.
*
* <pre>
* 'pure_revert'(-PureRevert)
* </pre>
*/
public class PRED_pure_revert_1 extends Predicate.P1 {
public PRED_pure_revert_1(Term a1, Operation n) {
arg1 = a1;

View File

@@ -22,6 +22,16 @@ import com.googlecode.prolog_cafe.lang.Predicate;
import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.Term;
/**
* Prolog predicate for the number of unresolved comments of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is an integer atom
* that matches the number of unresolved comments of the change.
*
* <pre>
* 'unresolved_comments_count'(-NumberOfUnresolvedComments)
* </pre>
*/
public class PRED_unresolved_comments_count_1 extends Predicate.P1 {
public PRED_unresolved_comments_count_1(Term a1, Operation n) {
arg1 = a1;

View File

@@ -27,6 +27,16 @@ import com.googlecode.prolog_cafe.lang.StructureTerm;
import com.googlecode.prolog_cafe.lang.SymbolTerm;
import com.googlecode.prolog_cafe.lang.Term;
/**
* Prolog predicate for the uploader of the current patch set of a change.
*
* <p>Checks that the term that is provided as input to this Prolog predicate is a user ID term that
* matches the account ID of the uploader of the current patch set.
*
* <pre>
* 'uploader'(user(-ID))
* </pre>
*/
public class PRED_uploader_1 extends Predicate.P1 {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();