Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package jason.stdlib;
 

Internal action: .ground.

Description: checks whether the argument is ground, i.e., it has no free variables. Numbers, Strings, and Atoms are always ground.

Parameters:

  • + argument (any term): the term to be checked.

Examples:

  • .ground(b(10)): true.
  • .ground(10): true.
  • .ground(X): false if X is free or bound to a term with free variables.
  • .ground(a(X)): false if X is free or bound to a term with free variables.
  • .ground([a,b,c]): true.
  • .ground([a,b,c(X)]): false if X is free or bound to a term with free variables.

public class ground extends DefaultInternalAction {
    private static InternalAction singleton = null;
    public static InternalAction create() {
        if ( == null
             = new ground();
        return ;
    }
    
    @Override public int getMinArgs() { return 1; }
    @Override public int getMaxArgs() { return 1; }
    @Override
    public Object execute(TransitionSystem tsUnifier unTerm[] argsthrows Exception {
        checkArguments(args);
        return args[0].isGround();
    }
New to GrepCode? Check out our FAQ X