net.sf.sasl.language.placeholder.syntax
Class PlaceholderNode

java.lang.Object
  extended by net.sf.sasl.language.placeholder.syntax.ASTNode
      extended by net.sf.sasl.language.placeholder.syntax.PlaceholderNode

public class PlaceholderNode
extends ASTNode

Defines a placeholder node. Placeholder nodes are references to "procedures" and have got a list of arguments.

Since:
0.0.1 (sasl-common-aspect-library)
Author:
Philipp Förmer

Field Summary
 
Fields inherited from class net.sf.sasl.language.placeholder.syntax.ASTNode
INDENT_PER_DEPTH, INDENT_STRING
 
Constructor Summary
PlaceholderNode(String placeholderName, List<ASTNode> argumentList)
          Creates a placeholder node with the given placeholder name and list of arguments.
 
Method Summary
 void addArgument(ASTNode argument)
          Adds the given argument at the end of the argument list.
 List<ASTNode> getArgumentList()
          Returns a copy of the placeholders argument list.
 List<ASTNode> getChildNodes()
          Returns a list of all child nodes of this node.
 String getPlaceholderName()
          Returns the name of the placeholder this node references.
 boolean isLeafNode()
          Returns true if this node is a leaf node.
 String prettyPrint(int indent)
          Returns a human readable string representation of the tree spanned of by this node.
 void setArgumentList(List<ASTNode> argumentList)
          Sets the given argument list as the placeholders argument list.
 void setPlaceholderName(String placeholderName)
          Sets then name of the placeholder that this node references.
 
Methods inherited from class net.sf.sasl.language.placeholder.syntax.ASTNode
getParentNode, isRootNode, setParentNode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlaceholderNode

public PlaceholderNode(String placeholderName,
                       List<ASTNode> argumentList)
                throws IllegalArgumentException
Creates a placeholder node with the given placeholder name and list of arguments.

Parameters:
placeholderName - non null name of the placeholder this node references.
argumentList - non null list of arguments.
Throws:
IllegalArgumentException
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
setPlaceholderName(String)
Method Detail

getPlaceholderName

public String getPlaceholderName()
Returns the name of the placeholder this node references.

Returns:
non null
Since:
0.0.1 (sasl-common-aspect-library)

setPlaceholderName

public void setPlaceholderName(String placeholderName)
                        throws IllegalArgumentException
Sets then name of the placeholder that this node references. If the placeholder starts with % than it will be cutted from the name.

Parameters:
placeholderName - non null
Throws:
IllegalArgumentException - if placeholderName is null.
Since:
0.0.1 (sasl-common-aspect-library)

getArgumentList

public List<ASTNode> getArgumentList()
Returns a copy of the placeholders argument list.

Returns:
non null
Since:
0.0.1 (sasl-common-aspect-library)

setArgumentList

public void setArgumentList(List<ASTNode> argumentList)
                     throws IllegalArgumentException
Sets the given argument list as the placeholders argument list. Null values in the list will be ignored.

Parameters:
argumentList - non null
Throws:
IllegalArgumentException - if argumentList is null.
Since:
0.0.1 (sasl-common-aspect-library)

addArgument

public void addArgument(ASTNode argument)
                 throws IllegalArgumentException
Adds the given argument at the end of the argument list. The method will update the nodes parent node.

Parameters:
argument - non null
Throws:
IllegalArgumentException - if argument is null.
Since:
0.0.1 (sasl-common-aspect-library)

isLeafNode

public boolean isLeafNode()
Description copied from class: ASTNode
Returns true if this node is a leaf node. False else.

Overrides:
isLeafNode in class ASTNode
Returns:
true or false.
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
ASTNode.isLeafNode()

getChildNodes

public List<ASTNode> getChildNodes()
Description copied from class: ASTNode
Returns a list of all child nodes of this node.

Overrides:
getChildNodes in class ASTNode
Returns:
non null list.
See Also:
ASTNode.getChildNodes()

prettyPrint

public String prettyPrint(int indent)
Description copied from class: ASTNode
Returns a human readable string representation of the tree spanned of by this node.

Specified by:
prettyPrint in class ASTNode
Parameters:
indent - how often ASTNode.INDENT_STRING should be printed in front of each new line at this tree depth.
Returns:
non null string
Since:
0.0.1 (sasl-common-aspect-library)
See Also:
ASTNode.prettyPrint(int)


Copyright © 2010. All Rights Reserved.