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 Structure

    java.lang.Object
      jason.asSyntax.DefaultTerm
          jason.asSyntax.Literal
              jason.asSyntax.Atom
                  jason.asSyntax.Structure

All Implemented Interfaces:
  LogicalFormula, Term, ToDOM, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Term>

Direct Known Subclasses:
  ArithFunctionTerm, BinaryStructure, InternalActionLiteral, ListTermImpl, Plan, PlanBodyImpl, Pred, Trigger

    public class Structure

extends Atom

Represents a structure: a functor with n arguments, e.g.: val(10,x(3)).

See Also:
  Serialized Form

Field Summary
`protected static Term[]` | `emptyTermArray`
`protected static java.util.List<Term>` | `emptyTermList`

Fields inherited from class jason.asSyntax.Literal
`LFalse, LNeg, LPos, LTrue, predicateIndicatorCache`

Fields inherited from class jason.asSyntax.DefaultTerm
`hashCodeCache, srcInfo`

Constructor Summary
`Structure(Literal l)`
`Structure(java.lang.String functor)`
`Structure(java.lang.String functor, int termsSize)` Create a structure with a defined number of terms.

Method Summary
`void` | `addTerm(Term t)`
`Literal` | `addTerms(java.util.List<Term> l)` adds some terms and return this
`Literal` | `addTerms(Term... ts)` adds some terms and return this
`boolean` | `apply(Unifier u)` replaces variables by their values in the unifier, returns true if some variable was applied
`protected int` | `calcHashCode()`
`Term` | `clone()` make a deep copy of the terms
`int` | `compareTo(Term t)`
`void` | `countVars(java.util.Map<VarTerm,java.lang.Integer> c)`
`void` | `delTerm(int index)`
`boolean` | `equals(java.lang.Object t)`
`int` | `getArity()` returns the number of terms of this literal
`org.w3c.dom.Element` | `getAsDOM(org.w3c.dom.Document document)` get as XML
`java.util.List<VarTerm>` | `getSingletonVars()` returns all singleton vars (that appears once) in this literal
`Term` | `getTerm(int i)` returns the i-th term (first term is 0)
`java.util.List<Term>` | `getTerms()` returns all terms of this literal
`int` | `getTermsSize()` Deprecated. use getArity
`boolean` | `hasTerm()` returns true if this literal has some term
`boolean` | `hasVar(VarTerm t)`
`boolean` | `isAtom()`
`boolean` | `isGround()`
`boolean` | `isStructure()`
`void` | `makeTermsAnnon()` replaces all terms by unnamed variables (_).
`Literal` | `makeVarsAnnon()` replaces all variables by unnamed variables (_).
`Literal` | `makeVarsAnnon(Unifier un)` replaces all variables of the term for unnamed variables (_).
`static Structure` | `parse(java.lang.String sTerm)`
`void` | `setTerm(int i, Term t)`
`Literal` | `setTerms(java.util.List<Term> l)` set all terms of the literal and return this
`java.lang.String` | `toString()`
`protected VarTerm` | `varToReplace(Term t, Unifier un)`

Methods inherited from class jason.asSyntax.Atom
`getFunctor`

Methods inherited from class jason.asSyntax.Literal
`addAnnot, addAnnots, addAnnots, addSource, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnots, getAnnots, getAsListOfTerms, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isLiteral, logicalConsequence, negated, newFromListOfTerms, parseLiteral, setAnnots, setNegated`

Methods inherited from class jason.asSyntax.DefaultTerm
`getErrorMsg, getSrcInfo, hashCode, isArithExpr, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, isString, isUnnamedVar, isVar, resetHashCodeCache, setSrcInfo`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface jason.asSyntax.Term
`getSrcInfo, isArithExpr, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, isString, isUnnamedVar, isVar, setSrcInfo`

Field Detail

### emptyTermList

    protected static final java.util.List<Term> emptyTermList

### emptyTermArray

    protected static final Term[] emptyTermArray

Constructor Detail

### Structure

    public Structure(java.lang.String functor)

### Structure

    public Structure(Literal l)

### Structure

    public Structure(java.lang.String functor,
                     int termsSize)

  Create a structure with a defined number of terms. It is used by list term, plan body, ... to not create the array list for terms.

Method Detail

### parse

    public static Structure parse(java.lang.String sTerm)

### calcHashCode

    protected int calcHashCode()

  Overrides:
    `calcHashCode` in class `Atom`

### equals

    public boolean equals(java.lang.Object t)

  Specified by:
    `equals` in interface `Term`
  Overrides:
    `equals` in class `Atom`

### compareTo

    public int compareTo(Term t)

  Specified by:
    `compareTo` in interface `java.lang.Comparable<Term>`
  Overrides:
    `compareTo` in class `Atom`

### apply

    public boolean apply(Unifier u)

  Description copied from interface: `Term`
  replaces variables by their values in the unifier, returns true if some variable was applied

  Specified by:
    `apply` in interface `Term`
  Overrides:
    `apply` in class `DefaultTerm`

### clone

    public Term clone()

  make a deep copy of the terms

  Specified by:
    `clone` in interface `Term`
  Overrides:
    `clone` in class `Atom`

### addTerm

    public void addTerm(Term t)

  Overrides:
    `addTerm` in class `Literal`

### delTerm

    public void delTerm(int index)

  Overrides:
    `delTerm` in class `Literal`

### addTerms

    public Literal addTerms(Term... ts)

  Description copied from class: `Literal`
  adds some terms and return this

  Overrides:
    `addTerms` in class `Literal`

### addTerms

    public Literal addTerms(java.util.List<Term> l)

  Description copied from class: `Literal`
  adds some terms and return this

  Overrides:
    `addTerms` in class `Literal`

### setTerms

    public Literal setTerms(java.util.List<Term> l)

  Description copied from class: `Literal`
  set all terms of the literal and return this

  Overrides:
    `setTerms` in class `Literal`

### setTerm

    public void setTerm(int i,
                        Term t)

  Overrides:
    `setTerm` in class `Literal`

### getTerm

    public Term getTerm(int i)

  Description copied from class: `Literal`
  returns the i-th term (first term is 0)

  Overrides:
    `getTerm` in class `Literal`

### getArity

    public int getArity()

  Description copied from class: `Literal`
  returns the number of terms of this literal

  Overrides:
    `getArity` in class `Literal`

### getTermsSize

    public int getTermsSize()

  Deprecated. use getArity

### getTerms

    public java.util.List<Term> getTerms()

  Description copied from class: `Literal`
  returns all terms of this literal

  Overrides:
    `getTerms` in class `Literal`

### hasTerm

    public boolean hasTerm()

  Description copied from class: `Literal`
  returns true if this literal has some term

  Overrides:
    `hasTerm` in class `Literal`

### isStructure

    public boolean isStructure()

  Specified by:
    `isStructure` in interface `Term`
  Overrides:
    `isStructure` in class `DefaultTerm`

### isAtom

    public boolean isAtom()

  Specified by:
    `isAtom` in interface `Term`
  Overrides:
    `isAtom` in class `Atom`

### isGround

    public boolean isGround()

  Specified by:
    `isGround` in interface `Term`
  Overrides:
    `isGround` in class `DefaultTerm`

### makeVarsAnnon

    public Literal makeVarsAnnon()

  Description copied from class: `Literal`
  replaces all variables by unnamed variables (_).

  Overrides:
    `makeVarsAnnon` in class `Literal`

### makeVarsAnnon

    public Literal makeVarsAnnon(Unifier un)

  Description copied from class: `Literal`
  replaces all variables of the term for unnamed variables (_).

  Overrides:
    `makeVarsAnnon` in class `Literal`
  Parameters:
    `un` - is the unifier that contains the map of replacements

### varToReplace

    protected VarTerm varToReplace(Term t,
                                   Unifier un)

### makeTermsAnnon

    public void makeTermsAnnon()

  Description copied from class: `Literal`
  replaces all terms by unnamed variables (_).

  Overrides:
    `makeTermsAnnon` in class `Literal`

### hasVar

    public boolean hasVar(VarTerm t)

  Specified by:
    `hasVar` in interface `Term`
  Overrides:
    `hasVar` in class `DefaultTerm`

### getSingletonVars

    public java.util.List<VarTerm> getSingletonVars()

  Description copied from class: `Literal`
  returns all singleton vars (that appears once) in this literal

  Overrides:
    `getSingletonVars` in class `Literal`

### countVars

    public void countVars(java.util.Map<VarTerm,java.lang.Integer> c)

  Specified by:
    `countVars` in interface `Term`
  Overrides:
    `countVars` in class `DefaultTerm`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `Atom`

### getAsDOM

    public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)

  get as XML

  Specified by:
    `getAsDOM` in interface `ToDOM`
  Overrides:
    `getAsDOM` in class `Atom`

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