Package org.drools.compiler.lang.api
Interface AccumulateDescrBuilder<P extends DescrBuilder<?,?>>
-
- All Superinterfaces:
DescrBuilder<P,AccumulateDescr>
- All Known Subinterfaces:
GroupByDescrBuilder<P>
- All Known Implementing Classes:
AccumulateDescrBuilderImpl
,GroupByDescrBuilderImpl
public interface AccumulateDescrBuilder<P extends DescrBuilder<?,?>> extends DescrBuilder<P,AccumulateDescr>
A descriptor builder for Accumulate
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AccumulateDescrBuilder<P>
action(String block)
For accumulate CEs that use custom code blocks, this call sets the content of the action code block.AccumulateDescrBuilder<P>
constraint(String constr)
P
end()
Returns the parent container of this descr builder.AccumulateDescrBuilder<P>
function(String name, String bind, boolean isUnification, String... parameters)
For accumulate CEs that use accumulate functions, this call instantiate one accumulate function call.AccumulateDescrBuilder<P>
init(String block)
For accumulate CEs that use custom code blocks, this call sets the content of the init code block.AccumulateDescrBuilder<P>
result(String expr)
For accumulate CEs that use custom code blocks, this call sets the content of the result expression.AccumulateDescrBuilder<P>
reverse(String block)
For accumulate CEs that use custom code blocks, this call sets the content of the reverse code block.CEDescrBuilder<AccumulateDescrBuilder<P>,AndDescr>
source()
Defines the source CE for the Accumulate CE.-
Methods inherited from interface org.drools.compiler.lang.api.DescrBuilder
endCharacter, endLocation, getDescr, startCharacter, startLocation
-
-
-
-
Method Detail
-
source
CEDescrBuilder<AccumulateDescrBuilder<P>,AndDescr> source()
Defines the source CE for the Accumulate CE. It is always an AND descriptor that contains one or more Patterns and other CEs.- Returns:
- the CEDescrBuilder for the source CE
-
function
AccumulateDescrBuilder<P> function(String name, String bind, boolean isUnification, String... parameters)
For accumulate CEs that use accumulate functions, this call instantiate one accumulate function call. Example: ... accumulate( X(), $sum : sum( $value ) ) Requires the call to this method with parameters: function( "sum", "$sum", new String[] { "$value" } ) Please note that accumulate supports multiple function calls and this method should be called for each function call. Accumulate uses either accumulate functions or the custom code blocks (init/action/reverse/result). It is not possible to mix them.- Parameters:
name
- the name of the function being called. Mandatory non-null parameter.bind
- the name of the bound variable if there is one. Null if no binding should be made.isUnification
- true if the bound variable is expected to unify with the result of the acc function. false otherwiseparameters
- the array of parameters to the function.- Returns:
- itself, so that it can be used as a fluent API
-
init
AccumulateDescrBuilder<P> init(String block)
For accumulate CEs that use custom code blocks, this call sets the content of the init code block. Please node that the use of custom code blocks is discouraged, as they are usually a bad practice. Accumulate uses either accumulate functions or the custom code blocks (init/action/reverse/result). It is not possible to mix them.- Parameters:
block
- the code for this block- Returns:
- itself, so that it can be used as a fluent API
-
action
AccumulateDescrBuilder<P> action(String block)
For accumulate CEs that use custom code blocks, this call sets the content of the action code block. Please node that the use of custom code blocks is discouraged, as they are usually a bad practice. Accumulate uses either accumulate functions or the custom code blocks (init/action/reverse/result). It is not possible to mix them.- Parameters:
block
- the code for this block- Returns:
- itself, so that it can be used as a fluent API
-
reverse
AccumulateDescrBuilder<P> reverse(String block)
For accumulate CEs that use custom code blocks, this call sets the content of the reverse code block. Please node that the use of custom code blocks is discouraged, as they are usually a bad practice. Accumulate uses either accumulate functions or the custom code blocks (init/action/reverse/result). It is not possible to mix them.- Parameters:
block
- the code for this block- Returns:
- itself, so that it can be used as a fluent API
-
result
AccumulateDescrBuilder<P> result(String expr)
For accumulate CEs that use custom code blocks, this call sets the content of the result expression. Please node that the use of custom code blocks is discouraged, as they are usually a bad practice. Accumulate uses either accumulate functions or the custom code blocks (init/action/reverse/result). It is not possible to mix them.- Parameters:
expr
- the return expr- Returns:
- itself, so that it can be used as a fluent API
-
end
P end()
Description copied from interface:DescrBuilder
Returns the parent container of this descr builder. Example: ruleDescrBuilder.end() will return the PackageDescrBuilder as that is its parent container.- Specified by:
end
in interfaceDescrBuilder<P extends DescrBuilder<?,?>,AccumulateDescr>
- Returns:
-
constraint
AccumulateDescrBuilder<P> constraint(String constr)
-
-