Class SimpleCharStream

java.lang.Object
org.tweetyproject.logics.rpcl.parser.rpclprobabilitydistributionparser.SimpleCharStream

public class SimpleCharStream extends Object
An implementation of interface CharStream, where the stream is assumed to contain only ASCII characters (without unicode processing).
  • Field Details

    • staticFlag

      public static final boolean staticFlag
      Whether parser is static.
      See Also:
    • bufpos

      public static int bufpos
      Position in buffer.
  • Constructor Details

    • SimpleCharStream

      public SimpleCharStream(Reader dstream, int startline, int startcolumn, int buffersize)
      Constructor
      Parameters:
      dstream - the reader
      startline - start line
      startcolumn - start column
      buffersize - buffer size
    • SimpleCharStream

      public SimpleCharStream(Reader dstream, int startline, int startcolumn)
      Constructor
      Parameters:
      dstream - the reader
      startline - start line
      startcolumn - start column
    • SimpleCharStream

      public SimpleCharStream(Reader dstream)
      Constructor
      Parameters:
      dstream - the reader
    • SimpleCharStream

      public SimpleCharStream(InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws UnsupportedEncodingException
      Constructor
      Parameters:
      dstream - inout stream
      encoding - the string encoding
      startline - start line
      startcolumn - start column
      buffersize - buffer size
      Throws:
      UnsupportedEncodingException - error
    • SimpleCharStream

      public SimpleCharStream(InputStream dstream, int startline, int startcolumn, int buffersize)
      Constructor
      Parameters:
      dstream - inout stream
      startline - start line
      startcolumn - start column
      buffersize - buffer size
    • SimpleCharStream

      public SimpleCharStream(InputStream dstream, String encoding, int startline, int startcolumn) throws UnsupportedEncodingException
      Constructor
      Parameters:
      dstream - inout stream
      encoding - the string encoding
      startline - start line
      startcolumn - start column
      Throws:
      UnsupportedEncodingException - error
    • SimpleCharStream

      public SimpleCharStream(InputStream dstream, int startline, int startcolumn)
      Constructor
      Parameters:
      dstream - inout stream
      startline - start line
      startcolumn - start column
    • SimpleCharStream

      public SimpleCharStream(InputStream dstream, String encoding) throws UnsupportedEncodingException
      Constructor
      Parameters:
      dstream - inout stream
      encoding - the string encoding
      Throws:
      UnsupportedEncodingException - error
    • SimpleCharStream

      public SimpleCharStream(InputStream dstream)
      Constructor
      Parameters:
      dstream - inout stream
  • Method Details

    • BeginToken

      public static char BeginToken() throws IOException
      Start
      Returns:
      begin token
      Throws:
      IOException - error
    • readChar

      public static char readChar() throws IOException
      Read a character.
      Returns:
      char
      Throws:
      IOException - error
    • getColumn

      @Deprecated public static int getColumn()
      Deprecated.
      Returns:
      the column
      See Also:
    • getLine

      @Deprecated public static int getLine()
      Deprecated.
      Returns:
      the line
      See Also:
    • getEndColumn

      public static int getEndColumn()
      Retrieves the column number where the current token ends.
      Returns:
      The column number of the end of the current token.
    • getEndLine

      public static int getEndLine()
      Retrieves the line number where the current token ends.
      Returns:
      The line number of the end of the current token.
    • getBeginColumn

      public static int getBeginColumn()
      Retrieves the column number where the current token begins.
      Returns:
      The column number of the beginning of the current token.
    • getBeginLine

      public static int getBeginLine()
      Retrieves the line number where the current token begins.
      Returns:
      The line number of the beginning of the current token.
    • backup

      public static void backup(int amount)
      Rewinds the input stream by a specified number of characters.

      This method allows you to move backwards in the input stream, effectively undoing the reading of a specified number of characters. This is useful when you need to backtrack after realizing that a token was read incorrectly or that more context is needed to parse the input properly.

      Parameters:
      amount - The number of characters to move backwards. This should be a positive integer.
    • ReInit

      public void ReInit(Reader dstream, int startline, int startcolumn, int buffersize)
      Reinitialise
      Parameters:
      dstream - the reader
      startline - start line
      startcolumn - start column
      buffersize - buffer size
    • ReInit

      public void ReInit(Reader dstream, int startline, int startcolumn)
      Reinitialise
      Parameters:
      dstream - the reader
      startline - start line
      startcolumn - start column
    • ReInit

      public void ReInit(Reader dstream)
      Reinitialise
      Parameters:
      dstream - the reader
    • ReInit

      public void ReInit(InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws UnsupportedEncodingException
      Reinitialise
      Parameters:
      dstream - inout stream
      encoding - the string encoding
      startline - start line
      startcolumn - start column
      buffersize - buffer size
      Throws:
      UnsupportedEncodingException - error
    • ReInit

      public void ReInit(InputStream dstream, int startline, int startcolumn, int buffersize)
      Reinitialise
      Parameters:
      dstream - inout stream
      startline - start line
      startcolumn - start column
      buffersize - buffer size
    • ReInit

      public void ReInit(InputStream dstream, String encoding) throws UnsupportedEncodingException
      Reinitialise
      Parameters:
      dstream - inout stream
      encoding - the string encoding
      Throws:
      UnsupportedEncodingException - error
    • ReInit

      public void ReInit(InputStream dstream)
      Reinitialise
      Parameters:
      dstream - inout stream
    • ReInit

      public void ReInit(InputStream dstream, String encoding, int startline, int startcolumn) throws UnsupportedEncodingException
      Reinitialise
      Parameters:
      dstream - inout stream
      encoding - the string encoding
      startline - start line
      startcolumn - start column
      Throws:
      UnsupportedEncodingException - error
    • ReInit

      public void ReInit(InputStream dstream, int startline, int startcolumn)
      Reinitialise
      Parameters:
      dstream - inout stream
      startline - start line
      startcolumn - start column
    • GetImage

      public static String GetImage()
      Get token literal value.
      Returns:
      image
    • GetSuffix

      public static char[] GetSuffix(int len)
      Get the suffix.
      Parameters:
      len - length
      Returns:
      suffix
    • Done

      public static void Done()
      Reset buffer when finished.
    • adjustBeginLineColumn

      public static void adjustBeginLineColumn(int newLine, int newCol)
      Method to adjust line and column numbers for the start of a token.
      Parameters:
      newLine - line
      newCol - column