Package com.blackrook.expression.node
Class ExpressionDirective
- java.lang.Object
-
- com.blackrook.expression.node.ExpressionDirective
-
- All Implemented Interfaces:
ExpressionNode
public class ExpressionDirective extends Object implements ExpressionNode
Single expression directive.- Author:
- Matthew Tropiano
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExpressionDirective
create(ExpressionDirectiveType type)
Creates a new Expression directive.static ExpressionDirective
create(ExpressionDirectiveType type, boolean operand)
Creates a new Expression directive.static ExpressionDirective
create(ExpressionDirectiveType type, double operand)
Creates a new Expression directive.static ExpressionDirective
create(ExpressionDirectiveType type, long operand)
Creates a new Expression directive.static ExpressionDirective
create(ExpressionDirectiveType type, String operand)
Creates a new Expression directive.boolean
execute(ExpressionStack stack, ExpressionVariableContext context)
Executes this node.Object
getOperand()
ExpressionDirectiveType
getType()
boolean
isCollapsable()
Checks if this node is collapsable.String
toString()
void
writeBytes(OutputStream out)
Write value as bytes (for digest later).
-
-
-
Method Detail
-
create
public static ExpressionDirective create(ExpressionDirectiveType type)
Creates a new Expression directive.- Parameters:
type
- the directive type.- Returns:
- a new expression directive.
-
create
public static ExpressionDirective create(ExpressionDirectiveType type, boolean operand)
Creates a new Expression directive.- Parameters:
type
- the directive type.operand
- the operand.- Returns:
- a new expression directive.
-
create
public static ExpressionDirective create(ExpressionDirectiveType type, long operand)
Creates a new Expression directive.- Parameters:
type
- the directive type.operand
- the operand.- Returns:
- a new expression directive.
-
create
public static ExpressionDirective create(ExpressionDirectiveType type, double operand)
Creates a new Expression directive.- Parameters:
type
- the directive type.operand
- the operand.- Returns:
- a new expression directive.
-
create
public static ExpressionDirective create(ExpressionDirectiveType type, String operand)
Creates a new Expression directive.- Parameters:
type
- the directive type.operand
- the operand.- Returns:
- a new expression directive.
-
getType
public ExpressionDirectiveType getType()
-
getOperand
public Object getOperand()
-
isCollapsable
public boolean isCollapsable()
Description copied from interface:ExpressionNode
Checks if this node is collapsable.- Specified by:
isCollapsable
in interfaceExpressionNode
- Returns:
- true if so, false if not.
-
execute
public boolean execute(ExpressionStack stack, ExpressionVariableContext context)
Description copied from interface:ExpressionNode
Executes this node.- Specified by:
execute
in interfaceExpressionNode
- Parameters:
stack
- the stack to use.context
- the context for added variables.- Returns:
- if false, stop expression calculation, else if true, continue.
-
writeBytes
public void writeBytes(OutputStream out) throws IOException
Description copied from interface:ExpressionNode
Write value as bytes (for digest later).- Specified by:
writeBytes
in interfaceExpressionNode
- Parameters:
out
- the output stream.- Throws:
IOException
- on a write error.
-
-