Class ExpressionBranch
java.lang.Object
com.blackrook.expression.node.ExpressionBranch
- All Implemented Interfaces:
ExpressionNode
Expression branch.
- Author:
- Matthew Tropiano
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExpressionBranchcreate(ExpressionNode[] successBlock) Creates a new expression branch - always succeed, one success block.static ExpressionBranchcreate(ExpressionNode[] conditional, ExpressionNode[] successBlock) Creates a new expression branch, no failure block.static ExpressionBranchcreate(ExpressionNode[] conditional, ExpressionNode[] successBlock, ExpressionNode[] failureBlock) Creates a new expression branch, no failure block.booleanexecute(ExpressionStack stack, ExpressionVariableContext context) Executes this node.booleanChecks if this node is collapsable.toString()voidwriteBytes(OutputStream out) Write value as bytes (for digest later).
-
Method Details
-
create
Creates a new expression branch - always succeed, one success block.- Parameters:
successBlock- the block to use on conditional success.- Returns:
- a new expression branch node.
-
create
Creates a new expression branch, no failure block.- Parameters:
conditional- the conditional block. Must end in a directive that leaves a value on the stack.successBlock- the block to use on conditional success.- Returns:
- a new expression branch node.
-
create
public static ExpressionBranch create(ExpressionNode[] conditional, ExpressionNode[] successBlock, ExpressionNode[] failureBlock) Creates a new expression branch, no failure block.- Parameters:
conditional- the conditional block. Must end in a directive that leaves a value on the stack.successBlock- the block to use on conditional success.failureBlock- the block to use on conditional failure.- Returns:
- a new expression branch node.
-
isCollapsable
public boolean isCollapsable()Description copied from interface:ExpressionNodeChecks if this node is collapsable.- Specified by:
isCollapsablein interfaceExpressionNode- Returns:
- true if so, false if not.
-
execute
Description copied from interface:ExpressionNodeExecutes this node.- Specified by:
executein interfaceExpressionNode- Parameters:
stack- the stack to use.context- the context for added variables.- Returns:
- if false, stop expression calculation, else if true, continue.
-
writeBytes
Description copied from interface:ExpressionNodeWrite value as bytes (for digest later).- Specified by:
writeBytesin interfaceExpressionNode- Parameters:
out- the output stream.- Throws:
IOException- on a write error.
-
toString
-