Fix formatting

pull/271/head
Mahmoud Ben Hassine 5 years ago
parent 28f186babc
commit c512bc33f2
No known key found for this signature in database
GPG Key ID: 79FCFB0A184E0036

@ -91,10 +91,10 @@ public class Rules implements Iterable<Rule> {
*
* @param ruleName the name of the rule to unregister
*/
public void unregister(final String ruleName){
public void unregister(final String ruleName) {
Objects.requireNonNull(ruleName);
Rule rule = findRuleByName(ruleName);
if(rule != null) {
if (rule != null) {
unregister(rule);
}
}
@ -120,7 +120,7 @@ public class Rules implements Iterable<Rule> {
return rules.iterator();
}
private Rule findRuleByName(String ruleName){
private Rule findRuleByName(String ruleName) {
return rules.stream()
.filter(rule -> rule.getName().equalsIgnoreCase(ruleName))
.findFirst()

@ -67,7 +67,7 @@ public final class InferenceRulesEngine extends AbstractRulesEngine {
do {
LOGGER.debug("Selecting candidate rules based on the following facts: {}", facts);
selectedRules = selectCandidates(rules, facts);
if(!selectedRules.isEmpty()) {
if (!selectedRules.isEmpty()) {
delegate.fire(new Rules(selectedRules), facts);
} else {
LOGGER.debug("No candidate rules found for facts: {}", facts);

@ -119,19 +119,19 @@ class RuleDefinitionValidator {
private boolean validParameters(final Method method) {
int notAnnotatedParameterCount = 0;
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
for(Annotation[] annotations : parameterAnnotations){
if(annotations.length == 0){
for (Annotation[] annotations : parameterAnnotations) {
if (annotations.length == 0) {
notAnnotatedParameterCount += 1;
} else {
//Annotation types has to be Fact
for(Annotation annotation : annotations){
if(!annotation.annotationType().equals(Fact.class)){
for (Annotation annotation : annotations) {
if (!annotation.annotationType().equals(Fact.class)) {
return false;
}
}
}
}
if(notAnnotatedParameterCount > 1){
if (notAnnotatedParameterCount > 1) {
return false;
}
if (notAnnotatedParameterCount == 1) {

@ -27,12 +27,9 @@ import java.lang.annotation.Annotation;
final class Utils {
private Utils() {
}
private Utils() { }
static <A extends Annotation> A findAnnotation(final Class<A> targetAnnotation, final Class<?> annotatedType) {
A foundAnnotation = annotatedType.getAnnotation(targetAnnotation);
if (foundAnnotation == null) {
for (Annotation annotation : annotatedType.getAnnotations()) {

@ -34,7 +34,7 @@ public class RuleDefinitionValidatorTest {
private RuleDefinitionValidator ruleDefinitionValidator;
@Before
public void setup(){
public void setup() {
ruleDefinitionValidator = new RuleDefinitionValidator();
}

@ -94,7 +94,7 @@ public abstract class AbstractRuleDefinitionReader implements RuleDefinitionRead
throw new IllegalArgumentException("Composite rules must have composing rules specified");
} else if (composingRules != null) {
List<RuleDefinition> composingRuleDefinitions = new ArrayList<>();
for (Object rule : composingRules){
for (Object rule : composingRules) {
Map<String, Object> composingRuleMap = (Map<String, Object>) rule;
composingRuleDefinitions.add(createRuleDefinition(composingRuleMap));
}

@ -28,7 +28,7 @@ package org.jeasy.rules.tutorials.fizzbuzz;
*/
public class FizzBuzz { // Everything in Java is a class
public static void main(String[] args) { // Every program must have main()
for(int i = 1; i <= 100; i++) { // count from 1 to 100
for (int i = 1; i <= 100; i++) { // count from 1 to 100
if (((i % 5) == 0) && ((i % 7) == 0)) // A multiple of both?
System.out.print("fizzbuzz");
else if ((i % 5) == 0) System.out.print("fizz"); // else a multiple of 5?

Loading…
Cancel
Save