Class XParser

  • Direct Known Subclasses:
    XesXmlParser, XMxmlParser

    public abstract class XParser
    extends java.lang.Object
    This abstract class describes a parser for reading XES models from a given input stream.
    Author:
    Christian W. Guenther (christian@deckfour.org)
    • Constructor Summary

      Constructors 
      Constructor Description
      XParser()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.String author()
      Returns the name of the author of this parser.
      abstract boolean canParse​(java.io.File file)
      Checks whether this parser can handle the given file.
      abstract java.lang.String description()
      Returns a brief description of this parser.
      protected boolean endsWithIgnoreCase​(java.lang.String name, java.lang.String suffix)
      Returns whether the given file name ends (ignoring the case) with the given suffix.
      abstract java.lang.String name()
      Returns the name of this parser or, more specifically, the name of the format it can process.
      java.util.List<XLog> parse​(java.io.File file)
      Parses the given file, and returns the XLog instances extracted.
      abstract java.util.List<XLog> parse​(java.io.InputStream is)
      Parses the given input stream, and returns the XLog instances extracted.
      java.lang.String toString()
      toString() defaults to name().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • XParser

        public XParser()
    • Method Detail

      • name

        public abstract java.lang.String name()
        Returns the name of this parser or, more specifically, the name of the format it can process.
      • description

        public abstract java.lang.String description()
        Returns a brief description of this parser.
      • author

        public abstract java.lang.String author()
        Returns the name of the author of this parser.
      • canParse

        public abstract boolean canParse​(java.io.File file)
        Checks whether this parser can handle the given file.
        Parameters:
        file - File to check against parser.
        Returns:
        Whether this parser can handle the given file.
      • parse

        public abstract java.util.List<XLog> parse​(java.io.InputStream is)
                                            throws java.lang.Exception
        Parses the given input stream, and returns the XLog instances extracted.
        Parameters:
        is - Stream to read XLog instances from.
        Returns:
        A list of XLog instances read from the given input stream. The number of read XLogs is at least one. If no XLog instance could be parsed, the parser is expected to throw an exception.
        Throws:
        java.lang.Exception
      • parse

        public java.util.List<XLog> parse​(java.io.File file)
                                   throws java.lang.Exception
        Parses the given file, and returns the XLog instances extracted. The file is first checked against this parser, to check whether it can be handled. If the parser cannot handle the given file, or the extraction itself fails, the parser should raise an IOException.
        Parameters:
        file - The file to be parsed.
        Returns:
        List of XLog instances parsed from the given file.
        Throws:
        java.lang.Exception - Raised in case the parser fails, or the given file cannot be processed.
      • toString

        public java.lang.String toString()
        toString() defaults to name().
        Overrides:
        toString in class java.lang.Object
      • endsWithIgnoreCase

        protected boolean endsWithIgnoreCase​(java.lang.String name,
                                             java.lang.String suffix)
        Returns whether the given file name ends (ignoring the case) with the given suffix.
        Parameters:
        name - The given file name.
        suffix - The given suffix.
        Returns:
        Whether the given file name ends (ignoring the case) with the given suffix.