org.odftoolkit.simple.common.navigation
Class Navigation

java.lang.Object
  extended by org.odftoolkit.simple.common.navigation.Navigation
Direct Known Subclasses:
TextNavigation, TextStyleNavigation

public abstract class Navigation
extends Object

Navigation is used to navigate the document and find the matched element by user defined conditions.


Constructor Summary
Navigation()
           
 
Method Summary
protected  Node getNextMatchElement(Node startpoint)
          Get the next matched element in the whole element tree.
protected  Node getNextMatchElementInTree(Node startpoint, Node root)
          Get the next matched element node in a sub tree
abstract  boolean hasNext()
          Return true if document still has more matched Selection when traversing the document(in other words return true if getNextMatchElement() would return an element instance rather than return null)
abstract  boolean match(Node element)
          Check if the element is a qualified one.
abstract  Selection nextSelection()
          Get next Selection result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Navigation

public Navigation()
Method Detail

hasNext

public abstract boolean hasNext()
Return true if document still has more matched Selection when traversing the document(in other words return true if getNextMatchElement() would return an element instance rather than return null)

Returns:
true if document still has more matched Selection, and vice versa

nextSelection

public abstract Selection nextSelection()
Get next Selection result.

Returns:
the next Selection result

match

public abstract boolean match(Node element)
Check if the element is a qualified one.

Developers can define their own logic here to determine whether an element satisfies the requirements.

Parameters:
element - navigate this element node.
Returns:
true if the element node match the user defined condition; false if not match.

getNextMatchElement

protected Node getNextMatchElement(Node startpoint)
Get the next matched element in the whole element tree.

Parameters:
startpoint - navigate from the start point
Returns:
the next matched element node

getNextMatchElementInTree

protected Node getNextMatchElementInTree(Node startpoint,
                                         Node root)
Get the next matched element node in a sub tree

Parameters:
startpoint - navigate from the start point
root - the root of the sub tree
Returns:
the next matched element


Copyright © 2010-2017 The Apache Software Foundation. All Rights Reserved.