jason.functions.tan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jason Show documentation
Show all versions of jason Show documentation
Jason is a fully-fledged interpreter for an extended version of AgentSpeak, a BDI agent-oriented logic programming language.
package jason.functions;
import jason.JasonException;
import jason.asSemantics.DefaultArithFunction;
import jason.asSemantics.TransitionSystem;
import jason.asSyntax.NumberTerm;
import jason.asSyntax.Term;
/**
Function: math.tan(N)
: encapsulates java Math.tan(N),
returns the trigonometric tangent of an angle.
@author Jomi
*/
public class tan extends DefaultArithFunction {
public String getName() {
return "math.tan";
}
@Override
public double evaluate(TransitionSystem ts, Term[] args) throws Exception {
if (args[0].isNumeric()) {
return Math.tan(((NumberTerm)args[0]).solve());
} else {
throw new JasonException("The argument '"+args[0]+"' is not numeric!");
}
}
@Override
public boolean checkArity(int a) {
return a == 1;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy