Class TextNavigation
- java.lang.Object
-
- org.odftoolkit.odfdom.incubator.search.Navigation<TextSelection>
-
- org.odftoolkit.odfdom.incubator.search.TextNavigation
-
- All Implemented Interfaces:
Iterator<TextSelection>
public class TextNavigation extends Navigation<TextSelection>
A derived Navigation class used for navigate the text content it is used to search the document and find the matched text and would return TextSelection instance
-
-
Constructor Summary
Constructors Constructor Description TextNavigation(String pattern, OdfTextDocument doc)
Construct TextNavigation with matched condition and navigation scopeTextNavigation(Pattern pattern, OdfTextDocument doc)
Construct TextNavigation with matched condition and navigation scope
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OdfElement
getElement()
SelectionManager
getSelectionManager()
Returns the selectionManager instance.boolean
hasNext()
Returnstrue
if the Document has more matching elements.boolean
match(Node element)
check if the text content of element match the specified pattern stringTextSelection
next()
Returns the next matching element in the document.-
Methods inherited from class org.odftoolkit.odfdom.incubator.search.Navigation
getNextMatchElement, getNextMatchElementInTree
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Constructor Detail
-
TextNavigation
public TextNavigation(String pattern, OdfTextDocument doc)
Construct TextNavigation with matched condition and navigation scope- Parameters:
pattern
- the matched pattern Stringdoc
- the navigation scope
-
TextNavigation
public TextNavigation(Pattern pattern, OdfTextDocument doc)
Construct TextNavigation with matched condition and navigation scope- Parameters:
pattern
- the Pattern object to search withdoc
- the navigation scope
-
-
Method Detail
-
getSelectionManager
public SelectionManager getSelectionManager()
Returns the selectionManager instance.- Returns:
-
next
public TextSelection next()
Returns the next matching element in the document.- Specified by:
next
in interfaceIterator<TextSelection>
- Specified by:
next
in classNavigation<TextSelection>
- Returns:
- the next element
- Throws:
NoSuchElementException
- if the iteration has no more matching elements
-
hasNext
public boolean hasNext()
Returnstrue
if the Document has more matching elements. (In other words, returnstrue
ifnext()
would return an element rather than throwing an exception.)- Specified by:
hasNext
in interfaceIterator<TextSelection>
- Specified by:
hasNext
in classNavigation<TextSelection>
- Returns:
- true if document still has more matched Selection, and vice versa
-
getElement
public OdfElement getElement()
- Specified by:
getElement
in classNavigation<TextSelection>
-
match
public boolean match(Node element)
check if the text content of element match the specified pattern string- Specified by:
match
in classNavigation<TextSelection>
- Parameters:
element
- navigate this element- Returns:
- true if the text content of this element match this pattern; false if not match
-
-