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

## ix.iface.domain
Class LTF_Parser

    java.lang.Object
      ix.iface.domain.DomainParser
          ix.iface.domain.LTF_Parser

    public class LTF_Parser

extends DomainParser

A parser for domains described in a Lisp-like syntax.

The parser parses a file of refinement definitions to populate a Domain.

In the syntax definitions below, all-upper-case names are literals and lower- and mixed-case names are syntactic variables. Literals should actually be written in lower case in domain definitions.

        domain ::= {header | refinement | object-class | annotations | include}*

        header ::= (DOMAIN domain-property*)

        domain-property ::= (NAME string)

        include ::= (INCLUDE file-name-or-URL-as-string)

        refinement ::= (REFINEMENT name pattern clause*)

        name ::= symbol | string
        pattern ::= (item*)
        item ::= number | symbol | string | pattern | variable
        variable ::= ?symbol
        clause ::= (VARIABLES variable-declaration*)
                | (ISSUES issue*)
                | (NODES node*)
                | (ORDERINGS ordering*)
                | (CONSTRAINTS constraint*)
                | annotations
        variable-declaration = variable
        issue ::= (ISSUE pattern)
        node ::= (node-id pattern)
        ordering ::= ({node-end-ref | (node-end-ref*)}*)
        constraint ::= (WORLD-STATE CONDITION pattern = value)
                    |  (WORLD-STATE ACHIEVE pattern = value)
                    |  (WORLD-STATE EFFECT pattern = value)
                    |  (WORLD-STATE USE-FOR-EFFECT pattern = value)
                    |  (COMPUTE [MULTIPLE-ANSWER] pattern = value)
                    |  (ADVICE EXPANSION-REFINEMENT verb (symbol*))
                    |  (TEMPORAL DURATION node-ref = time-window)
                    |  (TEMPORAL BEFORE node-end-ref --> node-end-ref
                                   = time-window)
                       (TEMPORAL WINDOW AT node-end-ref = time-window)
                    |  (RESOURCE operation pattern = value)
                    |  other-constraint
        other-constraint ::= (type subtype pattern = value)

        node-id ::= number | symbol | string
        node-ref ::= node-id | SELF
        node-end-ref ::= node-ref | B/node-ref | E/node-ref
        value ::= item
        verb, operation, type, subtype ::= symbol

        time-window = duration | variable | min-duration [.. max-duration]
        min-duration, max-duration ::= duration | variable
        A duration has ISO 8601 syntax for days, hours, minutes, seconds
              and milliseconds.

        object-class ::= (OBJECT-CLASS class-name supers object-property*)
        supers = (class-name*)
        object-property ::= (property-name [class-name] [:SYNTAX value-syntax])
        class-name ::= symbol | string
        property-name ::= symbol | string
        value-syntax ::= NUMBER | SYMBOL | STRING | LIST | OBJECT | DEFAULT

        annotations :: = (ANNOTATIONS annotation*)
        annotation ::= (aKey = aValue)
        map ::= (MAP map-entry*)
        map-entry ::= (aKey = aValue)

        aKey and aValue can be anything the Lisp reader will accept.
        aValue can also be a map.  The word map must be written
        "Map".

Note that an LTF_Parser can be used simply as a constraint-parser. Like this:

        import ix.iface.domain.LTF_Parser;
        import ix.util.lisp.*;

        LTF_Parser parser = new LTF_Parser();

        String text = "(world-state condition (colour ?x) = red)";
        Constraint c = parser.parseConstraint(Lisp.readFromString(text));

See Also:
  `Domain`, `Duration`, `expandAllOrderings(LList)`

Nested Class Summary
`(package private) class` | `LTF_Parser.AdviceParser`
`(package private) class` | `LTF_Parser.BeforeParser`
`(package private) class` | `LTF_Parser.ComputeParser`
`(package private) class` | `LTF_Parser.ConditionParser`
`static class` | `LTF_Parser.ConstraintParser` Used to parse a constraint and also, via the makeTemplate method, to describe the syntax.
`(package private) class` | `LTF_Parser.DurationParser`
`(package private) class` | `LTF_Parser.EffectParser`
`(package private) class` | `LTF_Parser.IncludeReader` Wrapper class used to read included resources.
`(package private) class` | `LTF_Parser.MultipleAnswerComputeParser`
`(package private) class` | `LTF_Parser.OtherConstraintParser`
`(package private) class` | `LTF_Parser.ResourceConstraintParser`
`(package private) class` | `LTF_Parser.TemporalConstraintParser`
`(package private) class` | `LTF_Parser.WindowAtParser`
`(package private) class` | `LTF_Parser.WorldStateConstraintParser`

Nested classes/interfaces inherited from class ix.iface.domain.DomainParser
`DomainParser.DomainParserWrapper`

Field Summary
`protected java.util.Set` | `badAnnotations`
`protected boolean` | `badAnnotationsAreErrors`
`protected boolean` | `forceNumericNodeIds`
`protected java.lang.Object` | `lastRead`
`protected LispReader` | `lin`
`protected java.util.Set` | `otherConstraints`
`protected MatchTable` | `parsers`
`protected java.lang.String` | `sourceName`
`protected boolean` | `useConditionTypes`

Constructor Summary
`LTF_Parser()`
`LTF_Parser(java.io.File file)`
`LTF_Parser(java.lang.String filename)`
`LTF_Parser(java.net.URL url)`

Method Summary
`protected void` | `addConstraintParsers()`
`(package private) void` | `badAnnotation(LList kvPair)`
`(package private) java.net.URL` | `defaultedIncludeURL(java.lang.String name)`
`protected void` | `do_readDomain(Domain dom)`
`(package private) void` | `doInclude(LList form)`
`(package private) static LList` | `ensureList(java.lang.Object a)`
`static LList` | `expandAllOrderings(LList orderings)` Expands a list of orderings into a list of simple orderings.
`static LList` | `expandOrdering(LList ordering)`
`(package private) static LList` | `expandOrderPair(java.lang.Object left, java.lang.Object right)`
`MatchTable` | `getConstraintParsers()`
`(package private) boolean` | `isMapSyntax(java.lang.Object obj)`
`(package private) java.util.Map` | `makeAnnotations(LList def)`
`ix.icore.domain.ListOfConstraint` | `makeConstraints(LList items)`
`ix.icore.ListOfIssue` | `makeIssues(LList items)`
`(package private) java.util.Map` | `makeMap(LList def)`
`ix.icore.domain.ListOfNodeSpec` | `makeNodes(LList items)`
`(package private) java.util.Map` | `makeNumericIdMap(ix.icore.domain.ListOfNodeSpec nodes)`
`(package private) ObjectClass` | `makeObjectClass(LList def)`
`(package private) ix.icore.domain.ListOfObjectProperty` | `makeObjectProperties(LList props)`
`(package private) ObjectProperty` | `makeObjectProperty(LList spec)`
`ix.icore.domain.ListOfOrdering` | `makeOrderings(LList items)`
`Refinement` | `makeRefinement(LList def)`
`(package private) ix.util.lisp.ListOfSymbol` | `makeSuperNames(LList names)`
`ix.icore.domain.ListOfVariableDeclaration` | `makeVarDcls(LList items)`
`Constraint` | `parseConstraint(java.lang.Object spec)`
`(package private) void` | `processDomainHeader(Domain dom, LList header)`
`Domain` | `readDomain()`
`Domain` | `readDomain(Domain dom)`
`protected SyntaxException` | `syntaxError(java.lang.String message)`
`protected static Cons` | `theCons(java.lang.Object o)`
`protected static LList` | `theLList(java.lang.Object o)`
`protected static java.lang.String` | `theName(java.lang.Object o)`
`protected NodeEndRef` | `theNodeEndRef(Name nodeId, End defaultEnd)`
`protected static Name` | `theNodeId(java.lang.Object o)`
`protected Name` | `thePlainNodeId(java.lang.Object o)`
`protected static java.lang.String` | `theString(java.lang.Object o)`
`protected static Symbol` | `theSymbol(java.lang.Object o)`
`(package private) Refinement` | `useNumericNodeIds(Refinement r)`

Methods inherited from class ix.iface.domain.DomainParser
`getLibraryDirectory, loadDomain, makeParser`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### sourceName

    protected java.lang.String sourceName

### lin

    protected LispReader lin

### lastRead

    protected java.lang.Object lastRead

### forceNumericNodeIds

    protected boolean forceNumericNodeIds

### badAnnotationsAreErrors

    protected boolean badAnnotationsAreErrors

### badAnnotations

    protected java.util.Set badAnnotations

### otherConstraints

    protected java.util.Set otherConstraints

### useConditionTypes

    protected boolean useConditionTypes

### parsers

    protected MatchTable parsers

Constructor Detail

### LTF_Parser

    public LTF_Parser(java.lang.String filename)
               throws java.io.FileNotFoundException

Throws:
  `java.io.FileNotFoundException`

### LTF_Parser

    public LTF_Parser(java.io.File file)
               throws java.io.FileNotFoundException

Throws:
  `java.io.FileNotFoundException`

### LTF_Parser

    public LTF_Parser(java.net.URL url)
               throws java.io.IOException

Throws:
  `java.io.IOException`

### LTF_Parser

    public LTF_Parser()

Method Detail

### readDomain

    public Domain readDomain()

  Specified by:
    `readDomain` in class `DomainParser`

### readDomain

    public Domain readDomain(Domain dom)

  Specified by:
    `readDomain` in class `DomainParser`

### do_readDomain

    protected void do_readDomain(Domain dom)

### syntaxError

    protected SyntaxException syntaxError(java.lang.String message)

### theCons

    protected static Cons theCons(java.lang.Object o)

### theLList

    protected static LList theLList(java.lang.Object o)

### theSymbol

    protected static Symbol theSymbol(java.lang.Object o)

### theString

    protected static java.lang.String theString(java.lang.Object o)

### theName

    protected static java.lang.String theName(java.lang.Object o)

### theNodeId

    protected static Name theNodeId(java.lang.Object o)

### thePlainNodeId

    protected Name thePlainNodeId(java.lang.Object o)

### theNodeEndRef

    protected NodeEndRef theNodeEndRef(Name nodeId,
                                       End defaultEnd)

### processDomainHeader

    void processDomainHeader(Domain dom,
                             LList header)

### makeRefinement

    public Refinement makeRefinement(LList def)

### makeVarDcls

    public ix.icore.domain.ListOfVariableDeclaration makeVarDcls(LList items)

### makeNodes

    public ix.icore.domain.ListOfNodeSpec makeNodes(LList items)

### makeOrderings

    public ix.icore.domain.ListOfOrdering makeOrderings(LList items)

### makeConstraints

    public ix.icore.domain.ListOfConstraint makeConstraints(LList items)

### makeIssues

    public ix.icore.ListOfIssue makeIssues(LList items)

### useNumericNodeIds

    Refinement useNumericNodeIds(Refinement r)

### makeNumericIdMap

    java.util.Map makeNumericIdMap(ix.icore.domain.ListOfNodeSpec nodes)

### expandAllOrderings

    public static LList expandAllOrderings(LList orderings)

  Expands a list of orderings into a list of simple orderings. Each simple ordering is a pair of node ids: (before after).

  Each ordering is a list representing a sequence. Consider adjacent elements A and B in such a list. Each node in A is linked before each node in B. For example, (1 (2 3) 4) is equivalent to the four separate lists (1 2), (1 3), (2 4), (3 4).

### expandOrdering

    public static LList expandOrdering(LList ordering)

### expandOrderPair

    static LList expandOrderPair(java.lang.Object left,
                                 java.lang.Object right)

### ensureList

    static LList ensureList(java.lang.Object a)

### parseConstraint

    public Constraint parseConstraint(java.lang.Object spec)

### getConstraintParsers

    public MatchTable getConstraintParsers()

### addConstraintParsers

    protected void addConstraintParsers()

### makeObjectClass

    ObjectClass makeObjectClass(LList def)

### makeSuperNames

    ix.util.lisp.ListOfSymbol makeSuperNames(LList names)

### makeObjectProperties

    ix.icore.domain.ListOfObjectProperty makeObjectProperties(LList props)

### makeObjectProperty

    ObjectProperty makeObjectProperty(LList spec)

### makeAnnotations

    java.util.Map makeAnnotations(LList def)

### makeMap

    java.util.Map makeMap(LList def)

### isMapSyntax

    boolean isMapSyntax(java.lang.Object obj)

### badAnnotation

    void badAnnotation(LList kvPair)

### doInclude

    void doInclude(LList form)
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### defaultedIncludeURL

    java.net.URL defaultedIncludeURL(java.lang.String name)
                               throws java.net.MalformedURLException

  Throws:
    `java.net.MalformedURLException`

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