@Test public void getTextAtOffset() { Cursor cursor = new Cursor(createTextSegment("1\n23")); assertEquals("1\n23", cursor.getTextAtOffset()); assertEquals("1\n2", cursor.getTextAtOffset(3)); cursor.advance(2); assertEquals("23", cursor.getTextAtOffset()); assertEquals("23", cursor.getTextAtOffset(2)); assertEquals("2", cursor.getTextAtOffset(1)); }
public String getTextAtOffset() { return text.substring(textOffset, text.length()); }
Cursor { public String getTextAtOffset() { return text.substring(textOffset, text.length()); } }
Cursor { public String getTextAtOffset() { return text.substring(textOffset, text.length()); } Cursor(TextSegment segment); }
Cursor { public String getTextAtOffset() { return text.substring(textOffset, text.length()); } Cursor(TextSegment segment); int getOffset(); int getOffset(int cursorOffset); int toCursorOffset(int documentOffset); char getChar(); char getChar(int offset); boolean hasChar(); String getText(int offset, int endIndex); char getPrevious(); boolean hasPrevious(); boolean hasPrevious(int offset); char getPrevious(int offset); char getNext(); char getNext(int offset); String getTextAtOffset(); String getTextAtOffset(int length); boolean hasNext(); boolean hasNext(int offset); Matcher matcher(Pattern pattern); Matcher matcher(int offset, Pattern pattern); void advance(); void advance(int count); void rewind(int count); void rewind(); Line getLineAtOffset(); }
Cursor { public String getTextAtOffset() { return text.substring(textOffset, text.length()); } Cursor(TextSegment segment); int getOffset(); int getOffset(int cursorOffset); int toCursorOffset(int documentOffset); char getChar(); char getChar(int offset); boolean hasChar(); String getText(int offset, int endIndex); char getPrevious(); boolean hasPrevious(); boolean hasPrevious(int offset); char getPrevious(int offset); char getNext(); char getNext(int offset); String getTextAtOffset(); String getTextAtOffset(int length); boolean hasNext(); boolean hasNext(int offset); Matcher matcher(Pattern pattern); Matcher matcher(int offset, Pattern pattern); void advance(); void advance(int count); void rewind(int count); void rewind(); Line getLineAtOffset();  }