Package de.saar.chorus.domgraph.codec
Class InputCodec
java.lang.Object
de.saar.chorus.domgraph.codec.InputCodec
- Direct Known Subclasses:
Chain,DomconOzInputCodec,DomgraphGxlInputCodec,GlueInputCodec,HolesemComsemInputCodec,MrsPrologInputCodec,MrsXmlInputCodec,RmrsDomconInputCodec
The abstract base class for all input codecs. Derived classes should
implement the method
decode and set the codec's name and
extension in the constructor.- Author:
- Alexander Koller
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voiddecode(Reader reader, DomGraph graph, NodeLabels labels) Reads an USR representation from aReader.Determines aReaderfrom which the USR specified by thespecwill be read.
-
Constructor Details
-
InputCodec
public InputCodec()
-
-
Method Details
-
decode
public abstract void decode(Reader reader, DomGraph graph, NodeLabels labels) throws IOException, ParserException, MalformedDomgraphException Reads an USR representation from aReader. This method converts the USR into an equivalent labelled dominance graph and stores this graph in aDomGraphand the labels in aNodeLabelsobject. 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.
- Parameters:
reader- the reader from which the USR is readgraph- the dominance graph into which the USR is convertedlabels- the node labels of the labelled dominance graph- Throws:
IOException- if an I/O error occurred while reading fromreaderParserException- if a syntactic error occurred while parsing the USRMalformedDomgraphException- if a semantic error occurred, i.e. the USR cannot be converted into a dominance graph
-
getReaderForSpecification
Determines aReaderfrom which the USR specified by thespecwill be read. In this default implementation,specis a filename, and the reader will be aFileReaderfor this file. You may override this method with your own implementation; thespecthat is passed to your method will then be what the user specified in the command-line call "utool solve -I yourcodec <spec>". See theChainfor an example.- Parameters:
spec- a filename- Returns:
- a reader for reading from this file
- Throws:
IOException- no file with the given name exists
-