All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jason.asSemantics.DefaultInternalAction Maven / Gradle / Ivy

Go to download

Jason is a fully-fledged interpreter for an extended version of AgentSpeak, a BDI agent-oriented logic programming language.

There is a newer version: 2.3
Show newest version
package jason.asSemantics;

import jason.JasonException;
import jason.asSyntax.Literal;
import jason.asSyntax.Term;

import java.io.Serializable;

/**
 * Default implementation of the internal action interface (it simply returns false 
 * for the interface methods).
 * 
 * Useful to create new internal actions.
 * 
 * @author Jomi
 */
public class DefaultInternalAction implements InternalAction, Serializable {
    
    private static final long serialVersionUID = 1L;

    public boolean suspendIntention()   { return false;  }
    public boolean canBeUsedInContext() { return true;  }

    public int getMinArgs() { return 0; }
    public int getMaxArgs() { return Integer.MAX_VALUE; }
    
    protected void checkArguments(Term[] args) throws JasonException {
        if (args.length < getMinArgs() || args.length > getMaxArgs())
            throw JasonException.createWrongArgumentNb(this);            
    }
    
    public Term[] prepareArguments(Literal body, Unifier un) {
        Term[] terms = new Term[body.getArity()];
        for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy