com.bbn.swede.core.dom
Interface IOASTDelta

All Known Implementing Classes:
OASTDelta

public interface IOASTDelta

Represents changes to a document's OWL abstract syntax tree between two discrete points in time. Only structural changes are considered when computing OAST deltas. Position and length adjustments always affect the tree as a whole, so components that rely upon stored offsets should always do a full refresh when the OAST changes to ensure accuracy.

Author:
jlerner

Field Summary
static int CHANGED
          Change constant (bit mask) indicating that the node has been changed.
static int DESCENDANT
          Change constant (bit mask) indicating that there are changes below the node in the tree.
static int INSERTED
          Change constant (bit mask) indicating that the node has been inserted as a child of its parent.
static int REMOVED
          Change constant (bit mask) indicating that the node has been removed as a child of its parent.
static int REPLACED
          Change constant (bit mask) indicating that the node has been replaced with another node of the same type.
 
Method Summary
 void accept(IOASTDeltaVisitor visitor)
          Begins a preorder traversal starting with this delta.
 IOASTDelta[] getChildren()
          Returns OAST deltas for all children of this node which were inserted, removed, replaced, or changed.
 IOASTDelta[] getChildren(int typeMask)
          Returns OAST deltas for all children of this node whose type matches the specified mask.
 IOASTDelta[] getDeltas(int typeMask)
          Searches the delta tree rooted at this delta for all changes matching a particular type mask.
 OASTNode getNodeAfter()
          Retrieves the node that is in the tree after the event that created this delta.
 OASTNode getNodeBefore()
          Retrieves the node that was in the tree before the event that created this delta.
 int getType()
          Returns the type of this OAST delta.
 boolean typeMatches(int typeMask)
          Indicates whether the delta's type matches a specified mask.
 

Field Detail

INSERTED

public static final int INSERTED
Change constant (bit mask) indicating that the node has been inserted as a child of its parent.

See Also:
Constant Field Values

REMOVED

public static final int REMOVED
Change constant (bit mask) indicating that the node has been removed as a child of its parent.

See Also:
Constant Field Values

CHANGED

public static final int CHANGED
Change constant (bit mask) indicating that the node has been changed. This value only applies to TextNodes and AttributeNodes.

See Also:
Constant Field Values

REPLACED

public static final int REPLACED
Change constant (bit mask) indicating that the node has been replaced with another node of the same type. This usually indicates that a portion of the document was reparsed without major structural changes.

See Also:
Constant Field Values

DESCENDANT

public static final int DESCENDANT
Change constant (bit mask) indicating that there are changes below the node in the tree.

See Also:
Constant Field Values
Method Detail

getNodeBefore

public OASTNode getNodeBefore()
Retrieves the node that was in the tree before the event that created this delta. There is no before node for INSERTED or DESCENDANT deltas.

Returns:
The node as it existed before the event, or null if this is not applicable for the delta's type.

getNodeAfter

public OASTNode getNodeAfter()
Retrieves the node that is in the tree after the event that created this delta. There is no after node for REMOVED deltas.

Returns:
The node as it exists after the event, or null if this is not applicable for the delta's type.

getType

public int getType()
Returns the type of this OAST delta. The type will be one of INSERTED, REMOVED, CHANGED, REPLACED, or DESCENDANT.

Returns:
the type of this OAST delta

accept

public void accept(IOASTDeltaVisitor visitor)
Begins a preorder traversal starting with this delta. The visitor's visit method will be called for this resource delta and, if it returns true, on this delta's children.

Parameters:
visitor - The visitor to use for the traversal.

getChildren

public IOASTDelta[] getChildren()

Returns OAST deltas for all children of this node which were inserted, removed, replaced, or changed.

This is a convenience method, fully equivalent to:

getChildren(INSERTED | REMOVED | CHANGED | DESCENDANT)

Returns:
the OAST deltas for all child nodes, or an empty array if no children were modified.

getChildren

public IOASTDelta[] getChildren(int typeMask)
Returns OAST deltas for all children of this node whose type matches the specified mask.

Parameters:
typeMask - a type mask formed by a bitwise OR of IOASTDelta type constants
Returns:
the OAST deltas for all child nodes matching typeMask, or an empty array if no children match.

getDeltas

public IOASTDelta[] getDeltas(int typeMask)
Searches the delta tree rooted at this delta for all changes matching a particular type mask.

Parameters:
typeMask - The type mask.
Returns:
An array containing all deltas matching typeMask.

typeMatches

public boolean typeMatches(int typeMask)
Indicates whether the delta's type matches a specified mask.

Parameters:
typeMask - The type mask.
Returns:
true if this delta's type matches typeMask, false if not.


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.