Skip to content

Commit

Permalink
[docs] Document the SpoonNode interface
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
slarse committed May 24, 2020
1 parent 737e935 commit 48c8e78
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/main/java/se/kth/spork/spoon/wrappers/SpoonNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,47 @@

import java.util.List;

/**
* Interface describing a Spoon node as used in Spork. All concrete (i.e. non-virtual) {@link SpoonNode}s wrap a Spoon
* {@link CtElement}. All nodes but list edges have at least the start/end of child list virtual nodes.
*
* @author Simon Larsén
*/
public interface SpoonNode extends ListNode {

/**
* @return The element wrapped by this node. Only legal to call on concrete nodes.
* @throws UnsupportedOperationException If the node is not concrete.
*/
CtElement getElement();

/**
* @return The parent of this node.
* @throws UnsupportedOperationException If called on the virtual root.
*/
SpoonNode getParent();

/**
* @return The revision this node was created from.
* @throws UnsupportedOperationException If called on the virtual root.
*/
Revision getRevision();

/**
* @return All virtual children belonging to this node.
* @throws UnsupportedOperationException If called on a list edge.
*/
List<SpoonNode> getVirtualNodes();

/**
* @return The start of this node's child list.
* @throws UnsupportedOperationException If called on a list edge.
*/
SpoonNode getStartOfChildList();

/**
* @return The end of this node's child list.
* @throws UnsupportedOperationException If called on a list edge.
*/
SpoonNode getEndOfChildList();
}

0 comments on commit 48c8e78

Please sign in to comment.