Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an If predicate #81

Closed
p013570 opened this issue Jan 29, 2018 · 1 comment
Closed

Create an If predicate #81

p013570 opened this issue Jan 29, 2018 · 1 comment
Assignees
Labels
enhancement Improvement to existing functionality/feature
Milestone

Comments

@p013570
Copy link
Member

p013570 commented Jan 29, 2018

The predicate would have 3 fields:
'condition': boolean
'then': Predicate
'else': Predicate

We should also allow a 'predicate' field to be set instead of the 'condition'. The logic would then look something like:

boolean computedCondition;
if(null == condition) {
    computedCondition = null != predicate && predicate.test(input);
} else {
    computedCondition = condition;
}

if(computedCondition) {
    return null == then || then.test(input);
}
return null == else || else.test(input);

This should be similar to the way the Not predicate is implemented.

@p013570 p013570 added the enhancement Improvement to existing functionality/feature label Jan 29, 2018
m607123 added a commit that referenced this issue Jan 29, 2018
m607123 added a commit that referenced this issue Jan 31, 2018
m607123 added a commit that referenced this issue Feb 1, 2018
m607123 added a commit that referenced this issue Feb 1, 2018
m607123 added a commit that referenced this issue Feb 21, 2018
p013570 added a commit that referenced this issue Feb 21, 2018
@p013570
Copy link
Member Author

p013570 commented Feb 21, 2018

Merged into develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing functionality/feature
Projects
None yet
Development

No branches or pull requests

2 participants