Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jason.asSyntax
Class ASSyntax

    java.lang.Object
      jason.asSyntax.ASSyntax

    public class ASSyntax

extends java.lang.Object

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

### ASSyntax

    public ASSyntax()

Method Detail

### createLiteral

    public 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. see documentation of this class for examples of use.

### createLiteral

    public 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. see documentation of this class for examples of use.

### createStructure

    public 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.

### createAtom

    public static Atom createAtom(java.lang.String functor)

  creates a new Atom term (an atom is a structure with 0-arity)

### createNumber

    public static NumberTerm createNumber(double vl)

  creates a new number term

### createString

    public static StringTerm createString(java.lang.String s)

  creates a new string term

### createString

    public static StringTerm createString(java.lang.Object o)

  creates a new string term using .toString() of the parameter

### createVar

    public static VarTerm createVar(java.lang.String functor)

  creates a new variable term

### createVar

    public static VarTerm createVar()

  creates a new anonymous (or unnamed) variable

### createList

    public static ListTerm createList(Term... terms)

  Creates a new list with n elements, n can be 0

### createList

    public static ListTerm createList(java.util.Collection<Term> terms)

  Creates a new list from a collection of terms (each element of the collection is cloned)

### createRule

    public static Rule createRule(Literal head,
                                  LogicalFormula body)

  Creates a new rule with a head and a body

### parseLiteral

    public static Literal parseLiteral(java.lang.String sLiteral)
                                throws jason.asSyntax.parser.ParseException

  creates a new literal by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parseNumber

    public static NumberTerm parseNumber(java.lang.String sNumber)
                                  throws java.lang.NumberFormatException

  creates a new number term by parsing a string

  Throws:
    `java.lang.NumberFormatException`

### parseStructure

    public static Structure parseStructure(java.lang.String sStructure)
                                    throws jason.asSyntax.parser.ParseException

  creates a new structure (a kind of term) by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parseVar

    public static VarTerm parseVar(java.lang.String sVar)
                            throws jason.asSyntax.parser.ParseException

  creates a new variable by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parseTerm

    public static Term parseTerm(java.lang.String sTerm)
                          throws jason.asSyntax.parser.ParseException

  creates a new term by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parsePlan

    public static Plan parsePlan(java.lang.String sPlan)
                          throws jason.asSyntax.parser.ParseException

  creates a new plan by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parsePlanBody

    public static PlanBody parsePlanBody(java.lang.String sPlanBody)
                                  throws jason.asSyntax.parser.ParseException

  creates a new plan body by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parseTrigger

    public static Trigger parseTrigger(java.lang.String sTe)
                                throws jason.asSyntax.parser.ParseException

  creates a new trigger by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parseList

    public static ListTerm parseList(java.lang.String sList)
                              throws jason.asSyntax.parser.ParseException

  creates a new list by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parseFormula

    public static LogicalFormula parseFormula(java.lang.String sExpr)
                                       throws jason.asSyntax.parser.ParseException

  creates a new logical formula by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

### parseRule

    public static Rule parseRule(java.lang.String sRule)
                          throws jason.asSyntax.parser.ParseException

  creates a new rule by parsing a string

  Throws:
    `jason.asSyntax.parser.ParseException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD