|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jason.asSyntax.ASSyntax
public class 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]");
Constructor Summary | |
---|---|
ASSyntax()
|
Method Summary | |
---|---|
static Atom |
createAtom(java.lang.String functor)
creates a new Atom term (an atom is a structure with 0-arity) |
static ListTerm |
createList(java.util.Collection<Term> terms)
Creates a new list from a collection of terms (each element of the collection is cloned) |
static ListTerm |
createList(Term... terms)
Creates a new list with n elements, n can be 0 |
static Literal |
createLiteral(boolean positive,
java.lang.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(java.lang.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 term |
static Rule |
createRule(Literal head,
LogicalFormula body)
Creates a new rule with a head and a body |
static StringTerm |
createString(java.lang.Object o)
creates a new string term using .toString() of the parameter |
static StringTerm |
createString(java.lang.String s)
creates a new string term |
static Structure |
createStructure(java.lang.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 |
createVar()
creates a new anonymous (or unnamed) variable |
static VarTerm |
createVar(java.lang.String functor)
creates a new variable term |
static LogicalFormula |
parseFormula(java.lang.String sExpr)
creates a new logical formula by parsing a string |
static ListTerm |
parseList(java.lang.String sList)
creates a new list by parsing a string |
static Literal |
parseLiteral(java.lang.String sLiteral)
creates a new literal by parsing a string |
static NumberTerm |
parseNumber(java.lang.String sNumber)
creates a new number term by parsing a string |
static Plan |
parsePlan(java.lang.String sPlan)
creates a new plan by parsing a string |
static PlanBody |
parsePlanBody(java.lang.String sPlanBody)
creates a new plan body by parsing a string |
static Rule |
parseRule(java.lang.String sRule)
creates a new rule by parsing a string |
static Structure |
parseStructure(java.lang.String sStructure)
creates a new structure (a kind of term) by parsing a string |
static Term |
parseTerm(java.lang.String sTerm)
creates a new term by parsing a string |
static Trigger |
parseTrigger(java.lang.String sTe)
creates a new trigger by parsing a string |
static VarTerm |
parseVar(java.lang.String sVar)
creates a new variable by parsing a string |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ASSyntax()
Method Detail |
---|
public static Literal createLiteral(java.lang.String functor, Term... terms)
public static Literal createLiteral(boolean positive, java.lang.String functor, Term... terms)
public static Structure createStructure(java.lang.String functor, Term... terms)
public static Atom createAtom(java.lang.String functor)
public static NumberTerm createNumber(double vl)
public static StringTerm createString(java.lang.String s)
public static StringTerm createString(java.lang.Object o)
public static VarTerm createVar(java.lang.String functor)
public static VarTerm createVar()
public static ListTerm createList(Term... terms)
public static ListTerm createList(java.util.Collection<Term> terms)
public static Rule createRule(Literal head, LogicalFormula body)
public static Literal parseLiteral(java.lang.String sLiteral) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static NumberTerm parseNumber(java.lang.String sNumber) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public static Structure parseStructure(java.lang.String sStructure) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static VarTerm parseVar(java.lang.String sVar) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static Term parseTerm(java.lang.String sTerm) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static Plan parsePlan(java.lang.String sPlan) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static PlanBody parsePlanBody(java.lang.String sPlanBody) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static Trigger parseTrigger(java.lang.String sTe) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static ListTerm parseList(java.lang.String sList) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static LogicalFormula parseFormula(java.lang.String sExpr) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
public static Rule parseRule(java.lang.String sRule) throws jason.asSyntax.parser.ParseException
jason.asSyntax.parser.ParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |