Package jason.asSyntax
Class ASSyntax
java.lang.Object
jason.asSyntax.ASSyntax
Factory for objects used in Jason AgentSpeak syntax.
Examples of Term:
import static jason.asSyntax.ASSyntax.*; ... Atom a = createAtom("a"); NumberTerm n = createNumber(3); StringTerm s = createString("s"); Structure t = createStructure("p", createAtom("a")); // t = p(a) ListTerm l = createList(); // empty list ListTerm f = createList(createAtom("a"), createStructure("b", createNumber(5))); // f = [a,b(5)] // or use a parsing (easier but slower) Term n = parseTerm("5"); Term t = parseTerm("p(a)"); Term l = parseTerm("[a,b(5)]");
Examples of Literal:
import static jason.asSyntax.ASSyntax.*; ... // create the literal 'p' Literal l1 = createLiteral("p"); // create the literal 'p(a,3)' Literal l2 = createLiteral("p", createAtom("a"), createNumber(3)); // create the literal 'p(a,3)[s,"s"]' Literal l3 = createLiteral("p", createAtom("a"), createNumber(3)) .addAnnots(createAtom("s"), createString("s")); // create the literal '~p(a,3)[s,"s"]' Literal l4 = createLiteral(Literal.LNeg, "p", createAtom("a"), createNumber(3)) .addAnnots(createAtom("s"), createString("s")); // or use the parser (easier but slower) Literal l4 = parseLiteral("~p(a,3)[s]");
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static Atom
createAtom
(String functor) creates a new Atom term (an atom is a structure with 0-arity)static ListTerm
createList
(Term... terms) Creates a new list with n elements, n can be 0static ListTerm
createList
(Collection<Term> terms) Creates a new list from a collection of terms (each element of the collection is cloned)static Literal
createLiteral
(boolean positive, String functor, Term... terms) Creates a new literal, the first argument is either Literal.LPos or Literal.LNeg, the second is the functor (a string), and the n remainder arguments are terms.static Literal
createLiteral
(Atom namespace, boolean positive, String functor, Term... terms) Creates a new literal, the first argument is the namespace, the second is either Literal.LPos or Literal.LNeg, the third is the functor (a string), and the n remainder arguments are terms.static Literal
createLiteral
(Atom namespace, String functor, Term... terms) static Literal
createLiteral
(String functor, Term... terms) Creates a new positive literal, the first argument is the functor (a string) and the n remainder arguments are terms.static NumberTerm
createNumber
(double vl) creates a new number termstatic Rule
createRule
(Literal head, LogicalFormula body) Creates a new rule with a head and a bodystatic StringTerm
creates a new string term using .toString() of the parameterstatic StringTerm
creates a new string termstatic Structure
createStructure
(String functor, Term... terms) Creates a new structure (compound) term, the first argument is the functor (a string), and the n remainder arguments are terms.static VarTerm
creates a new anonymous (or unnamed) variablestatic VarTerm
creates a new variable term (possibly negated)static VarTerm
creates a new variable term in a namespacestatic VarTerm
creates a new variable termstatic boolean
static LogicalFormula
parseFormula
(String sExpr) creates a new logical formula by parsing a stringstatic ListTerm
creates a new list by parsing a stringstatic Literal
parseLiteral
(String sLiteral) creates a new literal by parsing a stringstatic NumberTerm
parseNumber
(String sNumber) creates a new number term by parsing a stringstatic Plan
creates a new plan by parsing a stringstatic PlanBody
parsePlanBody
(String sPlanBody) creates a new plan body by parsing a stringstatic Rule
creates a new rule by parsing a stringstatic Structure
parseStructure
(String sStructure) creates a new structure (a kind of term) by parsing a stringstatic Term
creates a new term by parsing a stringstatic Trigger
parseTrigger
(String sTe) creates a new trigger by parsing a stringstatic VarTerm
creates a new variable by parsing a stringstatic Object
termToObject
(Term t) Convert a Jason term into a Java Object
-
Field Details
-
hardDeadLineStr
- See Also:
-
-
Constructor Details
-
ASSyntax
public ASSyntax()
-
-
Method Details
-
addKeyword
-
isKeyword
-
createLiteral
Creates a new positive literal, the first argument is the functor (a string) and the n remainder arguments are terms. see documentation of this class for examples of use. -
createLiteral
-
createLiteral
Creates a new literal, the first argument is either Literal.LPos or Literal.LNeg, the second is the functor (a string), and the n remainder arguments are terms. see documentation of this class for examples of use. -
createLiteral
public static Literal createLiteral(Atom namespace, boolean positive, String functor, Term... terms) Creates a new literal, the first argument is the namespace, the second is either Literal.LPos or Literal.LNeg, the third is the functor (a string), and the n remainder arguments are terms. see documentation of this class for examples of use. -
createStructure
Creates a new structure (compound) term, the first argument is the functor (a string), and the n remainder arguments are terms. -
createAtom
creates a new Atom term (an atom is a structure with 0-arity) -
createNumber
creates a new number term -
createString
creates a new string term -
createString
creates a new string term using .toString() of the parameter -
createVar
creates a new variable term -
createVar
creates a new variable term in a namespace -
createVar
creates a new variable term (possibly negated) -
createVar
creates a new anonymous (or unnamed) variable -
createList
Creates a new list with n elements, n can be 0 -
createList
Creates a new list from a collection of terms (each element of the collection is cloned) -
createRule
Creates a new rule with a head and a body -
parseLiteral
creates a new literal by parsing a string- Throws:
ParseException
TokenMgrError
-
parseNumber
creates a new number term by parsing a string- Throws:
NumberFormatException
-
parseStructure
creates a new structure (a kind of term) by parsing a string- Throws:
ParseException
TokenMgrError
-
parseVar
creates a new variable by parsing a string- Throws:
ParseException
TokenMgrError
-
parseTerm
creates a new term by parsing a string- Throws:
ParseException
TokenMgrError
-
parsePlan
creates a new plan by parsing a string- Throws:
ParseException
TokenMgrError
-
parsePlanBody
creates a new plan body by parsing a string- Throws:
ParseException
TokenMgrError
-
parseTrigger
creates a new trigger by parsing a string- Throws:
ParseException
TokenMgrError
-
parseList
creates a new list by parsing a string- Throws:
ParseException
TokenMgrError
-
parseFormula
creates a new logical formula by parsing a string- Throws:
ParseException
TokenMgrError
-
parseRule
creates a new rule by parsing a string- Throws:
ParseException
TokenMgrError
-
termToObject
Convert a Jason term into a Java Object- Parameters:
t
- Jason term
-