de.saar.chorus.domgraph.codec.domcon
Class DomconOzInputCodec

Object
  extended by InputCodec
      extended by DomconOzInputCodec
All Implemented Interfaces:
DomconOzInputCodecConstants

public class DomconOzInputCodec
extends InputCodec
implements DomconOzInputCodecConstants

An input codec for weakly normal dominance constraints in Oz syntax. The inputs that this codec accepts are lists of Oz terms; these terms represent dominance and labelling atoms.

An example input looks as follows:

[label(x f(y)) dom(y z) label(z a)]

The dominance constraint represented by the Oz term is read as a weakly normal dominance constraint, i.e. we require that the right-hand sides of dominance atoms are roots, and we assume that there is an implicit inequality atom for each pair of labelled variables.

The constraints accepted by this codec are compatible with the old CHORUS demo. A line that starts with a percent sign is interpreted as a comment.

Author:
Alexander Koller

Field Summary
 Token jj_nt
           
 Token token
           
 DomconOzInputCodecTokenManager token_source
           
 
Fields inherited from interface DomconOzInputCodecConstants
DEFAULT, DOM, EOF, LABEL, OZATOM, PERCENT_COMMENT, tokenImage
 
Constructor Summary
DomconOzInputCodec()
           
DomconOzInputCodec(DomconOzInputCodecTokenManager tm)
           
DomconOzInputCodec(InputStream stream)
           
DomconOzInputCodec(InputStream stream, String encoding)
           
DomconOzInputCodec(Reader stream)
           
 
Method Summary
 void Atom()
           
 void decode(Reader inputStream, DomGraph graph, NodeLabels labels)
          Reads an USR representation from a Reader.
 void disable_tracing()
           
 void enable_tracing()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 void Input()
           
 void ReInit(DomconOzInputCodecTokenManager tm)
           
 void ReInit(InputStream stream)
           
 void ReInit(InputStream stream, String encoding)
           
 void ReInit(Reader stream)
           
 String Variable()
           
 void Varlist()
           
 
Methods inherited from class InputCodec
getReaderForSpecification
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public DomconOzInputCodecTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt
Constructor Detail

DomconOzInputCodec

public DomconOzInputCodec()

DomconOzInputCodec

public DomconOzInputCodec(InputStream stream)

DomconOzInputCodec

public DomconOzInputCodec(InputStream stream,
                          String encoding)

DomconOzInputCodec

public DomconOzInputCodec(Reader stream)

DomconOzInputCodec

public DomconOzInputCodec(DomconOzInputCodecTokenManager tm)
Method Detail

decode

public void decode(Reader inputStream,
                   DomGraph graph,
                   NodeLabels labels)
            throws IOException,
                   ParserException,
                   MalformedDomgraphException
Description copied from class: InputCodec
Reads an USR representation from a Reader. This method converts the USR into an equivalent labelled dominance graph and stores this graph in a DomGraph and the labels in a NodeLabels object. You must implement this method in every concrete input codec.

The graph and labels objects passed to this method need not be empty; it is the responsibility of this method to clear them first.

Specified by:
decode in class InputCodec
Parameters:
inputStream - the reader from which the USR is read
graph - the dominance graph into which the USR is converted
labels - the node labels of the labelled dominance graph
Throws:
IOException - if an I/O error occurred while reading from reader
ParserException - if a syntactic error occurred while parsing the USR
MalformedDomgraphException - if a semantic error occurred, i.e. the USR cannot be converted into a dominance graph

Input

public final void Input()
                 throws ParseException
Throws:
ParseException

Atom

public final void Atom()
                throws ParseException
Throws:
ParseException

Varlist

public final void Varlist()
                   throws ParseException
Throws:
ParseException

Variable

public final String Variable()
                      throws ParseException
Throws:
ParseException

ReInit

public void ReInit(InputStream stream)

ReInit

public void ReInit(InputStream stream,
                   String encoding)

ReInit

public void ReInit(Reader stream)

ReInit

public void ReInit(DomconOzInputCodecTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()