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

jason.stdlib.number 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.stdlib;

import jason.asSemantics.DefaultInternalAction;
import jason.asSemantics.InternalAction;
import jason.asSemantics.TransitionSystem;
import jason.asSemantics.Unifier;
import jason.asSyntax.Term;

/**
  

Internal action: .number.

Description: checks whether the argument is a number.

Parameter:

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

Examples:

  • .number(10): true.
  • .number(10.34): true.
  • .number(b(10)): false.
  • .number("home page"): false.
  • .number(X): false if X is free, true if X is bound to a number.
@see jason.stdlib.atom @see jason.stdlib.list @see jason.stdlib.literal @see jason.stdlib.string @see jason.stdlib.structure @see jason.stdlib.ground */ public class number extends DefaultInternalAction { private static InternalAction singleton = null; public static InternalAction create() { if (singleton == null) singleton = new number(); return singleton; } @Override public int getMinArgs() { return 1; } @Override public int getMaxArgs() { return 1; } @Override public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception { checkArguments(args); return args[0].isNumeric(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy