Class Pos.Source

java.lang.Object
org.smtlib.impl.Pos.Source
All Implemented Interfaces:
ISource
Enclosing class:
Pos

public static class Pos.Source extends Object implements ISource
An implementation of the ISource interface
  • Constructor Summary

    Constructors
    Constructor
    Description
    Source(CharSequence cs, Object location)
    Creates a Source from a character sequence
    Source(SMT.Configuration smtConfig, File f)
    Creates a Source from a File; for these objects, the location is the file path (a String)
    Source(SMT.Configuration smtConfig, InputStream f, Object location)
    Creates a Source from a File
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    charAt(int pos)
    Returns the character at the given character position within the source.
    The sequence of characters
    void
    Closes any open resources - the source is not usable after this call.
    int
    lineBeginning(int pos)
    Returns the character position of the beginning of the line containing the given position.
    int
    lineNumber(int pos)
    Returns the number (beginning with 1) of the line containing the given character position (which begins at 0).
    The identifier for the location
    protected int
    The (last character of) the next line termination sequence after the given character position
    textLine(int pos)
    Returns the text of the line containing the given position, at least through the given position, and always ending with a (perhaps added) line termination sequence.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Source

      public Source(CharSequence cs, Object location)
      Creates a Source from a character sequence
      Parameters:
      cs - the sequence to use as a source of characters
      location - a designator of the location of the source, used for identification only
    • Source

      public Source(SMT.Configuration smtConfig, File f) throws FileNotFoundException
      Creates a Source from a File; for these objects, the location is the file path (a String)
      Parameters:
      smtConfig - the SMT Configuration object
      f - the File object from which to read characters
      Throws:
      FileNotFoundException - if a problem occurred opening or reading the file
    • Source

      public Source(SMT.Configuration smtConfig, InputStream f, Object location)
      Creates a Source from a File
      Parameters:
      smtConfig - the SMT Configuration object
      f - the InputStream object from which to read characters
      location - object describing the location of the source
  • Method Details

    • chars

      public CharSequence chars()
      The sequence of characters
      Specified by:
      chars in interface ISource
    • location

      public Object location()
      The identifier for the location
      Specified by:
      location in interface ISource
      Returns:
      the location object of the source
    • close

      public void close()
      Description copied from interface: ISource
      Closes any open resources - the source is not usable after this call.
      Specified by:
      close in interface ISource
    • charAt

      public char charAt(int pos)
      Description copied from interface: ISource
      Returns the character at the given character position within the source. Character positions begin at 0.
      Specified by:
      charAt in interface ISource
    • lineBeginning

      public int lineBeginning(int pos)
      Description copied from interface: ISource
      Returns the character position of the beginning of the line containing the given position. Character positions begin at 0.
      Specified by:
      lineBeginning in interface ISource
    • textLine

      public String textLine(int pos)
      Description copied from interface: ISource
      Returns the text of the line containing the given position, at least through the given position, and always ending with a (perhaps added) line termination sequence. Character positions begin at 0.
      Specified by:
      textLine in interface ISource
      Parameters:
      pos - a character position
      Returns:
      the line of text containing that character position
    • nextLineTermination

      protected int nextLineTermination(int pos)
      The (last character of) the next line termination sequence after the given character position
    • lineNumber

      public int lineNumber(int pos)
      Description copied from interface: ISource
      Returns the number (beginning with 1) of the line containing the given character position (which begins at 0).
      Specified by:
      lineNumber in interface ISource