diff --git a/drools-base/src/main/java/org/drools/base/base/AccessorKey.java b/drools-base/src/main/java/org/drools/base/base/AccessorKey.java index e7c33be0153..c6cf4a3db1d 100644 --- a/drools-base/src/main/java/org/drools/base/base/AccessorKey.java +++ b/drools-base/src/main/java/org/drools/base/base/AccessorKey.java @@ -86,22 +86,40 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } AccessorKey other = (AccessorKey) obj; if ( className == null ) { - if ( other.className != null ) return false; - } else if ( !className.equals( other.className ) ) return false; + if ( other.className != null ) { + return false; + } + } else if ( !className.equals( other.className ) ) { + return false; + } if ( fieldName == null ) { - if ( other.fieldName != null ) return false; - } else if ( !fieldName.equals( other.fieldName ) ) return false; + if ( other.fieldName != null ) { + return false; + } + } else if ( !fieldName.equals( other.fieldName ) ) { + return false; + } if ( type == null ) { - if ( other.type != null ) return false; - } else if ( !type.equals( other.type ) ) return false; + if ( other.type != null ) { + return false; + } + } else if ( !type.equals( other.type ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java b/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java index c765c5a8308..f5bd9010a32 100644 --- a/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java +++ b/drools-base/src/main/java/org/drools/base/base/BaseClassFieldReader.java @@ -18,15 +18,15 @@ */ package org.drools.base.base; -import org.drools.base.common.DroolsObjectInput; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.util.ClassUtils; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.drools.base.common.DroolsObjectInput; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.util.ClassUtils; + /** * This is the supertype for the ASM generated classes for accessing a field. */ diff --git a/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java b/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java index 312dee062cf..7394e7a1429 100644 --- a/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java +++ b/drools-base/src/main/java/org/drools/base/base/EnabledBoolean.java @@ -25,8 +25,8 @@ import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.accessor.Enabled; import org.drools.base.rule.Declaration; +import org.drools.base.rule.accessor.Enabled; public class EnabledBoolean implements diff --git a/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java b/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java index 0ca90a40ca9..b3bb7ace8a4 100644 --- a/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java +++ b/drools-base/src/main/java/org/drools/base/base/extractors/ArrayElementReader.java @@ -24,11 +24,11 @@ import java.io.ObjectOutput; import java.lang.reflect.Method; +import org.drools.base.base.ClassWireable; import org.drools.base.base.ValueResolver; +import org.drools.base.base.ValueType; import org.drools.base.rule.accessor.AcceptsReadAccessor; import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.base.ValueType; -import org.drools.base.base.ClassWireable; import org.drools.util.ClassUtils; import org.drools.util.StringUtils; @@ -192,14 +192,26 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final ArrayElementReader other = (ArrayElementReader) obj; if ( arrayReadAccessor == null ) { - if ( other.arrayReadAccessor != null ) return false; - } else if ( !arrayReadAccessor.equals( other.arrayReadAccessor ) ) return false; - if ( index != other.index ) return false; + if ( other.arrayReadAccessor != null ) { + return false; + } + } else if ( !arrayReadAccessor.equals( other.arrayReadAccessor ) ) { + return false; + } + if ( index != other.index ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java b/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java index 5635a53e03d..a57546787d3 100755 --- a/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java +++ b/drools-base/src/main/java/org/drools/base/base/extractors/BaseObjectClassFieldReader.java @@ -21,8 +21,8 @@ import java.lang.reflect.Method; import java.util.Date; -import org.drools.base.base.ValueResolver; import org.drools.base.base.BaseClassFieldReader; +import org.drools.base.base.ValueResolver; import org.drools.base.base.ValueType; public abstract class BaseObjectClassFieldReader extends BaseClassFieldReader { diff --git a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java index 648a513196c..12e24a4694c 100644 --- a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java +++ b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInput.java @@ -18,10 +18,10 @@ */ package org.drools.base.common; -import org.drools.base.RuleBase; - import java.io.ObjectInput; +import org.drools.base.RuleBase; + public interface DroolsObjectInput extends ObjectInput { ClassLoader getParentClassLoader(); ClassLoader getClassLoader(); diff --git a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java index d37fe74401d..dbadff5b4fb 100644 --- a/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java +++ b/drools-base/src/main/java/org/drools/base/common/DroolsObjectInputStream.java @@ -29,11 +29,11 @@ import java.util.Map; import java.util.function.Consumer; -import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.RuleBase; import org.drools.base.base.AccessorKey; import org.drools.base.base.ReadAccessorSupplier; +import org.drools.base.rule.accessor.ReadAccessor; import org.drools.util.ClassUtils; -import org.drools.base.RuleBase; public class DroolsObjectInputStream extends ObjectInputStream implements diff --git a/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java b/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java index 79777ae52f2..5becb3f8005 100644 --- a/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java +++ b/drools-base/src/main/java/org/drools/base/common/PartitionsManager.java @@ -18,13 +18,13 @@ */ package org.drools.base.common; -import org.drools.util.ObjectPool; -import org.kie.internal.concurrent.ExecutorProviderFactory; - import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.ForkJoinPool; +import org.drools.util.ObjectPool; +import org.kie.internal.concurrent.ExecutorProviderFactory; + public class PartitionsManager { public static final int MIN_PARALLEL_THRESHOLD = 8; diff --git a/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java b/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java index d1839f1e1a5..19cd8c5ce50 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java +++ b/drools-base/src/main/java/org/drools/base/definitions/InternalKnowledgePackage.java @@ -26,22 +26,22 @@ import java.util.Map; import java.util.Set; -import org.drools.base.definitions.rule.impl.RuleImpl; -import org.drools.base.facttemplates.FactTemplate; -import org.drools.base.rule.ImportDeclaration; -import org.drools.base.rule.TypeDeclaration; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.ruleunit.RuleUnitDescriptionLoader; +import org.drools.base.RuleBase; import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ObjectType; +import org.drools.base.definitions.rule.impl.RuleImpl; +import org.drools.base.facttemplates.FactTemplate; import org.drools.base.rule.DialectRuntimeRegistry; import org.drools.base.rule.Function; +import org.drools.base.rule.ImportDeclaration; +import org.drools.base.rule.TypeDeclaration; import org.drools.base.rule.WindowDeclaration; import org.drools.base.rule.accessor.AcceptsReadAccessor; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.ruleunit.RuleUnitDescriptionLoader; import org.drools.util.TypeResolver; import org.kie.api.definition.KiePackage; import org.kie.api.definition.process.Process; -import org.drools.base.RuleBase; import org.kie.api.definition.type.FactType; import org.kie.api.io.Resource; import org.kie.api.runtime.rule.AccumulateFunction; diff --git a/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java b/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java index d23dacb4ce3..e8b9004e0bc 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/impl/KnowledgePackageImpl.java @@ -37,13 +37,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.drools.base.rule.DialectRuntimeData; -import org.drools.base.rule.DuplicateRuleNameException; -import org.drools.base.rule.ImportDeclaration; -import org.drools.base.rule.InvalidRuleException; -import org.drools.base.rule.InvalidRulePackage; -import org.drools.base.rule.TypeDeclaration; -import org.drools.base.util.CloneUtil; +import org.drools.base.RuleBase; import org.drools.base.common.DroolsObjectInputStream; import org.drools.base.common.DroolsObjectOutputStream; import org.drools.base.definitions.InternalKnowledgePackage; @@ -52,10 +46,17 @@ import org.drools.base.definitions.rule.impl.GlobalImpl; import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.facttemplates.FactTemplate; +import org.drools.base.rule.DialectRuntimeData; import org.drools.base.rule.DialectRuntimeRegistry; +import org.drools.base.rule.DuplicateRuleNameException; import org.drools.base.rule.Function; +import org.drools.base.rule.ImportDeclaration; +import org.drools.base.rule.InvalidRuleException; +import org.drools.base.rule.InvalidRulePackage; +import org.drools.base.rule.TypeDeclaration; import org.drools.base.rule.WindowDeclaration; import org.drools.base.ruleunit.RuleUnitDescriptionLoader; +import org.drools.base.util.CloneUtil; import org.drools.util.ClassTypeResolver; import org.drools.util.ClassUtils; import org.drools.util.TypeResolver; @@ -64,7 +65,6 @@ import org.kie.api.definition.rule.Global; import org.kie.api.definition.rule.Query; import org.kie.api.definition.rule.Rule; -import org.drools.base.RuleBase; import org.kie.api.definition.type.FactType; import org.kie.api.io.Resource; import org.kie.api.io.ResourceType; @@ -766,7 +766,9 @@ public List removeProcessesGeneratedFromResource(Resource resource) { private void removeProcess(Process process) { ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2); - if (rtp != null) rtp.remove(process.getId()); + if (rtp != null) { + rtp.remove(process.getId()); + } } private List getProcessesGeneratedFromResource(Resource resource) { diff --git a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java index 7f0a1aa7195..df5976612dd 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/GlobalImpl.java @@ -18,13 +18,13 @@ */ package org.drools.base.definitions.rule.impl; -import org.kie.api.definition.rule.Global; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.kie.api.definition.rule.Global; + public class GlobalImpl implements Global, Externalizable { private String name; @@ -64,13 +64,21 @@ public void setType(String type) { } public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } GlobalImpl global = (GlobalImpl) o; - if (name != null ? !name.equals(global.name) : global.name != null) return false; - if (type != null ? !type.equals(global.type) : global.type != null) return false; + if (name != null ? !name.equals(global.name) : global.name != null) { + return false; + } + if (type != null ? !type.equals(global.type) : global.type != null) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java index 316b7343ea1..3001dbc7ef6 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/QueryImpl.java @@ -25,9 +25,9 @@ import java.util.function.Function; import org.drools.base.base.DroolsQuery; +import org.drools.base.base.ObjectType; import org.drools.base.base.ValueResolver; import org.drools.base.rule.Declaration; -import org.drools.base.base.ObjectType; import org.kie.api.definition.rule.Query; import org.kie.api.runtime.rule.Match; diff --git a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java index 93b1e600976..4cef19022b5 100644 --- a/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java +++ b/drools-base/src/main/java/org/drools/base/definitions/rule/impl/RuleImpl.java @@ -18,6 +18,21 @@ */ package org.drools.base.definitions.rule.impl; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Type; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.drools.base.base.EnabledBoolean; import org.drools.base.base.SalienceInteger; import org.drools.base.base.ValueResolver; @@ -43,21 +58,6 @@ import org.kie.api.runtime.rule.AgendaGroup; import org.kie.internal.definition.rule.InternalRule; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Type; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.Deque; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class RuleImpl implements Externalizable, Wireable, Dialectable, @@ -355,16 +355,16 @@ public Salience getSalience() { * @return The salience value. */ public int getSalienceValue() { - return getSalience().getValue(); + return getSalience().getValue(); } /** - * Returns true if the rule uses dynamic salience, false otherwise. - * - * @return true if the rule uses dynamic salience, else false. - */ + * Returns true if the rule uses dynamic salience, false otherwise. + * + * @return true if the rule uses dynamic salience, else false. + */ public boolean isSalienceDynamic() { - return getSalience().isDynamic(); + return getSalience().isDynamic(); } /** @@ -698,15 +698,25 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null || getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null || getClass() != obj.getClass() ) { + return false; + } final RuleImpl other = (RuleImpl) obj; if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } if ( pkg == null ) { return other.pkg == null; - } else return pkg.equals(other.pkg); + } else{ + return pkg.equals(other.pkg); + } } public void setSemanticallyValid(final boolean valid) { diff --git a/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java b/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java index fbd5fb48ba4..ae13c0272d4 100644 --- a/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java +++ b/drools-base/src/main/java/org/drools/base/factmodel/AnnotationDefinition.java @@ -68,12 +68,18 @@ public void writeExternal(ObjectOutput out) throws IOException { } public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } AnnotationDefinition that = (AnnotationDefinition) o; - if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (name != null ? !name.equals(that.name) : that.name != null) { + return false; + } return values != null ? values.equals(that.values) : that.values == null; } diff --git a/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java b/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java index ba5d3b7d9f9..a050f61fc42 100755 --- a/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java +++ b/drools-base/src/main/java/org/drools/base/factmodel/FieldDefinition.java @@ -27,9 +27,9 @@ import java.util.List; import java.util.Map; -import org.drools.base.factmodel.traits.Alias; import org.drools.base.base.CoreComponentsBuilder; import org.drools.base.base.FieldAccessor; +import org.drools.base.factmodel.traits.Alias; import org.drools.util.StringUtils; import org.kie.api.definition.type.Annotation; import org.kie.api.definition.type.FactField; @@ -54,8 +54,8 @@ public class FieldDefinition private String initExpr = null; private boolean recursive = false; private Map metaData; - private String getterName = null; - private String setterName = null; + private String getterName = null; + private String setterName = null; private List annotations; @@ -176,9 +176,9 @@ public void setKey(boolean key) { * @return */ public String getReadMethod() { - if ( getterName != null ) { - return getterName; - } + if ( getterName != null ) { + return getterName; + } String prefix; if ( "boolean".equals( this.type.getRawType() ) ) { prefix = "is"; @@ -196,7 +196,7 @@ public String getReadMethod() { */ public String getWriteMethod() { return setterName != null ? setterName : - "set" + this.name.substring( 0, 1 ).toUpperCase() + this.name.substring( 1 ); + "set" + this.name.substring( 0, 1 ).toUpperCase() + this.name.substring( 1 ); } /** @@ -534,19 +534,19 @@ public void setOverriding( String overriding ) { this.overriding = overriding; } - public String getGetterName() { - return getterName; - } + public String getGetterName() { + return getterName; + } - public void setGetterName( String getterName ) { - this.getterName = getterName; - } + public void setGetterName( String getterName ) { + this.getterName = getterName; + } - public String getSetterName() { - return setterName; - } + public String getSetterName() { + return setterName; + } - public void setSetterName( String setterName ) { - this.setterName = setterName; - } + public void setSetterName( String setterName ) { + this.setterName = setterName; + } } diff --git a/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java b/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java index 7b5f62e41fc..6a475ed2728 100644 --- a/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java +++ b/drools-base/src/main/java/org/drools/base/factmodel/traits/TraitFieldTMS.java @@ -18,10 +18,10 @@ */ package org.drools.base.factmodel.traits; -import org.drools.util.bitmask.BitMask; - import java.io.Externalizable; +import org.drools.util.bitmask.BitMask; + public interface TraitFieldTMS extends Externalizable { // Most of the code generation for traits is still in drools-core DefaultBeanClassBuilder so this module needs to know the name of the impl class for traits diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java index a50ff6a0de7..b081e5817ab 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactImpl.java @@ -72,8 +72,12 @@ public Map asMap() { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } FactImpl fact = (FactImpl) o; return factTemplate.equals(fact.factTemplate) && values.equals(fact.values); } diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java index 09aa3afe529..bbf498076d0 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateFieldExtractor.java @@ -25,8 +25,8 @@ import java.lang.reflect.Method; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.accessor.ReadAccessor; import org.drools.base.base.ValueType; +import org.drools.base.rule.accessor.ReadAccessor; import org.drools.util.ClassUtils; public class FactTemplateFieldExtractor @@ -176,13 +176,21 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } FactTemplateFieldExtractor other = (FactTemplateFieldExtractor) obj; if ( factTemplate == null ) { - if ( other.factTemplate != null ) return false; + if ( other.factTemplate != null ) { + return false; + } } else if ( !factTemplate.equals( other.factTemplate ) ) { return false; } diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java index 9172fd90987..07622df7cfd 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateImpl.java @@ -133,8 +133,12 @@ public String toString() { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } FactTemplateImpl that = (FactTemplateImpl) o; return pkg.getName().equals(that.pkg.getName()) && name.equals(that.name) && fields.equals(that.fields); } diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java index 3c8c94453e2..1ba86748546 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FactTemplateObjectType.java @@ -23,8 +23,8 @@ import java.io.ObjectOutput; import java.util.Collection; -import org.drools.base.base.ValueType; import org.drools.base.base.ObjectType; +import org.drools.base.base.ValueType; public class FactTemplateObjectType implements diff --git a/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java b/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java index 9a2e63b84d1..e0de97e9bf8 100644 --- a/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java +++ b/drools-base/src/main/java/org/drools/base/facttemplates/FieldTemplateImpl.java @@ -44,8 +44,9 @@ public FieldTemplateImpl(String name, Class clazz) { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { name = (String)in.readObject(); valueType = (ValueType)in.readObject(); - if (valueType != null) + if (valueType != null) { valueType = ValueType.determineValueType(valueType.getClassType()); + } } public void writeExternal(ObjectOutput out) throws IOException { diff --git a/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java b/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java index 3b30d2fb64c..c583868b1e4 100644 --- a/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java +++ b/drools-base/src/main/java/org/drools/base/phreak/ReactiveObject.java @@ -18,10 +18,10 @@ */ package org.drools.base.phreak; -import org.drools.base.reteoo.BaseTuple; - import java.util.Collection; +import org.drools.base.reteoo.BaseTuple; + public interface ReactiveObject { void addTuple(BaseTuple tuple); void removeTuple(BaseTuple tuple); diff --git a/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java b/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java index f10e75f509c..aa634c35c85 100644 --- a/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java +++ b/drools-base/src/main/java/org/drools/base/reteoo/PropertySpecificUtil.java @@ -22,17 +22,17 @@ import java.util.Collection; import java.util.List; -import org.drools.base.rule.TypeDeclaration; +import org.drools.base.RuleBase; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; import org.drools.base.factmodel.traits.TraitConstants; import org.drools.base.facttemplates.FactTemplateObjectType; -import org.drools.base.base.ObjectType; +import org.drools.base.rule.TypeDeclaration; import org.drools.util.bitmask.AllSetBitMask; import org.drools.util.bitmask.AllSetButLastBitMask; import org.drools.util.bitmask.BitMask; import org.drools.util.bitmask.EmptyBitMask; import org.drools.util.bitmask.EmptyButLastBitMask; -import org.drools.base.RuleBase; public class PropertySpecificUtil { diff --git a/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java b/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java index 2df32bacdac..f1a2d4d84c3 100644 --- a/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java +++ b/drools-base/src/main/java/org/drools/base/reteoo/SortDeclarations.java @@ -18,10 +18,10 @@ */ package org.drools.base.reteoo; -import org.drools.base.rule.Declaration; - import java.util.Comparator; +import org.drools.base.rule.Declaration; + public class SortDeclarations implements Comparator { diff --git a/drools-base/src/main/java/org/drools/base/rule/Collect.java b/drools-base/src/main/java/org/drools/base/rule/Collect.java index 6e665063191..aec86cc46ee 100755 --- a/drools-base/src/main/java/org/drools/base/rule/Collect.java +++ b/drools-base/src/main/java/org/drools/base/rule/Collect.java @@ -18,9 +18,6 @@ */ package org.drools.base.rule; -import org.drools.base.base.ValueResolver; -import org.drools.base.base.ClassObjectType; - import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; @@ -33,6 +30,9 @@ import java.util.Objects; import java.util.Set; +import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ValueResolver; + public class Collect extends ConditionalElement implements PatternSource { diff --git a/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java b/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java index a7b19154e92..1da1773d8d8 100644 --- a/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java +++ b/drools-base/src/main/java/org/drools/base/rule/ConditionalBranch.java @@ -112,9 +112,15 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final ConditionalBranch other = (ConditionalBranch) obj; return condition.equals( other.condition ) && consequence.equals( other.consequence ); } diff --git a/drools-base/src/main/java/org/drools/base/rule/Declaration.java b/drools-base/src/main/java/org/drools/base/rule/Declaration.java index d9f995c648f..12dfa34ba74 100644 --- a/drools-base/src/main/java/org/drools/base/rule/Declaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/Declaration.java @@ -18,21 +18,20 @@ */ package org.drools.base.rule; -import org.drools.base.base.AccessorKeySupplier; -import org.drools.base.base.ValueType; -import org.drools.base.common.DroolsObjectInputStream; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.accessor.AcceptsReadAccessor; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.rule.accessor.TupleValueExtractor; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.lang.reflect.Method; +import org.drools.base.base.AccessorKeySupplier; import org.drools.base.base.ValueResolver; +import org.drools.base.base.ValueType; +import org.drools.base.common.DroolsObjectInputStream; +import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.accessor.AcceptsReadAccessor; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.rule.accessor.TupleValueExtractor; import org.kie.api.runtime.rule.FactHandle; import static org.drools.util.ClassUtils.canonicalName; diff --git a/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java b/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java index a1f913fb41b..641f9fe8aed 100644 --- a/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java +++ b/drools-base/src/main/java/org/drools/base/rule/EntryPointId.java @@ -127,13 +127,23 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final EntryPointId other = (EntryPointId) obj; if ( entryPointId == null ) { - if ( other.entryPointId != null ) return false; - } else if ( !entryPointId.equals( other.entryPointId ) ) return false; + if ( other.entryPointId != null ) { + return false; + } + } else if ( !entryPointId.equals( other.entryPointId ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java b/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java index 3072e52c924..aca624bb86b 100644 --- a/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java +++ b/drools-base/src/main/java/org/drools/base/rule/EvalCondition.java @@ -28,10 +28,10 @@ import java.util.Map; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.accessor.CompiledInvoker; -import org.drools.base.rule.accessor.Wireable; import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.accessor.CompiledInvoker; import org.drools.base.rule.accessor.EvalExpression; +import org.drools.base.rule.accessor.Wireable; public class EvalCondition extends ConditionalElement implements diff --git a/drools-base/src/main/java/org/drools/base/rule/From.java b/drools-base/src/main/java/org/drools/base/rule/From.java index 5f261982025..37e6371d5c9 100644 --- a/drools-base/src/main/java/org/drools/base/rule/From.java +++ b/drools-base/src/main/java/org/drools/base/rule/From.java @@ -26,10 +26,10 @@ import java.util.List; import java.util.Map; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.base.rule.accessor.Wireable; import org.drools.base.base.ClassObjectType; import org.drools.base.facttemplates.Fact; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.accessor.Wireable; public class From extends ConditionalElement implements diff --git a/drools-base/src/main/java/org/drools/base/rule/Function.java b/drools-base/src/main/java/org/drools/base/rule/Function.java index ca014a3f82a..4858d4746aa 100644 --- a/drools-base/src/main/java/org/drools/base/rule/Function.java +++ b/drools-base/src/main/java/org/drools/base/rule/Function.java @@ -23,8 +23,8 @@ import java.io.ObjectInput; import java.io.ObjectOutput; -import org.kie.internal.definition.KnowledgeDefinition; import org.kie.api.io.Resource; +import org.kie.internal.definition.KnowledgeDefinition; public class Function implements KnowledgeDefinition, Dialectable, Externalizable { private String name; diff --git a/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java b/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java index e8d34ab1388..ae544283c26 100644 --- a/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/ImportDeclaration.java @@ -72,13 +72,23 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final ImportDeclaration other = (ImportDeclaration) obj; if ( target == null ) { - if ( other.target != null ) return false; - } else if ( !target.equals( other.target ) ) return false; + if ( other.target != null ) { + return false; + } + } else if ( !target.equals( other.target ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java b/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java index 1e6e01fb1fa..86607a8ca30 100644 --- a/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java +++ b/drools-base/src/main/java/org/drools/base/rule/LogicTransformer.java @@ -27,11 +27,11 @@ import java.util.Map; import java.util.Map.Entry; -import org.drools.base.rule.accessor.DataProvider; -import org.drools.base.rule.accessor.DeclarationScopeResolver; import org.drools.base.base.ClassObjectType; import org.drools.base.base.extractors.ArrayElementReader; import org.drools.base.base.extractors.SelfReferenceClassFieldReader; +import org.drools.base.rule.accessor.DataProvider; +import org.drools.base.rule.accessor.DeclarationScopeResolver; import org.drools.base.rule.constraint.Constraint; /** diff --git a/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java b/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java index 6e47441c85d..b750dabf545 100644 --- a/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java +++ b/drools-base/src/main/java/org/drools/base/rule/MultiAccumulate.java @@ -25,11 +25,11 @@ import java.util.Arrays; import org.drools.base.base.ValueResolver; +import org.drools.base.reteoo.AccumulateContextEntry; +import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.accessor.Accumulator; import org.drools.base.rule.accessor.CompiledInvoker; import org.drools.base.rule.accessor.Wireable; -import org.drools.base.reteoo.AccumulateContextEntry; -import org.drools.base.reteoo.BaseTuple; import org.kie.api.runtime.rule.FactHandle; public class MultiAccumulate extends Accumulate { @@ -239,12 +239,22 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } MultiAccumulate other = (MultiAccumulate) obj; - if ( !Arrays.equals( accumulators, other.accumulators ) ) return false; - if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) return false; + if ( !Arrays.equals( accumulators, other.accumulators ) ) { + return false; + } + if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) { + return false; + } if ( source == null ) { return other.source == null; } else { diff --git a/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java b/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java index f07becdf525..21cdde73c0b 100644 --- a/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java +++ b/drools-base/src/main/java/org/drools/base/rule/NamedConsequence.java @@ -137,13 +137,23 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final NamedConsequence other = (NamedConsequence) obj; if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } return breaking == other.breaking; } diff --git a/drools-base/src/main/java/org/drools/base/rule/Pattern.java b/drools-base/src/main/java/org/drools/base/rule/Pattern.java index 6c7fc648968..4425cc29ba9 100644 --- a/drools-base/src/main/java/org/drools/base/rule/Pattern.java +++ b/drools-base/src/main/java/org/drools/base/rule/Pattern.java @@ -18,16 +18,6 @@ */ package org.drools.base.rule; -import org.drools.base.rule.accessor.PatternExtractor; -import org.drools.base.rule.constraint.Constraint; -import org.drools.base.base.AcceptsClassObjectType; -import org.drools.base.base.ClassObjectType; -import org.drools.base.base.ObjectType; -import org.drools.base.factmodel.AnnotationDefinition; -import org.drools.base.reteoo.PropertySpecificUtil; -import org.drools.base.rule.constraint.XpathConstraint; -import org.drools.util.bitmask.BitMask; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; @@ -41,8 +31,19 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import org.drools.wiring.api.util.ClassUtils; + import org.drools.base.RuleBase; +import org.drools.base.base.AcceptsClassObjectType; +import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; +import org.drools.base.factmodel.AnnotationDefinition; +import org.drools.base.reteoo.PropertySpecificUtil; +import org.drools.base.rule.accessor.PatternExtractor; +import org.drools.base.rule.constraint.Constraint; +import org.drools.base.rule.constraint.XpathConstraint; +import org.drools.util.bitmask.BitMask; +import org.drools.wiring.api.util.ClassUtils; + import static org.kie.internal.ruleunit.RuleUnitUtil.isDataSource; public class Pattern implements RuleConditionElement, AcceptsClassObjectType, Externalizable { diff --git a/drools-base/src/main/java/org/drools/base/rule/QueryElement.java b/drools-base/src/main/java/org/drools/base/rule/QueryElement.java index ad5ad3b5e80..064df253600 100644 --- a/drools-base/src/main/java/org/drools/base/rule/QueryElement.java +++ b/drools-base/src/main/java/org/drools/base/rule/QueryElement.java @@ -165,22 +165,44 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } QueryElement other = (QueryElement) obj; if ( !Arrays.equals( arguments, - other.arguments ) ) return false; - if ( openQuery != other.openQuery ) return false; - if ( abductive != other.abductive ) return false; + other.arguments ) ) { + return false; + } + if ( openQuery != other.openQuery ) { + return false; + } + if ( abductive != other.abductive ) { + return false; + } if ( queryName == null ) { - if ( other.queryName != null ) return false; - } else if ( !queryName.equals( other.queryName ) ) return false; + if ( other.queryName != null ) { + return false; + } + } else if ( !queryName.equals( other.queryName ) ) { + return false; + } if ( !Arrays.equals( requiredDeclarations, - other.requiredDeclarations ) ) return false; + other.requiredDeclarations ) ) { + return false; + } if ( resultPattern == null ) { - if ( other.resultPattern != null ) return false; - } else if ( !resultPattern.equals( other.resultPattern ) ) return false; + if ( other.resultPattern != null ) { + return false; + } + } else if ( !resultPattern.equals( other.resultPattern ) ) { + return false; + } return true; } } diff --git a/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java b/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java index 248d53f2450..26c67aee8c9 100644 --- a/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java +++ b/drools-base/src/main/java/org/drools/base/rule/SingleAccumulate.java @@ -186,13 +186,25 @@ public int hashCode() { } public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } SingleAccumulate other = (SingleAccumulate) obj; - if ( !accumulator.equals( other.accumulator ) ) return false; - if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) return false; - if ( !Arrays.equals( innerDeclarationCache, other.innerDeclarationCache ) ) return false; + if ( !accumulator.equals( other.accumulator ) ) { + return false; + } + if ( !Arrays.equals( requiredDeclarations, other.requiredDeclarations ) ) { + return false; + } + if ( !Arrays.equals( innerDeclarationCache, other.innerDeclarationCache ) ) { + return false; + } if ( source == null ) { return other.source == null; } else { diff --git a/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java b/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java index 9eb169bb758..78b014161c1 100644 --- a/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/TypeDeclaration.java @@ -26,12 +26,12 @@ import java.util.List; import org.drools.base.base.ClassObjectType; +import org.drools.base.base.ObjectType; import org.drools.base.factmodel.ClassDefinition; import org.drools.base.factmodel.GeneratedFact; import org.drools.base.facttemplates.FactTemplate; import org.drools.base.facttemplates.FactTemplateObjectType; import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.base.ObjectType; import org.drools.base.util.PropertyReactivityUtil; import org.drools.base.util.TimeIntervalParser; import org.drools.util.ClassUtils; @@ -381,13 +381,23 @@ public int hashCode() { */ @Override public boolean equals( Object obj ) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } TypeDeclaration other = (TypeDeclaration) obj; if ( typeName == null ) { - if ( other.typeName != null ) return false; - } else if ( !typeName.equals( other.typeName ) ) return false; + if ( other.typeName != null ) { + return false; + } + } else if ( !typeName.equals( other.typeName ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java b/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java index 7b6fe7fdf82..f73e8ef5067 100644 --- a/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java +++ b/drools-base/src/main/java/org/drools/base/rule/TypeMetaInfo.java @@ -18,10 +18,10 @@ */ package org.drools.base.rule; -import org.kie.api.definition.type.Role; - import java.io.Serializable; +import org.kie.api.definition.type.Role; + public class TypeMetaInfo implements Serializable{ private TypeDeclaration.Kind kind; private Role.Type role; diff --git a/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java b/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java index 656e5d0846e..b132a42cddc 100644 --- a/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java +++ b/drools-base/src/main/java/org/drools/base/rule/WindowDeclaration.java @@ -85,23 +85,30 @@ public int hashCode() { @Override public boolean equals( Object obj ) { - if (this == obj) + if (this == obj) { return true; - if (!super.equals( obj )) + } + if (!super.equals( obj )) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } WindowDeclaration other = (WindowDeclaration) obj; if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals( other.name )) + if (other.name != null) { return false; + } + } else if (!name.equals( other.name )) { + return false; + } if (pattern == null) { - if (other.pattern != null) - return false; - } else if (!pattern.equals( other.pattern )) + if (other.pattern != null) { + return false; + } + } else if (!pattern.equals( other.pattern )) { return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/WindowReference.java b/drools-base/src/main/java/org/drools/base/rule/WindowReference.java index f73ed21e7dd..adf63bc85af 100644 --- a/drools-base/src/main/java/org/drools/base/rule/WindowReference.java +++ b/drools-base/src/main/java/org/drools/base/rule/WindowReference.java @@ -115,13 +115,23 @@ public int hashCode() { */ @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } final WindowReference other = (WindowReference) obj; if ( name == null ) { - if ( other.name != null ) return false; - } else if ( !name.equals( other.name ) ) return false; + if ( other.name != null ) { + return false; + } + } else if ( !name.equals( other.name ) ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java b/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java index cdc60f456b5..95f1ecc457b 100644 --- a/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java +++ b/drools-base/src/main/java/org/drools/base/rule/XpathBackReference.java @@ -25,8 +25,8 @@ import java.util.Map; import java.util.Set; -import org.drools.base.rule.accessor.PatternExtractor; import org.drools.base.base.ClassObjectType; +import org.drools.base.rule.accessor.PatternExtractor; public class XpathBackReference { public static final String BACK_REFERENCE_HEAD = "$back$ref$"; diff --git a/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java b/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java index 81a692e782c..58005d255bb 100755 --- a/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java +++ b/drools-base/src/main/java/org/drools/base/rule/accessor/GlobalExtractor.java @@ -18,6 +18,12 @@ */ package org.drools.base.rule.accessor; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Method; + import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; @@ -26,12 +32,6 @@ import org.drools.base.facttemplates.Fact; import org.drools.util.ClassUtils; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Method; - /** * This is a global variable extractor used to get a global variable value */ diff --git a/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java b/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java index a7b3d64cb70..e6f07b3a614 100644 --- a/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java +++ b/drools-base/src/main/java/org/drools/base/rule/accessor/PatternExtractor.java @@ -24,10 +24,10 @@ import java.io.ObjectOutput; import java.lang.reflect.Method; -import org.drools.base.base.ValueResolver; import org.drools.base.base.AcceptsClassObjectType; import org.drools.base.base.ClassObjectType; import org.drools.base.base.ObjectType; +import org.drools.base.base.ValueResolver; import org.drools.base.base.extractors.BaseObjectClassFieldReader; import org.drools.base.facttemplates.Fact; import org.drools.util.ClassUtils; diff --git a/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java b/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java index b5e42660f00..3576a06dd60 100644 --- a/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java +++ b/drools-base/src/main/java/org/drools/base/rule/accessor/ReadAccessor.java @@ -18,11 +18,11 @@ */ package org.drools.base.rule.accessor; +import java.lang.reflect.Method; + import org.drools.base.base.ValueResolver; import org.drools.base.base.ValueType; -import java.lang.reflect.Method; - /** * A public interface for Read accessors */ diff --git a/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java b/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java index 90e0cb7234d..8d830c39bcb 100644 --- a/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java +++ b/drools-base/src/main/java/org/drools/base/rule/consequence/ConsequenceContext.java @@ -18,6 +18,9 @@ */ package org.drools.base.rule.consequence; +import java.util.Collection; +import java.util.Map; + import org.drools.base.beliefsystem.Mode; import org.drools.base.factmodel.traits.Thing; import org.drools.base.factmodel.traits.TraitableBean; @@ -31,9 +34,6 @@ import org.kie.api.runtime.rule.Match; import org.kie.api.runtime.rule.RuleContext; -import java.util.Collection; -import java.util.Map; - public interface ConsequenceContext extends RuleContext { void reset(); diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java index 55ba7e3c26c..103da6ae55e 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/BetaNodeFieldConstraint.java @@ -18,8 +18,8 @@ */ package org.drools.base.rule.constraint; -import org.drools.base.rule.ContextEntry; import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.ContextEntry; import org.kie.api.runtime.rule.FactHandle; public interface BetaNodeFieldConstraint diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java index 8665c314fcc..55975e16d52 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/Constraint.java @@ -24,14 +24,14 @@ import java.util.List; import java.util.Optional; +import org.drools.base.RuleBase; +import org.drools.base.RuleBuildContext; +import org.drools.base.base.ObjectType; +import org.drools.base.rule.Declaration; import org.drools.base.rule.Pattern; import org.drools.base.rule.RuleComponent; -import org.drools.base.rule.Declaration; -import org.drools.base.base.ObjectType; import org.drools.util.bitmask.AllSetButLastBitMask; import org.drools.util.bitmask.BitMask; -import org.drools.base.RuleBase; -import org.drools.base.RuleBuildContext; //import static org.drools.core.reteoo.PropertySpecificUtil.allSetButTraitBitMask; diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java index 577b48f3e46..0d48a352387 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/QueryNameConstraint.java @@ -25,14 +25,14 @@ import org.drools.base.base.DroolsQuery; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.accessor.FieldValue; -import org.drools.base.util.index.ConstraintTypeOperator; import org.drools.base.base.field.ObjectFieldImpl; import org.drools.base.rule.Declaration; import org.drools.base.rule.IndexableConstraint; import org.drools.base.rule.accessor.AcceptsReadAccessor; +import org.drools.base.rule.accessor.FieldValue; import org.drools.base.rule.accessor.ReadAccessor; import org.drools.base.util.FieldIndex; +import org.drools.base.util.index.ConstraintTypeOperator; import org.kie.api.KieBaseConfiguration; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java b/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java index 6f15fb1e0d8..585658ccedf 100644 --- a/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java +++ b/drools-base/src/main/java/org/drools/base/rule/constraint/XpathConstraint.java @@ -33,20 +33,20 @@ import java.util.List; import java.util.Objects; +import org.drools.base.base.AcceptsClassObjectType; +import org.drools.base.base.ClassObjectType; import org.drools.base.base.DroolsQuery; +import org.drools.base.base.ObjectType; import org.drools.base.base.ValueResolver; +import org.drools.base.phreak.ReactiveObject; +import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.ContextEntry; +import org.drools.base.rule.Declaration; import org.drools.base.rule.From; +import org.drools.base.rule.MutableTypeConstraint; import org.drools.base.rule.accessor.DataProvider; import org.drools.base.rule.accessor.PatternExtractor; import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.base.ClassObjectType; -import org.drools.base.phreak.ReactiveObject; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.Declaration; -import org.drools.base.rule.MutableTypeConstraint; -import org.drools.base.base.AcceptsClassObjectType; -import org.drools.base.base.ObjectType; import org.drools.util.ClassUtils; import org.kie.api.runtime.rule.FactHandle; diff --git a/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java b/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java index 2ccc28e846f..ab55b525f41 100644 --- a/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java +++ b/drools-base/src/main/java/org/drools/base/ruleunit/RuleUnitDescriptionLoader.java @@ -24,8 +24,8 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.drools.base.definitions.rule.impl.RuleImpl; import org.drools.base.definitions.InternalKnowledgePackage; +import org.drools.base.definitions.rule.impl.RuleImpl; import org.kie.internal.ruleunit.RuleUnitComponentFactory; import org.kie.internal.ruleunit.RuleUnitDescription; diff --git a/drools-base/src/main/java/org/drools/base/time/Interval.java b/drools-base/src/main/java/org/drools/base/time/Interval.java index 61b62f28441..85a8db207fa 100644 --- a/drools-base/src/main/java/org/drools/base/time/Interval.java +++ b/drools-base/src/main/java/org/drools/base/time/Interval.java @@ -113,12 +113,22 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if ( this == obj ) return true; - if ( obj == null ) return false; - if ( getClass() != obj.getClass() ) return false; + if ( this == obj ) { + return true; + } + if ( obj == null ) { + return false; + } + if ( getClass() != obj.getClass() ) { + return false; + } Interval other = (Interval) obj; - if ( lowerBound != other.lowerBound ) return false; - if ( upperBound != other.upperBound ) return false; + if ( lowerBound != other.lowerBound ) { + return false; + } + if ( upperBound != other.upperBound ) { + return false; + } return true; } diff --git a/drools-base/src/main/java/org/drools/base/time/impl/Timer.java b/drools-base/src/main/java/org/drools/base/time/impl/Timer.java index 13bf753bd37..429dade8776 100644 --- a/drools-base/src/main/java/org/drools/base/time/impl/Timer.java +++ b/drools-base/src/main/java/org/drools/base/time/impl/Timer.java @@ -21,9 +21,9 @@ import java.io.Serializable; import org.drools.base.base.ValueResolver; -import org.drools.base.rule.RuleComponent; import org.drools.base.reteoo.BaseTuple; import org.drools.base.rule.Declaration; +import org.drools.base.rule.RuleComponent; import org.drools.base.rule.RuleConditionElement; import org.drools.base.time.JobHandle; import org.drools.base.time.Trigger; diff --git a/drools-base/src/main/java/org/drools/base/util/FieldIndex.java b/drools-base/src/main/java/org/drools/base/util/FieldIndex.java index 4b9cfedf3d4..011eb240ee8 100644 --- a/drools-base/src/main/java/org/drools/base/util/FieldIndex.java +++ b/drools-base/src/main/java/org/drools/base/util/FieldIndex.java @@ -18,16 +18,16 @@ */ package org.drools.base.util; -import org.drools.base.reteoo.BaseTuple; -import org.drools.base.rule.accessor.ReadAccessor; -import org.drools.base.rule.accessor.TupleValueExtractor; -import org.drools.base.rule.Declaration; - import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import org.drools.base.reteoo.BaseTuple; +import org.drools.base.rule.Declaration; +import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.rule.accessor.TupleValueExtractor; + public class FieldIndex implements Externalizable { private static final long serialVersionUID = 510l; diff --git a/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java b/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java index eb09a4ce81b..a867f9f7693 100644 --- a/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java +++ b/drools-base/src/main/java/org/drools/base/util/index/IndexUtil.java @@ -18,11 +18,11 @@ */ package org.drools.base.util.index; -import org.drools.base.rule.accessor.TupleValueExtractor; import org.drools.base.base.ValueType; import org.drools.base.reteoo.NodeTypeEnums; import org.drools.base.rule.IndexableConstraint; import org.drools.base.rule.accessor.ReadAccessor; +import org.drools.base.rule.accessor.TupleValueExtractor; import org.drools.base.rule.constraint.BetaNodeFieldConstraint; import org.kie.api.KieBaseConfiguration; import org.kie.api.conf.BetaRangeIndexOption;