Package org.smtlib.impl
Class Pos.Source
java.lang.Object
org.smtlib.impl.Pos.Source
- All Implemented Interfaces:
ISource
- Enclosing class:
Pos
An implementation of the ISource interface
-
Constructor Summary
ConstructorsConstructorDescriptionSource(CharSequence cs, Object location) Creates a Source from a character sequenceSource(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 TypeMethodDescriptioncharcharAt(int pos) Returns the character at the given character position within the source.chars()The sequence of charactersvoidclose()Closes any open resources - the source is not usable after this call.intlineBeginning(int pos) Returns the character position of the beginning of the line containing the given position.intlineNumber(int pos) Returns the number (beginning with 1) of the line containing the given character position (which begins at 0).location()The identifier for the locationprotected intnextLineTermination(int pos) The (last character of) the next line termination sequence after the given character positiontextLine(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.
-
Constructor Details
-
Source
Creates a Source from a character sequence- Parameters:
cs- the sequence to use as a source of characterslocation- a designator of the location of the source, used for identification only
-
Source
Creates a Source from a File; for these objects, the location is the file path (a String)- Parameters:
smtConfig- the SMT Configuration objectf- the File object from which to read characters- Throws:
FileNotFoundException- if a problem occurred opening or reading the file
-
Source
Creates a Source from a File- Parameters:
smtConfig- the SMT Configuration objectf- the InputStream object from which to read characterslocation- object describing the location of the source
-
-
Method Details
-
chars
The sequence of characters -
location
The identifier for the location -
close
public void close()Description copied from interface:ISourceCloses any open resources - the source is not usable after this call. -
charAt
public char charAt(int pos) Description copied from interface:ISourceReturns the character at the given character position within the source. Character positions begin at 0. -
lineBeginning
public int lineBeginning(int pos) Description copied from interface:ISourceReturns the character position of the beginning of the line containing the given position. Character positions begin at 0.- Specified by:
lineBeginningin interfaceISource
-
textLine
Description copied from interface:ISourceReturns 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. -
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:ISourceReturns the number (beginning with 1) of the line containing the given character position (which begins at 0).- Specified by:
lineNumberin interfaceISource
-