[jboss-jira] [JBoss JIRA] (DROOLS-592) Condition Evaluator should instantiate argument only once.

Tibor Zimányi (JIRA) issues at jboss.org
Wed Jul 11 07:13:00 EDT 2018


     [ https://issues.jboss.org/browse/DROOLS-592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tibor Zimányi closed DROOLS-592.
--------------------------------
    Resolution: Won't Do


> Condition Evaluator should instantiate argument only once.
> ----------------------------------------------------------
>
>                 Key: DROOLS-592
>                 URL: https://issues.jboss.org/browse/DROOLS-592
>             Project: Drools
>          Issue Type: Feature Request
>    Affects Versions: 6.2.0.Beta1
>            Reporter: david hendi
>            Assignee: Mario Fusco
>            Priority: Optional
>
> the argument(s) used within the evaluate method of a Conditional Evaluator should instantiate argument only once in order to reduce object creation and GC. 
> current generated class:
> public class ConditionEvaluatorfff283c427e34a39877bce16cac05521
>   implements ConditionEvaluator
> {
>   private static final String EXPRESSION = "!( ids contains 614201302l )";
>   private final Declaration[] declarations;
>   
>   public ConditionEvaluatorfff283c427e34a39877bce16cac05521(Declaration[] paramArrayOfDeclaration)
>   {
>     this.declarations = paramArrayOfDeclaration;
>   }
>   
>   public boolean evaluate(InternalFactHandle paramInternalFactHandle, InternalWorkingMemory paramInternalWorkingMemory, LeftTuple paramLeftTuple)
>   {
>     Collection localCollection = ((Context)paramInternalFactHandle.getObject()).getIds();
>     Long localLong = new Long("614201302");
>     return !(localLong == null ? false : localCollection == null ? false : EvaluatorHelper.contains(localCollection, localLong));
>   }
> }
> proposed class:
> public class ConditionEvaluatorfff283c427e34a39877bce16cac05521
>   implements ConditionEvaluator
> {
>   private static final String EXPRESSION = "!( ids contains 614201302l )";
>   private static Long localLong = new Long("614201302");
>   private final Declaration[] declarations;
>   
>   public ConditionEvaluatorfff283c427e34a39877bce16cac05521(Declaration[] paramArrayOfDeclaration)
>   {
>     this.declarations = paramArrayOfDeclaration;
>   }
>   
>   public boolean evaluate(InternalFactHandle paramInternalFactHandle, InternalWorkingMemory paramInternalWorkingMemory, LeftTuple paramLeftTuple)
>   {
>     Collection localCollection = ((Context)paramInternalFactHandle.getObject()).getIds();
>     
>     return !(localLong == null ? false : localCollection == null ? false : EvaluatorHelper.contains(localCollection, localLong));
>   }
> }



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)



More information about the jboss-jira mailing list