public class ResizingParseWindow extends Object implements ParseWindow
ResizingParseWindow slides through the lines of a input stream and
offers methods to get the currently focused line as well as upcoming lines.
It is backed by an automatically resizing LinkedList| Constructor and Description |
|---|
ResizingParseWindow(InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIgnorePattern(String ignorePattern) |
void |
addLine(int pos,
String line) |
String |
getFocusLine()
Returns the line currently focused by this window.
|
int |
getFocusLineNumber()
Returns the number of the current line within the whole document.
|
String |
getFutureLine(int distance)
Looks ahead from the current line and retrieves a line that will be the
focus line after the window has slided forward.
|
String |
slideForward()
Slides the window forward one line.
|
public ResizingParseWindow(InputStream in)
public void addIgnorePattern(String ignorePattern)
public String getFutureLine(int distance)
ParseWindowgetFutureLine in interface ParseWindowdistance - the number of lines to look ahead. Must be greater or equal 0.
0 returns the focus line. 1 returns the first line after the
current focus line and so on. Note that all lines up to the
returned line will be held in memory until the window has
slided past them, so be careful not to look ahead too far!public void addLine(int pos,
String line)
addLine in interface ParseWindowpublic String slideForward()
ParseWindowslideForward in interface ParseWindowpublic String getFocusLine()
ParseWindowParseWindow.slideForward() but calling
this method does not slide the window forward a step.getFocusLine in interface ParseWindowpublic int getFocusLineNumber()
ParseWindowgetFocusLineNumber in interface ParseWindowCopyright © 2016. All rights reserved.