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

jason.functions.sin 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.functions;

import jason.JasonException;
import jason.asSemantics.DefaultArithFunction;
import jason.asSemantics.TransitionSystem;
import jason.asSyntax.NumberTerm;
import jason.asSyntax.Term;

/**
  

Function: math.sin(N): encapsulates java Math.sin(N), returns the trigonometric sine of an angle. @author Jomi */ public class sin extends DefaultArithFunction { public String getName() { return "math.sin"; } @Override public double evaluate(TransitionSystem ts, Term[] args) throws Exception { if (args[0].isNumeric()) { return Math.sin(((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 - 2024 Weber Informatics LLC | Privacy Policy