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

Mark Proctor (JIRA) issues at jboss.org
Thu Jul 23 13:30:03 EDT 2015


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

Mark Proctor reassigned DROOLS-592:
-----------------------------------

    Assignee: Mario Fusco  (was: Mark Proctor)


> 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
(v6.3.15#6346)


More information about the jboss-jira mailing list