diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTable.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTable.java index 03f7499..ca622d4 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTable.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTable.java @@ -47,6 +47,6 @@ public interface CategoryTable { - void create(); + public abstract void create(); } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTableImpl.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTableImpl.java index d13c267..63f908a 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTableImpl.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/CategoryTableImpl.java @@ -138,12 +138,15 @@ public void create() { */ @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null) + } + if (object == null) { return false; - if (object.getClass() != this.getClass()) + } + if (object.getClass() != this.getClass()) { return false; + } final CategoryTableImpl cast = (CategoryTableImpl) object; return this.originTable.equals(cast.originTable) && this.ctx == cast.ctx && // equal only if same instance of DSLContext this.bloomTermId == cast.bloomTermId && this.tableFilters.equals(cast.tableFilters); diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/ConditionMatchBloomDBTables.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/ConditionMatchBloomDBTables.java index 3f32b31..16ddb7e 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/ConditionMatchBloomDBTables.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/ConditionMatchBloomDBTables.java @@ -111,12 +111,15 @@ public List> tables() { */ @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null) + } + if (object == null) { return false; - if (object.getClass() != this.getClass()) + } + if (object.getClass() != this.getClass()) { return false; + } final ConditionMatchBloomDBTables cast = (ConditionMatchBloomDBTables) object; return this.condition.equals(cast.condition) && this.ctx == cast.ctx; } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/DatabaseTables.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/DatabaseTables.java index 2a4869f..f051167 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/DatabaseTables.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/DatabaseTables.java @@ -51,5 +51,5 @@ public interface DatabaseTables { - List> tables(); + public abstract List> tables(); } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/RegexExtractedValue.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/RegexExtractedValue.java index a723a0d..a3fe4b0 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/RegexExtractedValue.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/RegexExtractedValue.java @@ -75,10 +75,12 @@ public List tokens() { @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || getClass() != object.getClass()) + } + if (object == null || getClass() != object.getClass()) { return false; + } final RegexExtractedValue cast = (RegexExtractedValue) object; return value.equals(cast.value) && pattern.equals(cast.pattern); } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/SearchTermBloomFilter.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/SearchTermBloomFilter.java index a30dc70..c67bbd0 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/SearchTermBloomFilter.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/SearchTermBloomFilter.java @@ -99,10 +99,12 @@ public byte[] bytes() { @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || getClass() != object.getClass()) + } + if (object == null || getClass() != object.getClass()) { return false; + } final SearchTermBloomFilter cast = (SearchTermBloomFilter) object; return expected.equals(cast.expected) && fpp.equals(cast.fpp) && stringTokens.equals(cast.stringTokens); } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilterTypesFromMetadata.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilterTypesFromMetadata.java index a5efa74..4a3111a 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilterTypesFromMetadata.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilterTypesFromMetadata.java @@ -120,10 +120,12 @@ public Result toResult() { */ @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || getClass() != object.getClass()) + } + if (object == null || getClass() != object.getClass()) { return false; + } final TableFilterTypesFromMetadata cast = (TableFilterTypesFromMetadata) object; return ctx == cast.ctx && Objects.equals(table, cast.table) && Objects .equals(expectedField, cast.expectedField) && Objects.equals(fppField, cast.fppField) && Objects diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilters.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilters.java index 5418442..2f4c52d 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilters.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableFilters.java @@ -139,10 +139,12 @@ public Batch asBatch() { */ @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || getClass() != object.getClass()) + } + if (object == null || getClass() != object.getClass()) { return false; + } final TableFilters cast = (TableFilters) object; return bloomTermId == cast.bloomTermId && recordsInMetadata.equals(cast.recordsInMetadata) && ctx == cast.ctx && table.equals(cast.table) && thisTable.equals(cast.thisTable) && searchTerm.equals(cast.searchTerm); diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableRecords.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableRecords.java index 932070f..91b870d 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableRecords.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TableRecords.java @@ -50,5 +50,5 @@ public interface TableRecords { - Result toResult(); + public abstract Result toResult(); } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/Tokenizable.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/Tokenizable.java index e209f53..c40ce44 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/Tokenizable.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/Tokenizable.java @@ -49,5 +49,5 @@ public interface Tokenizable { - List tokens(); + public abstract List tokens(); } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokenizedValue.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokenizedValue.java index fe32e62..6a07b95 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokenizedValue.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokenizedValue.java @@ -67,10 +67,12 @@ public List tokens() { @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || object.getClass() != this.getClass()) + } + if (object == null || object.getClass() != this.getClass()) { return false; + } final TokenizedValue cast = (TokenizedValue) object; return value.equals(cast.value); } diff --git a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokensAsStrings.java b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokensAsStrings.java index b0c9dce..fa2d998 100644 --- a/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokensAsStrings.java +++ b/src/main/java/com/teragrep/pth_06/planner/bloomfilter/TokensAsStrings.java @@ -66,10 +66,12 @@ public List tokens() { @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || object.getClass() != this.getClass()) + } + if (object == null || object.getClass() != this.getClass()) { return false; + } final TokensAsStrings cast = (TokensAsStrings) object; return origin.equals(cast.origin); } diff --git a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/BloomQueryCondition.java b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/BloomQueryCondition.java index a3a0a36..42d11fc 100644 --- a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/BloomQueryCondition.java +++ b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/BloomQueryCondition.java @@ -51,7 +51,7 @@ public interface BloomQueryCondition { - boolean isBloomSearchCondition(); + public abstract boolean isBloomSearchCondition(); - Set> requiredTables(); + public abstract Set> requiredTables(); } diff --git a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/CategoryTableCondition.java b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/CategoryTableCondition.java index f3e10e6..ae5ed24 100644 --- a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/CategoryTableCondition.java +++ b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/CategoryTableCondition.java @@ -102,10 +102,12 @@ public Condition condition() { @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || getClass() != object.getClass()) + } + if (object == null || getClass() != object.getClass()) { return false; + } final CategoryTableCondition cast = (CategoryTableCondition) object; return comparedTo.equals(cast.comparedTo) && bloomTermCondition.equals(cast.bloomTermCondition) && typeIdCondition.equals(cast.typeIdCondition) && categoryTable.equals(cast.categoryTable); diff --git a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/RegexLikeCondition.java b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/RegexLikeCondition.java index 9026227..346c071 100644 --- a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/RegexLikeCondition.java +++ b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/RegexLikeCondition.java @@ -89,10 +89,12 @@ public Condition condition() { @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null || object.getClass() != this.getClass()) + } + if (object == null || object.getClass() != this.getClass()) { return false; + } final RegexLikeCondition cast = (RegexLikeCondition) object; return valueField.equals(cast.valueField) && comparedToField.equals(cast.comparedToField); } diff --git a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/ValidElement.java b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/ValidElement.java index 0ea4482..4945614 100644 --- a/src/main/java/com/teragrep/pth_06/planner/walker/conditions/ValidElement.java +++ b/src/main/java/com/teragrep/pth_06/planner/walker/conditions/ValidElement.java @@ -47,6 +47,8 @@ import org.w3c.dom.Element; +import java.util.Objects; + public final class ValidElement { private final Element element; @@ -88,16 +90,24 @@ public String operation() { @Override public boolean equals(final Object object) { - if (this == object) + if (this == object) { return true; - if (object == null) + } + if (object == null) { return false; - if (object.getClass() != this.getClass()) + } + if (object.getClass() != this.getClass()) { return false; + } final ValidElement cast = (ValidElement) object; boolean equalName = this.element.getTagName().equals(cast.element.getTagName()); boolean equalOperation = this.element.getAttribute("operation").equals(cast.element.getAttribute("operation")); boolean equalValue = this.element.getAttribute("value").equals(cast.element.getAttribute("value")); return equalName && equalOperation && equalValue; } + + @Override + public int hashCode() { + return Objects.hash(element.getTagName(), element.getAttribute("operation"), element.getAttribute("value")); + } }