From b5dc089676903b8ae3e4735034c6799d4755aab2 Mon Sep 17 00:00:00 2001 From: Luigi Dell'Aquila Date: Thu, 28 Jul 2016 14:32:19 +0200 Subject: [PATCH] Implement equals() and hashCode() for SQL query tree --- .../sql/executor/OSelectExecutionPlanner.java | 31 +++++--- .../core/sql/parser/OAlterClassStatement.java | 52 ++++++++++++ .../sql/parser/OAlterClusterStatement.java | 28 +++++++ .../sql/parser/OAlterDatabaseStatement.java | 28 +++++++ .../sql/parser/OAlterPropertyStatement.java | 34 ++++++++ .../sql/parser/OAlterSequenceStatement.java | 28 +++++++ .../orient/core/sql/parser/OAndBlock.java | 18 +++++ .../core/sql/parser/OArrayNumberSelector.java | 28 +++++++ .../core/sql/parser/OArrayRangeSelector.java | 31 ++++++++ .../core/sql/parser/OArraySelector.java | 28 +++++++ .../parser/OArraySingleValuesSelector.java | 18 +++++ .../core/sql/parser/OBaseExpression.java | 30 +++++++ .../core/sql/parser/OBaseIdentifier.java | 22 ++++++ .../orient/core/sql/parser/OBatch.java | 22 ++++++ .../core/sql/parser/OBeginStatement.java | 18 +++++ .../core/sql/parser/OBetweenCondition.java | 24 ++++++ .../core/sql/parser/OBinaryCondition.java | 25 ++++++ .../orient/core/sql/parser/OBothPathItem.java | 1 + .../orient/core/sql/parser/OCluster.java | 22 ++++++ .../orient/core/sql/parser/OClusterList.java | 18 +++++ .../orient/core/sql/parser/OCollection.java | 18 +++++ .../core/sql/parser/OCommandLineOption.java | 18 +++++ .../core/sql/parser/OCommitStatement.java | 18 +++++ .../core/sql/parser/OConsoleStatement.java | 22 ++++++ .../sql/parser/OContainsAllCondition.java | 25 ++++++ .../core/sql/parser/OContainsCondition.java | 24 ++++++ .../core/sql/parser/OContainsKeyOperator.java | 18 +++-- .../sql/parser/OContainsTextCondition.java | 22 ++++++ .../sql/parser/OContainsValueCondition.java | 28 +++++++ .../sql/parser/OContainsValueOperator.java | 7 ++ .../sql/parser/OCreateClassStatement.java | 31 ++++++++ .../sql/parser/OCreateClusterStatement.java | 25 ++++++ .../core/sql/parser/OCreateEdgeStatement.java | 47 ++++++++++- .../sql/parser/OCreateFunctionStatement.java | 34 ++++++++ .../sql/parser/OCreateIndexStatement.java | 71 +++++++++++++++++ .../core/sql/parser/OCreateLinkStatement.java | 43 ++++++++++ .../OCreatePropertyAttributeStatement.java | 22 ++++++ .../sql/parser/OCreatePropertyStatement.java | 34 ++++++++ .../sql/parser/OCreateSequenceStatement.java | 31 ++++++++ .../sql/parser/OCreateVertexStatement.java | 38 ++++++++- .../core/sql/parser/ODeleteEdgeStatement.java | 74 ++++++++++++++++- .../core/sql/parser/ODeleteStatement.java | 31 ++++++++ .../sql/parser/ODeleteVertexStatement.java | 34 ++++++++ .../core/sql/parser/ODropClassStatement.java | 22 ++++++ .../sql/parser/ODropClusterStatement.java | 22 ++++++ .../core/sql/parser/ODropIndexStatement.java | 22 ++++++ .../sql/parser/ODropPropertyStatement.java | 25 ++++++ .../sql/parser/ODropSequenceStatement.java | 18 +++++ .../sql/parser/OEqualsCompareOperator.java | 8 ++ .../core/sql/parser/OExplainStatement.java | 18 +++++ .../orient/core/sql/parser/OExpression.java | 37 +++++++++ .../orient/core/sql/parser/OFetchPlan.java | 18 +++++ .../core/sql/parser/OFetchPlanItem.java | 31 ++++++++ .../sql/parser/OFindReferencesStatement.java | 25 ++++++ .../core/sql/parser/OFloatingPoint.java | 32 +++++++- .../orient/core/sql/parser/OFromClause.java | 18 +++++ .../orient/core/sql/parser/OFromItem.java | 46 +++++++++++ .../orient/core/sql/parser/OFunctionCall.java | 22 ++++++ .../orient/core/sql/parser/OGeOperator.java | 8 ++ .../core/sql/parser/OGrantStatement.java | 25 ++++++ .../orient/core/sql/parser/OGroupBy.java | 18 +++++ .../orient/core/sql/parser/OGtOperator.java | 8 ++ .../orient/core/sql/parser/OIdentifier.java | 25 ++++++ .../orient/core/sql/parser/OIfStatement.java | 22 ++++++ .../orient/core/sql/parser/OInCondition.java | 36 +++++++++ .../orient/core/sql/parser/OInOperator.java | 8 ++ .../core/sql/parser/OIndexIdentifier.java | 24 ++++++ .../core/sql/parser/OIndexMatchCondition.java | 27 +++++++ .../orient/core/sql/parser/OIndexName.java | 21 +++++ .../orient/core/sql/parser/OInsertBody.java | 37 +++++++++ .../core/sql/parser/OInsertStatement.java | 46 +++++++++++ .../core/sql/parser/OInstanceofCondition.java | 24 ++++++ .../orient/core/sql/parser/OInteger.java | 18 +++++ .../core/sql/parser/OIsDefinedCondition.java | 17 ++++ .../sql/parser/OIsNotDefinedCondition.java | 17 ++++ .../core/sql/parser/OIsNotNullCondition.java | 17 ++++ .../core/sql/parser/OIsNullCondition.java | 17 ++++ .../orient/core/sql/parser/OJson.java | 18 +++++ .../orient/core/sql/parser/OLeOperator.java | 8 ++ .../orient/core/sql/parser/OLetClause.java | 18 +++++ .../orient/core/sql/parser/OLetItem.java | 24 ++++++ .../orient/core/sql/parser/OLetStatement.java | 25 ++++++ .../core/sql/parser/OLevelZeroIdentifier.java | 25 ++++++ .../orient/core/sql/parser/OLikeOperator.java | 7 ++ .../orient/core/sql/parser/OLimit.java | 22 ++++++ .../orient/core/sql/parser/OLtOperator.java | 8 ++ .../core/sql/parser/OLuceneOperator.java | 8 ++ .../core/sql/parser/OMatchExpression.java | 36 ++++++++- .../orient/core/sql/parser/OMatchFilter.java | 24 ++++++ .../core/sql/parser/OMatchFilterItem.java | 53 +++++++++++++ .../core/sql/parser/OMatchPathItem.java | 36 +++++++++ .../core/sql/parser/OMatchPathItemFirst.java | 24 ++++++ .../core/sql/parser/OMatchStatement.java | 79 +++++++++++++++---- .../core/sql/parser/OMatchesCondition.java | 24 ++++++ .../core/sql/parser/OMathExpression.java | 28 ++++++- .../core/sql/parser/OMetadataIdentifier.java | 18 +++++ .../orient/core/sql/parser/OMethodCall.java | 22 ++++++ .../orient/core/sql/parser/OModifier.java | 39 ++++++++- .../core/sql/parser/OMultiMatchPathItem.java | 33 +++++++- .../core/sql/parser/ONamedParameter.java | 22 ++++++ .../orient/core/sql/parser/ONeOperator.java | 8 ++ .../orient/core/sql/parser/ONearOperator.java | 8 ++ .../orient/core/sql/parser/ONeqOperator.java | 8 ++ .../orient/core/sql/parser/ONotBlock.java | 22 ++++++ .../core/sql/parser/ONotInCondition.java | 36 +++++++++ .../parser/OOptimizeDatabaseStatement.java | 18 +++++ .../orient/core/sql/parser/OOrBlock.java | 18 +++++ .../orient/core/sql/parser/OOrderBy.java | 18 +++++ .../core/sql/parser/OParenthesisBlock.java | 18 +++++ .../sql/parser/OParenthesisExpression.java | 25 ++++++ .../orient/core/sql/parser/OPermission.java | 18 +++++ .../core/sql/parser/OPositionalParameter.java | 18 +++++ .../sql/parser/OProfileStorageStatement.java | 18 +++++ .../orient/core/sql/parser/OProjection.java | 18 +++++ .../core/sql/parser/OProjectionItem.java | 28 +++++++ .../sql/parser/ORebuildIndexStatement.java | 22 ++++++ .../core/sql/parser/ORecordAttribute.java | 18 +++++ .../core/sql/parser/OResourcePathItem.java | 25 ++++++ .../orient/core/sql/parser/ORetry.java | 16 +++- .../core/sql/parser/OReturnStatement.java | 18 +++++ .../core/sql/parser/ORevokeStatement.java | 25 ++++++ .../orient/core/sql/parser/ORid.java | 22 ++++++ .../core/sql/parser/OScAndOperator.java | 8 ++ .../core/sql/parser/OSelectStatement.java | 65 ++++++++++++++- .../orient/core/sql/parser/OSkip.java | 22 ++++++ .../core/sql/parser/OSleepStatement.java | 18 +++++ .../core/sql/parser/OSuffixIdentifier.java | 25 ++++++ .../orient/core/sql/parser/OTimeout.java | 22 ++++++ .../sql/parser/OTraverseProjectionItem.java | 25 ++++++ .../core/sql/parser/OTraverseStatement.java | 34 ++++++++ .../sql/parser/OTruncateClassStatement.java | 25 ++++++ .../sql/parser/OTruncateClusterStatement.java | 25 ++++++ .../sql/parser/OTruncateRecordStatement.java | 22 ++++++ .../orient/core/sql/parser/OUnwind.java | 18 +++++ .../core/sql/parser/OUpdateAddItem.java | 22 ++++++ .../core/sql/parser/OUpdateEdgeStatement.java | 2 + .../core/sql/parser/OUpdateIncrementItem.java | 25 ++++++ .../orient/core/sql/parser/OUpdateItem.java | 28 +++++++ .../core/sql/parser/OUpdateOperations.java | 34 ++++++++ .../core/sql/parser/OUpdatePutItem.java | 25 ++++++ .../core/sql/parser/OUpdateRemoveItem.java | 22 ++++++ .../core/sql/parser/OUpdateStatement.java | 54 ++++++++++++- .../orient/core/sql/parser/OWait.java | 13 ++- .../orient/core/sql/parser/OWhereClause.java | 26 +++++- .../core/sql/parser/OWithinOperator.java | 8 ++ 145 files changed, 3541 insertions(+), 53 deletions(-) diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java index fd46ffd6897..9eb31495e3b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/executor/OSelectExecutionPlanner.java @@ -244,21 +244,19 @@ private void handleIndexAsTarget(OSelectExecutionPlan result, OIndexIdentifier i String indexName = indexIdentifier.getIndexName(); OIndex index = ctx.getDatabase().getMetadata().getIndexManager().getIndex(indexName); if (index == null) { - throw new OCommandExecutionException( - "Index not found: " + indexName);//TODO check if you can iterate over the index without a key + throw new OCommandExecutionException("Index not found: " + indexName); } if (flattenedWhereClause == null) { throw new OCommandExecutionException( "Index queries must have a WHERE conditioni with like 'key = [val1, val2, valN]");//TODO check if you can iterate over the index without a key } if (flattenedWhereClause.size() != 1) { - throw new OCommandExecutionException( - "Index queries with this kind of condition are not supported yet: " + flattenedWhereClause);//TODO + throw new OCommandExecutionException("Index queries with this kind of condition are not supported yet: " + whereClause);//TODO } OAndBlock andBlock = flattenedWhereClause.get(0); if (andBlock.getSubBlocks().size() != 1) { - throw new OCommandExecutionException("Index queries with this kind of condition are not supported yet: " + andBlock);//TODO + throw new OCommandExecutionException("Index queries with this kind of condition are not supported yet: " + whereClause);//TODO } this.whereClause = null;//The WHERE clause won't be used anymore, the index does all the filtering @@ -286,7 +284,7 @@ private void handleMetadataAsTarget(OSelectExecutionPlan plan, OMetadataIdentifi ORecordId schemaRid = new ORecordId(schemaRecordIdAsString); plan.chain(new FetchFromRidsStep(Collections.singleton(schemaRid), ctx)); } else { - throw new UnsupportedOperationException();//TODO + throw new UnsupportedOperationException();//TODO other metadata types } } @@ -330,8 +328,6 @@ private void handleOrderBy(OSelectExecutionPlan plan, OOrderBy orderBy, OCommand } private void handleClassAsTarget(OSelectExecutionPlan plan, OIdentifier identifier, OCommandContext ctx) { - //TODO optimize fetch from class, eg. when you can use and index or when you can do early sort. - if (handleClassAsTargetWithIndex(plan, identifier, ctx)) { return; } @@ -353,7 +349,7 @@ private void handleClassAsTarget(OSelectExecutionPlan plan, OIdentifier identifi } private boolean handleClassAsTargetWithIndex(OSelectExecutionPlan plan, OIdentifier identifier, OCommandContext ctx) { - if (flattenedWhereClause == null || flattenedWhereClause.size()==0) { + if (flattenedWhereClause == null || flattenedWhereClause.size() == 0) { return false; } OClass clazz = ctx.getDatabase().getMetadata().getSchema().getClass(identifier.getStringValue()); @@ -399,11 +395,28 @@ private OWhereClause createWhereFrom(OBooleanExpression remainingCondition) { return result; } + /** + * given a flat AND block and a set of indexes, returns the best index to be used to process it, with the complete descripton on how to use it + * + * @param ctx + * @param indexes + * @param block + * @return + */ private IndexSearchDescriptor findBestIndexFor(OCommandContext ctx, Set> indexes, OAndBlock block) { return indexes.stream().map(index -> buildIndexSearchDescriptor(ctx, index, block)).filter(Objects::nonNull) .min(Comparator.comparing(x -> x.cost(ctx))).orElse(null); } + /** + * given an index and a flat AND block, returns a descriptor on how to process it with an index (index, index key and additional filters + * to apply after index fetch + * + * @param ctx + * @param index + * @param block + * @return + */ private IndexSearchDescriptor buildIndexSearchDescriptor(OCommandContext ctx, OIndex index, OAndBlock block) { List indexFields = index.getDefinition().getFields(); OBinaryCondition keyCondition = new OBinaryCondition(-1); diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java index 61ec9d6a82d..6fbe0e47730 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClassStatement.java @@ -134,5 +134,57 @@ public OStatement copy() { result.unsafe = unsafe; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OAlterClassStatement that = (OAlterClassStatement) o; + + if (unsafe != that.unsafe) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (property != that.property) + return false; + if (identifierValue != null ? !identifierValue.equals(that.identifierValue) : that.identifierValue != null) + return false; + if (identifierListValue != null ? !identifierListValue.equals(that.identifierListValue) : that.identifierListValue != null) + return false; + if (add != null ? !add.equals(that.add) : that.add != null) + return false; + if (remove != null ? !remove.equals(that.remove) : that.remove != null) + return false; + if (numberValue != null ? !numberValue.equals(that.numberValue) : that.numberValue != null) + return false; + if (booleanValue != null ? !booleanValue.equals(that.booleanValue) : that.booleanValue != null) + return false; + if (customKey != null ? !customKey.equals(that.customKey) : that.customKey != null) + return false; + if (customValue != null ? !customValue.equals(that.customValue) : that.customValue != null) + return false; + if (customString != null ? !customString.equals(that.customString) : that.customString != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (property != null ? property.hashCode() : 0); + result = 31 * result + (identifierValue != null ? identifierValue.hashCode() : 0); + result = 31 * result + (identifierListValue != null ? identifierListValue.hashCode() : 0); + result = 31 * result + (add != null ? add.hashCode() : 0); + result = 31 * result + (remove != null ? remove.hashCode() : 0); + result = 31 * result + (numberValue != null ? numberValue.hashCode() : 0); + result = 31 * result + (booleanValue != null ? booleanValue.hashCode() : 0); + result = 31 * result + (customKey != null ? customKey.hashCode() : 0); + result = 31 * result + (customValue != null ? customValue.hashCode() : 0); + result = 31 * result + (customString != null ? customString.hashCode() : 0); + result = 31 * result + (unsafe ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=4668bb1cd336844052df941f39bdb634 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClusterStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClusterStatement.java index 479c2b5f3e7..dc8fbbade45 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClusterStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterClusterStatement.java @@ -39,5 +39,33 @@ public OAlterClusterStatement(OrientSql p, int id) { result.attributeValue = attributeValue == null ? null : attributeValue.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OAlterClusterStatement that = (OAlterClusterStatement) o; + + if (starred != that.starred) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (attributeName != null ? !attributeName.equals(that.attributeName) : that.attributeName != null) + return false; + if (attributeValue != null ? !attributeValue.equals(that.attributeValue) : that.attributeValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (attributeName != null ? attributeName.hashCode() : 0); + result = 31 * result + (starred ? 1 : 0); + result = 31 * result + (attributeValue != null ? attributeValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=ed78ea0f1a05b0963db625ed1f338bd6 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterDatabaseStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterDatabaseStatement.java index 0960de400d0..a2c37d5a814 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterDatabaseStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterDatabaseStatement.java @@ -43,5 +43,33 @@ public OAlterDatabaseStatement(OrientSql p, int id) { result.settingValue = settingValue == null ? null : settingValue.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OAlterDatabaseStatement that = (OAlterDatabaseStatement) o; + + if (customPropertyName != null ? !customPropertyName.equals(that.customPropertyName) : that.customPropertyName != null) + return false; + if (customPropertyValue != null ? !customPropertyValue.equals(that.customPropertyValue) : that.customPropertyValue != null) + return false; + if (settingName != null ? !settingName.equals(that.settingName) : that.settingName != null) + return false; + if (settingValue != null ? !settingValue.equals(that.settingValue) : that.settingValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = customPropertyName != null ? customPropertyName.hashCode() : 0; + result = 31 * result + (customPropertyValue != null ? customPropertyValue.hashCode() : 0); + result = 31 * result + (settingName != null ? settingName.hashCode() : 0); + result = 31 * result + (settingValue != null ? settingValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=8fec57db8dd2a3b52aaa52dec7367cd4 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterPropertyStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterPropertyStatement.java index 5a8bb697fb6..3b3fb6b1945 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterPropertyStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterPropertyStatement.java @@ -57,5 +57,39 @@ public OAlterPropertyStatement(OrientSql p, int id) { result.settingValue = settingValue == null ? null : settingValue.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OAlterPropertyStatement that = (OAlterPropertyStatement) o; + + if (className != null ? !className.equals(that.className) : that.className != null) + return false; + if (propertyName != null ? !propertyName.equals(that.propertyName) : that.propertyName != null) + return false; + if (customPropertyName != null ? !customPropertyName.equals(that.customPropertyName) : that.customPropertyName != null) + return false; + if (customPropertyValue != null ? !customPropertyValue.equals(that.customPropertyValue) : that.customPropertyValue != null) + return false; + if (settingName != null ? !settingName.equals(that.settingName) : that.settingName != null) + return false; + if (settingValue != null ? !settingValue.equals(that.settingValue) : that.settingValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = className != null ? className.hashCode() : 0; + result = 31 * result + (propertyName != null ? propertyName.hashCode() : 0); + result = 31 * result + (customPropertyName != null ? customPropertyName.hashCode() : 0); + result = 31 * result + (customPropertyValue != null ? customPropertyValue.hashCode() : 0); + result = 31 * result + (settingName != null ? settingName.hashCode() : 0); + result = 31 * result + (settingValue != null ? settingValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=2421f6ad3b5f1f8e18149650ff80f1e7 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterSequenceStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterSequenceStatement.java index 183287d7f6d..95ae705f507 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterSequenceStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAlterSequenceStatement.java @@ -44,5 +44,33 @@ public OAlterSequenceStatement(OrientSql p, int id) { result.cache = cache == null ? null : cache.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OAlterSequenceStatement that = (OAlterSequenceStatement) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (start != null ? !start.equals(that.start) : that.start != null) + return false; + if (increment != null ? !increment.equals(that.increment) : that.increment != null) + return false; + if (cache != null ? !cache.equals(that.cache) : that.cache != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (start != null ? start.hashCode() : 0); + result = 31 * result + (increment != null ? increment.hashCode() : 0); + result = 31 * result + (cache != null ? cache.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=def62b1d04db5223307fe51873a9edd0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java index bebfb45a3c2..45d24ea986a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAndBlock.java @@ -171,5 +171,23 @@ public OAndBlock copy() { } return null; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OAndBlock andBlock = (OAndBlock) o; + + if (subBlocks != null ? !subBlocks.equals(andBlock.subBlocks) : andBlock.subBlocks != null) + return false; + + return true; + } + + @Override public int hashCode() { + return subBlocks != null ? subBlocks.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=cf1f66cc86cfc93d357f9fcdfa4a4604 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayNumberSelector.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayNumberSelector.java index 0a2b2f51272..568704c6dd5 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayNumberSelector.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayNumberSelector.java @@ -96,5 +96,33 @@ public OArrayNumberSelector copy() { result.integer = integer; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OArrayNumberSelector that = (OArrayNumberSelector) o; + + if (inputFinalValue != null ? !inputFinalValue.equals(that.inputFinalValue) : that.inputFinalValue != null) + return false; + if (inputValue != null ? !inputValue.equals(that.inputValue) : that.inputValue != null) + return false; + if (expressionValue != null ? !expressionValue.equals(that.expressionValue) : that.expressionValue != null) + return false; + if (integer != null ? !integer.equals(that.integer) : that.integer != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = inputFinalValue != null ? inputFinalValue.hashCode() : 0; + result = 31 * result + (inputValue != null ? inputValue.hashCode() : 0); + result = 31 * result + (expressionValue != null ? expressionValue.hashCode() : 0); + result = 31 * result + (integer != null ? integer.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=5b2e495391ede3ccdc6c25aa63c8e591 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayRangeSelector.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayRangeSelector.java index 1bb571b13f9..14cf4f58ff3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayRangeSelector.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArrayRangeSelector.java @@ -148,5 +148,36 @@ public OArrayRangeSelector copy() { return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OArrayRangeSelector that = (OArrayRangeSelector) o; + + if (newRange != that.newRange) + return false; + if (from != null ? !from.equals(that.from) : that.from != null) + return false; + if (to != null ? !to.equals(that.to) : that.to != null) + return false; + if (fromSelector != null ? !fromSelector.equals(that.fromSelector) : that.fromSelector != null) + return false; + if (toSelector != null ? !toSelector.equals(that.toSelector) : that.toSelector != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = from != null ? from.hashCode() : 0; + result = 31 * result + (to != null ? to.hashCode() : 0); + result = 31 * result + (newRange ? 1 : 0); + result = 31 * result + (fromSelector != null ? fromSelector.hashCode() : 0); + result = 31 * result + (toSelector != null ? toSelector.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=594a372e31fcbcd3ed962c2260e76468 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySelector.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySelector.java index 32253876dc5..7914b6251fb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySelector.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySelector.java @@ -98,5 +98,33 @@ public OArraySelector copy(){ return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OArraySelector that = (OArraySelector) o; + + if (rid != null ? !rid.equals(that.rid) : that.rid != null) + return false; + if (inputParam != null ? !inputParam.equals(that.inputParam) : that.inputParam != null) + return false; + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + if (integer != null ? !integer.equals(that.integer) : that.integer != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = rid != null ? rid.hashCode() : 0; + result = 31 * result + (inputParam != null ? inputParam.hashCode() : 0); + result = 31 * result + (expression != null ? expression.hashCode() : 0); + result = 31 * result + (integer != null ? integer.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=f87a5543b1dad0fb5f6828a0663a7c9e (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySingleValuesSelector.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySingleValuesSelector.java index 32dc23c4b49..281e9699bb9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySingleValuesSelector.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OArraySingleValuesSelector.java @@ -81,5 +81,23 @@ public OArraySingleValuesSelector copy() { result.items = items.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OArraySingleValuesSelector that = (OArraySingleValuesSelector) o; + + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=991998c77a4831184b6dca572513fd8d (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseExpression.java index dfa16262a95..0a7a20b1d9b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseExpression.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseExpression.java @@ -192,6 +192,36 @@ public AggregationContext getAggregationContext(OCommandContext ctx) { } } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OBaseExpression that = (OBaseExpression) o; + + if (number != null ? !number.equals(that.number) : that.number != null) + return false; + if (identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) + return false; + if (inputParam != null ? !inputParam.equals(that.inputParam) : that.inputParam != null) + return false; + if (string != null ? !string.equals(that.string) : that.string != null) + return false; + if (modifier != null ? !modifier.equals(that.modifier) : that.modifier != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = number != null ? number.hashCode() : 0; + result = 31 * result + (identifier != null ? identifier.hashCode() : 0); + result = 31 * result + (inputParam != null ? inputParam.hashCode() : 0); + result = 31 * result + (string != null ? string.hashCode() : 0); + result = 31 * result + (modifier != null ? modifier.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=71b3e2d1b65c923dc7cfe11f9f449d2b (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseIdentifier.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseIdentifier.java index 79d447bfec0..e3178aefacc 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseIdentifier.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseIdentifier.java @@ -178,5 +178,27 @@ public OBaseIdentifier copy() { result.suffix = suffix==null?null:suffix.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OBaseIdentifier that = (OBaseIdentifier) o; + + if (levelZero != null ? !levelZero.equals(that.levelZero) : that.levelZero != null) + return false; + if (suffix != null ? !suffix.equals(that.suffix) : that.suffix != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = levelZero != null ? levelZero.hashCode() : 0; + result = 31 * result + (suffix != null ? suffix.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=ed89af10d8be41a83428c5608a4834f6 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBatch.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBatch.java index cec0096df0c..f361cba8e7d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBatch.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBatch.java @@ -44,5 +44,27 @@ public OBatch copy() { result.num = num == null ? null : num.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OBatch oBatch = (OBatch) o; + + if (num != null ? !num.equals(oBatch.num) : oBatch.num != null) + return false; + if (inputParam != null ? !inputParam.equals(oBatch.inputParam) : oBatch.inputParam != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = num != null ? num.hashCode() : 0; + result = 31 * result + (inputParam != null ? inputParam.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=b1587460e08cbf21086d8c8fcca192e0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBeginStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBeginStatement.java index 0bc5dfd569d..39c772d041d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBeginStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBeginStatement.java @@ -28,5 +28,23 @@ public OBeginStatement(OrientSql p, int id) { result.isolation = isolation == null ? null : isolation.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OBeginStatement that = (OBeginStatement) o; + + if (isolation != null ? !isolation.equals(that.isolation) : that.isolation != null) + return false; + + return true; + } + + @Override public int hashCode() { + return isolation != null ? isolation.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=aaa994acbe63cc4169fe33144d412fed (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBetweenCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBetweenCondition.java index d1b1d93d5ac..5caa6ed7bfa 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBetweenCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBetweenCondition.java @@ -152,5 +152,29 @@ protected List getExternalCalculationConditions() { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OBetweenCondition that = (OBetweenCondition) o; + + if (first != null ? !first.equals(that.first) : that.first != null) + return false; + if (second != null ? !second.equals(that.second) : that.second != null) + return false; + if (third != null ? !third.equals(that.third) : that.third != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = first != null ? first.hashCode() : 0; + result = 31 * result + (second != null ? second.hashCode() : 0); + result = 31 * result + (third != null ? third.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=f94f4779c4a6c6d09539446045ceca89 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBinaryCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBinaryCondition.java index 6e3e253e3bd..6c133fec350 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBinaryCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBinaryCondition.java @@ -147,5 +147,30 @@ public void setOperator(OBinaryCompareOperator operator) { public void setRight(OExpression right) { this.right = right; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OBinaryCondition that = (OBinaryCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (operator != null ? !operator.equals(that.operator) : that.operator != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (operator != null ? operator.hashCode() : 0); + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=99ed1dd2812eb730de8e1931b1764da5 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBothPathItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBothPathItem.java index f6242052339..cd8739ef8d7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBothPathItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBothPathItem.java @@ -38,5 +38,6 @@ public void toString(Map params, StringBuilder builder) { filter.toString(params, builder); } } + } /* JavaCC - OriginalChecksum=061ff26f18cfa0c561ce9b98ef919173 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCluster.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCluster.java index eb61f5a423d..0f685b4199c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCluster.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCluster.java @@ -48,5 +48,27 @@ public OCluster copy() { result.clusterNumber = clusterNumber; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCluster oCluster = (OCluster) o; + + if (clusterName != null ? !clusterName.equals(oCluster.clusterName) : oCluster.clusterName != null) + return false; + if (clusterNumber != null ? !clusterNumber.equals(oCluster.clusterNumber) : oCluster.clusterNumber != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = clusterName != null ? clusterName.hashCode() : 0; + result = 31 * result + (clusterNumber != null ? clusterNumber.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=d27abf009fe7db482fbcaac9d52ba192 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OClusterList.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OClusterList.java index 3a4138d9664..f29440e7131 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OClusterList.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OClusterList.java @@ -55,5 +55,23 @@ public OClusterList copy() { result.clusters = clusters.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OClusterList that = (OClusterList) o; + + if (clusters != null ? !clusters.equals(that.clusters) : that.clusters != null) + return false; + + return true; + } + + @Override public int hashCode() { + return clusters != null ? clusters.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=bd90ffa0b9d17f204b3cf2d47eedb409 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCollection.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCollection.java index 5a03fb1cb72..a2834968d9c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCollection.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCollection.java @@ -108,5 +108,23 @@ public OCollection copy() { result.expressions = expressions == null ? null : expressions.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCollection that = (OCollection) o; + + if (expressions != null ? !expressions.equals(that.expressions) : that.expressions != null) + return false; + + return true; + } + + @Override public int hashCode() { + return expressions != null ? expressions.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=c93b20138b2ae58c5f76e458c34b5946 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommandLineOption.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommandLineOption.java index 6d82972d5af..e67b444d6c8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommandLineOption.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommandLineOption.java @@ -26,5 +26,23 @@ public OCommandLineOption copy() { result.name = name == null ? null : name.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCommandLineOption that = (OCommandLineOption) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + return name != null ? name.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=7fcb8de8a1f99a2737aac85933d074d9 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommitStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommitStatement.java index 28e90265d27..7f44c400fc2 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommitStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCommitStatement.java @@ -29,5 +29,23 @@ public OCommitStatement(OrientSql p, int id) { result.retry = retry == null ? null : retry.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCommitStatement that = (OCommitStatement) o; + + if (retry != null ? !retry.equals(that.retry) : that.retry != null) + return false; + + return true; + } + + @Override public int hashCode() { + return retry != null ? retry.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=eaa0bc8f765fdaa017789953861bc0aa (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OConsoleStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OConsoleStatement.java index 1078d588b44..b0e9cbd0b71 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OConsoleStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OConsoleStatement.java @@ -29,5 +29,27 @@ public OConsoleStatement(OrientSql p, int id) { result.message = message == null ? null : message.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OConsoleStatement that = (OConsoleStatement) o; + + if (logLevel != null ? !logLevel.equals(that.logLevel) : that.logLevel != null) + return false; + if (message != null ? !message.equals(that.message) : that.message != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = logLevel != null ? logLevel.hashCode() : 0; + result = 31 * result + (message != null ? message.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=626c09cda52a1a8a63eeefcb37bd66a1 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsAllCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsAllCondition.java index 4505762dde1..3715d7be69b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsAllCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsAllCondition.java @@ -132,5 +132,30 @@ public void setRight(OExpression right) { result.rightBlock = rightBlock == null ? null : rightBlock.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OContainsAllCondition that = (OContainsAllCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + if (rightBlock != null ? !rightBlock.equals(that.rightBlock) : that.rightBlock != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + result = 31 * result + (rightBlock != null ? rightBlock.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=ab7b4e192a01cda09a82d5b80ef4ec60 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsCondition.java index eb88f9a1fd5..6371d6ae494 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsCondition.java @@ -167,5 +167,29 @@ public void toString(Map params, StringBuilder builder) { } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OContainsCondition that = (OContainsCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + if (condition != null ? !condition.equals(that.condition) : that.condition != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + result = 31 * result + (condition != null ? condition.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=bad1118296ea74860e88d66bfe9fa222 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsKeyOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsKeyOperator.java index 5e072890619..8b4e29dd2ed 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsKeyOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsKeyOperator.java @@ -13,13 +13,14 @@ public OContainsKeyOperator(OrientSql p, int id) { super(p, id); } - /** Accept the visitor. **/ + /** + * Accept the visitor. + **/ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { return visitor.visit(this, data); } - @Override - public boolean execute(Object left, Object right) { + @Override public boolean execute(Object left, Object right) { if (left == null) { return false; } @@ -30,8 +31,7 @@ public boolean execute(Object left, Object right) { return false; } - @Override - public String toString() { + @Override public String toString() { return "CONTAINSKEY"; } @@ -42,5 +42,13 @@ public String toString() { public OContainsKeyOperator copy() { return this; } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=1a03daaa6712eb981b070e8e94960951 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsTextCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsTextCondition.java index 3b5e14c1d6e..f01ed62edd8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsTextCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsTextCondition.java @@ -87,5 +87,27 @@ public void toString(Map params, StringBuilder builder) { result.right = right.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OContainsTextCondition that = (OContainsTextCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=b588492ba2cbd0f932055f1f64bbbecd (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueCondition.java index fb933602d39..fd228c6b555 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueCondition.java @@ -94,5 +94,33 @@ public void toString(Map params, StringBuilder builder) { result.expression = expression == null ? null : expression.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OContainsValueCondition that = (OContainsValueCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (operator != null ? !operator.equals(that.operator) : that.operator != null) + return false; + if (condition != null ? !condition.equals(that.condition) : that.condition != null) + return false; + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (operator != null ? operator.hashCode() : 0); + result = 31 * result + (condition != null ? condition.hashCode() : 0); + result = 31 * result + (expression != null ? expression.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=6fda752f10c8d8731f43efa706e39459 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueOperator.java index 5481d71ade0..46d28fdbcbf 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OContainsValueOperator.java @@ -41,5 +41,12 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { return "CONTAINSVALUE"; } + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=5d6492dbb028b8bac69e60d4916cf341 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClassStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClassStatement.java index e73c707dc52..30547039416 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClassStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClassStatement.java @@ -80,5 +80,36 @@ public OCreateClassStatement(OrientSql p, int id) { result.abstractClass = abstractClass; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateClassStatement that = (OCreateClassStatement) o; + + if (abstractClass != that.abstractClass) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (superclasses != null ? !superclasses.equals(that.superclasses) : that.superclasses != null) + return false; + if (clusters != null ? !clusters.equals(that.clusters) : that.clusters != null) + return false; + if (totalClusterNo != null ? !totalClusterNo.equals(that.totalClusterNo) : that.totalClusterNo != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (superclasses != null ? superclasses.hashCode() : 0); + result = 31 * result + (clusters != null ? clusters.hashCode() : 0); + result = 31 * result + (totalClusterNo != null ? totalClusterNo.hashCode() : 0); + result = 31 * result + (abstractClass ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=4043013624f55fdf0ea8fee6d4f211b0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClusterStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClusterStatement.java index 8e1b6ec0616..cd6a06c2d89 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClusterStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateClusterStatement.java @@ -43,5 +43,30 @@ public OCreateClusterStatement(OrientSql p, int id) { result.blob = blob; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateClusterStatement that = (OCreateClusterStatement) o; + + if (blob != that.blob) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (id != null ? !id.equals(that.id) : that.id != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (id != null ? id.hashCode() : 0); + result = 31 * result + (blob ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=6011a26678f2175aa456a0a6c094cb13 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatement.java index 7598b782ba8..eb06cc7893e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateEdgeStatement.java @@ -62,7 +62,12 @@ public void toString(Map params, StringBuilder builder) { } @Override public OCreateEdgeStatement copy() { - OCreateEdgeStatement result = new OCreateEdgeStatement(-1); + OCreateEdgeStatement result = null; + try { + result = getClass().getConstructor(Integer.TYPE).newInstance(-1); + } catch (Exception e) { + throw new RuntimeException(e); + } result.targetClass = targetClass==null?null:targetClass.copy(); result.targetClusterName = targetClusterName==null?null:targetClusterName.copy(); @@ -77,5 +82,45 @@ public void toString(Map params, StringBuilder builder) { result.batch = batch==null?null:batch.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateEdgeStatement that = (OCreateEdgeStatement) o; + + if (targetClass != null ? !targetClass.equals(that.targetClass) : that.targetClass != null) + return false; + if (targetClusterName != null ? !targetClusterName.equals(that.targetClusterName) : that.targetClusterName != null) + return false; + if (leftExpression != null ? !leftExpression.equals(that.leftExpression) : that.leftExpression != null) + return false; + if (rightExpression != null ? !rightExpression.equals(that.rightExpression) : that.rightExpression != null) + return false; + if (body != null ? !body.equals(that.body) : that.body != null) + return false; + if (retry != null ? !retry.equals(that.retry) : that.retry != null) + return false; + if (wait != null ? !wait.equals(that.wait) : that.wait != null) + return false; + if (batch != null ? !batch.equals(that.batch) : that.batch != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = targetClass != null ? targetClass.hashCode() : 0; + result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0); + result = 31 * result + (leftExpression != null ? leftExpression.hashCode() : 0); + result = 31 * result + (rightExpression != null ? rightExpression.hashCode() : 0); + result = 31 * result + (body != null ? body.hashCode() : 0); + result = 31 * result + (retry != null ? retry.hashCode() : 0); + result = 31 * result + (wait != null ? wait.hashCode() : 0); + result = 31 * result + (batch != null ? batch.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=2d3dc5693940ffa520146f8f7f505128 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatement.java index 176a0d28c0c..a0012a2d4bb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateFunctionStatement.java @@ -60,5 +60,39 @@ public OCreateFunctionStatement(OrientSql p, int id) { result.language = language == null ? null : language.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateFunctionStatement that = (OCreateFunctionStatement) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (codeQuoted != null ? !codeQuoted.equals(that.codeQuoted) : that.codeQuoted != null) + return false; + if (code != null ? !code.equals(that.code) : that.code != null) + return false; + if (parameters != null ? !parameters.equals(that.parameters) : that.parameters != null) + return false; + if (idempotent != null ? !idempotent.equals(that.idempotent) : that.idempotent != null) + return false; + if (language != null ? !language.equals(that.language) : that.language != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (codeQuoted != null ? codeQuoted.hashCode() : 0); + result = 31 * result + (code != null ? code.hashCode() : 0); + result = 31 * result + (parameters != null ? parameters.hashCode() : 0); + result = 31 * result + (idempotent != null ? idempotent.hashCode() : 0); + result = 31 * result + (language != null ? language.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=bbc914f66e96822dedc7e89e14240872 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java index 5026664de99..77131cca0eb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java @@ -27,6 +27,40 @@ public Property copy() { result.collate = collate == null ? null : collate.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + Property property = (Property) o; + + if (byKey != property.byKey) + return false; + if (byValue != property.byValue) + return false; + if (name != null ? !name.equals(property.name) : property.name != null) + return false; + if (recordAttribute != null ? !recordAttribute.equals(property.recordAttribute) : property.recordAttribute != null) + return false; + if (className != null ? !className.equals(property.className) : property.className != null) + return false; + if (collate != null ? !collate.equals(property.collate) : property.collate != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (recordAttribute != null ? recordAttribute.hashCode() : 0); + result = 31 * result + (className != null ? className.hashCode() : 0); + result = 31 * result + (byKey ? 1 : 0); + result = 31 * result + (byValue ? 1 : 0); + result = 31 * result + (collate != null ? collate.hashCode() : 0); + return result; + } } protected OIndexName name; @@ -109,5 +143,42 @@ public OCreateIndexStatement(OrientSql p, int id) { result.metadata = metadata == null ? null : metadata.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateIndexStatement that = (OCreateIndexStatement) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (className != null ? !className.equals(that.className) : that.className != null) + return false; + if (propertyList != null ? !propertyList.equals(that.propertyList) : that.propertyList != null) + return false; + if (type != null ? !type.equals(that.type) : that.type != null) + return false; + if (engine != null ? !engine.equals(that.engine) : that.engine != null) + return false; + if (keyTypes != null ? !keyTypes.equals(that.keyTypes) : that.keyTypes != null) + return false; + if (metadata != null ? !metadata.equals(that.metadata) : that.metadata != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (className != null ? className.hashCode() : 0); + result = 31 * result + (propertyList != null ? propertyList.hashCode() : 0); + result = 31 * result + (type != null ? type.hashCode() : 0); + result = 31 * result + (engine != null ? engine.hashCode() : 0); + result = 31 * result + (keyTypes != null ? keyTypes.hashCode() : 0); + result = 31 * result + (metadata != null ? metadata.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=bd090e02c4346ad390a6b8c77f1b9dba (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateLinkStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateLinkStatement.java index 686a3d752a7..610736787be 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateLinkStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateLinkStatement.java @@ -63,5 +63,48 @@ public OCreateLinkStatement(OrientSql p, int id) { result.inverse = inverse; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateLinkStatement that = (OCreateLinkStatement) o; + + if (inverse != that.inverse) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (type != null ? !type.equals(that.type) : that.type != null) + return false; + if (sourceClass != null ? !sourceClass.equals(that.sourceClass) : that.sourceClass != null) + return false; + if (sourceField != null ? !sourceField.equals(that.sourceField) : that.sourceField != null) + return false; + if (sourceRecordAttr != null ? !sourceRecordAttr.equals(that.sourceRecordAttr) : that.sourceRecordAttr != null) + return false; + if (destClass != null ? !destClass.equals(that.destClass) : that.destClass != null) + return false; + if (destField != null ? !destField.equals(that.destField) : that.destField != null) + return false; + if (destRecordAttr != null ? !destRecordAttr.equals(that.destRecordAttr) : that.destRecordAttr != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (type != null ? type.hashCode() : 0); + result = 31 * result + (sourceClass != null ? sourceClass.hashCode() : 0); + result = 31 * result + (sourceField != null ? sourceField.hashCode() : 0); + result = 31 * result + (sourceRecordAttr != null ? sourceRecordAttr.hashCode() : 0); + result = 31 * result + (destClass != null ? destClass.hashCode() : 0); + result = 31 * result + (destField != null ? destField.hashCode() : 0); + result = 31 * result + (destRecordAttr != null ? destRecordAttr.hashCode() : 0); + result = 31 * result + (inverse ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=de46c9bdaf3b36691764a78cd89d1c2b (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyAttributeStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyAttributeStatement.java index 61b3b10e961..1b0bc26b5c5 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyAttributeStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyAttributeStatement.java @@ -37,5 +37,27 @@ public OCreatePropertyAttributeStatement copy() { result.settingValue = settingValue == null ? null : settingValue.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreatePropertyAttributeStatement that = (OCreatePropertyAttributeStatement) o; + + if (settingName != null ? !settingName.equals(that.settingName) : that.settingName != null) + return false; + if (settingValue != null ? !settingValue.equals(that.settingValue) : that.settingValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = settingName != null ? settingName.hashCode() : 0; + result = 31 * result + (settingValue != null ? settingValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=6a7964c2b9dad541ca962eecea00651b (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatement.java index 37cc95fb892..b378bcc9656 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreatePropertyStatement.java @@ -63,5 +63,39 @@ public OCreatePropertyStatement(OrientSql p, int id) { result.attributes = attributes == null ? null : attributes.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreatePropertyStatement that = (OCreatePropertyStatement) o; + + if (unsafe != that.unsafe) + return false; + if (className != null ? !className.equals(that.className) : that.className != null) + return false; + if (propertyName != null ? !propertyName.equals(that.propertyName) : that.propertyName != null) + return false; + if (propertyType != null ? !propertyType.equals(that.propertyType) : that.propertyType != null) + return false; + if (linkedType != null ? !linkedType.equals(that.linkedType) : that.linkedType != null) + return false; + if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = className != null ? className.hashCode() : 0; + result = 31 * result + (propertyName != null ? propertyName.hashCode() : 0); + result = 31 * result + (propertyType != null ? propertyType.hashCode() : 0); + result = 31 * result + (linkedType != null ? linkedType.hashCode() : 0); + result = 31 * result + (unsafe ? 1 : 0); + result = 31 * result + (attributes != null ? attributes.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=ff78676483d59013ab10b13bde2678d3 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateSequenceStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateSequenceStatement.java index 6e5dd5dbdfd..d18635b9d6f 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateSequenceStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateSequenceStatement.java @@ -60,5 +60,36 @@ public OCreateSequenceStatement(OrientSql p, int id) { result.cache = cache == null ? null : cache.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateSequenceStatement that = (OCreateSequenceStatement) o; + + if (type != that.type) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (start != null ? !start.equals(that.start) : that.start != null) + return false; + if (increment != null ? !increment.equals(that.increment) : that.increment != null) + return false; + if (cache != null ? !cache.equals(that.cache) : that.cache != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + type; + result = 31 * result + (start != null ? start.hashCode() : 0); + result = 31 * result + (increment != null ? increment.hashCode() : 0); + result = 31 * result + (cache != null ? cache.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=b0436d11e05c3435f22dafea6b5106c0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatement.java index 84153865df6..be972d33fbb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateVertexStatement.java @@ -46,7 +46,12 @@ public void toString(Map params, StringBuilder builder) { } @Override public OCreateVertexStatement copy() { - OCreateVertexStatement result = new OCreateVertexStatement(-1); + OCreateVertexStatement result = null; + try { + result = getClass().getConstructor(Integer.TYPE).newInstance(-1); + } catch (Exception e) { + throw new RuntimeException(e); + } result.targetClass = targetClass == null ? null : targetClass.copy(); result.targetClusterName = targetClusterName == null ? null : targetClusterName.copy(); result.targetCluster = targetCluster == null ? null : targetCluster.copy(); @@ -54,5 +59,36 @@ public void toString(Map params, StringBuilder builder) { result.insertBody = insertBody == null ? null : insertBody.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OCreateVertexStatement that = (OCreateVertexStatement) o; + + if (targetClass != null ? !targetClass.equals(that.targetClass) : that.targetClass != null) + return false; + if (targetClusterName != null ? !targetClusterName.equals(that.targetClusterName) : that.targetClusterName != null) + return false; + if (targetCluster != null ? !targetCluster.equals(that.targetCluster) : that.targetCluster != null) + return false; + if (returnStatement != null ? !returnStatement.equals(that.returnStatement) : that.returnStatement != null) + return false; + if (insertBody != null ? !insertBody.equals(that.insertBody) : that.insertBody != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = targetClass != null ? targetClass.hashCode() : 0; + result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0); + result = 31 * result + (targetCluster != null ? targetCluster.hashCode() : 0); + result = 31 * result + (returnStatement != null ? returnStatement.hashCode() : 0); + result = 31 * result + (insertBody != null ? insertBody.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=0ac3d3f09a76b9924a17fd05bc293863 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatement.java index f728181e6b2..b57a08075e3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteEdgeStatement.java @@ -144,7 +144,12 @@ public void toString(Map params, StringBuilder builder) { } @Override public ODeleteEdgeStatement copy() { - ODeleteEdgeStatement result = new ODeleteEdgeStatement(-1); + ODeleteEdgeStatement result = null; + try { + result = getClass().getConstructor(Integer.TYPE).newInstance(-1); + } catch (Exception e) { + throw new RuntimeException(e); + } result.className = className == null ? null : className.copy(); result.targetClusterName = targetClusterName == null ? null : targetClusterName.copy(); result.rid = rid == null ? null : rid.copy(); @@ -164,5 +169,72 @@ public void toString(Map params, StringBuilder builder) { result.batch = batch == null ? null : batch.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODeleteEdgeStatement that = (ODeleteEdgeStatement) o; + + if (className != null ? !className.equals(that.className) : that.className != null) + return false; + if (targetClusterName != null ? !targetClusterName.equals(that.targetClusterName) : that.targetClusterName != null) + return false; + if (rid != null ? !rid.equals(that.rid) : that.rid != null) + return false; + if (rids != null ? !rids.equals(that.rids) : that.rids != null) + return false; + if (leftRid != null ? !leftRid.equals(that.leftRid) : that.leftRid != null) + return false; + if (leftRids != null ? !leftRids.equals(that.leftRids) : that.leftRids != null) + return false; + if (leftStatement != null ? !leftStatement.equals(that.leftStatement) : that.leftStatement != null) + return false; + if (leftParam != null ? !leftParam.equals(that.leftParam) : that.leftParam != null) + return false; + if (leftIdentifier != null ? !leftIdentifier.equals(that.leftIdentifier) : that.leftIdentifier != null) + return false; + if (rightRid != null ? !rightRid.equals(that.rightRid) : that.rightRid != null) + return false; + if (rightRids != null ? !rightRids.equals(that.rightRids) : that.rightRids != null) + return false; + if (rightStatement != null ? !rightStatement.equals(that.rightStatement) : that.rightStatement != null) + return false; + if (rightParam != null ? !rightParam.equals(that.rightParam) : that.rightParam != null) + return false; + if (rightIdentifier != null ? !rightIdentifier.equals(that.rightIdentifier) : that.rightIdentifier != null) + return false; + if (whereClause != null ? !whereClause.equals(that.whereClause) : that.whereClause != null) + return false; + if (limit != null ? !limit.equals(that.limit) : that.limit != null) + return false; + if (batch != null ? !batch.equals(that.batch) : that.batch != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = className != null ? className.hashCode() : 0; + result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0); + result = 31 * result + (rid != null ? rid.hashCode() : 0); + result = 31 * result + (rids != null ? rids.hashCode() : 0); + result = 31 * result + (leftRid != null ? leftRid.hashCode() : 0); + result = 31 * result + (leftRids != null ? leftRids.hashCode() : 0); + result = 31 * result + (leftStatement != null ? leftStatement.hashCode() : 0); + result = 31 * result + (leftParam != null ? leftParam.hashCode() : 0); + result = 31 * result + (leftIdentifier != null ? leftIdentifier.hashCode() : 0); + result = 31 * result + (rightRid != null ? rightRid.hashCode() : 0); + result = 31 * result + (rightRids != null ? rightRids.hashCode() : 0); + result = 31 * result + (rightStatement != null ? rightStatement.hashCode() : 0); + result = 31 * result + (rightParam != null ? rightParam.hashCode() : 0); + result = 31 * result + (rightIdentifier != null ? rightIdentifier.hashCode() : 0); + result = 31 * result + (whereClause != null ? whereClause.hashCode() : 0); + result = 31 * result + (limit != null ? limit.hashCode() : 0); + result = 31 * result + (batch != null ? batch.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=8f4c5bafa99572d7d87a5d0a2c7d55a7 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteStatement.java index d65a8a79da6..d9d49c3f6f2 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteStatement.java @@ -48,5 +48,36 @@ public void toString(Map params, StringBuilder builder) { result.unsafe = unsafe; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODeleteStatement that = (ODeleteStatement) o; + + if (returnBefore != that.returnBefore) + return false; + if (unsafe != that.unsafe) + return false; + if (fromClause != null ? !fromClause.equals(that.fromClause) : that.fromClause != null) + return false; + if (whereClause != null ? !whereClause.equals(that.whereClause) : that.whereClause != null) + return false; + if (limit != null ? !limit.equals(that.limit) : that.limit != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = fromClause != null ? fromClause.hashCode() : 0; + result = 31 * result + (whereClause != null ? whereClause.hashCode() : 0); + result = 31 * result + (returnBefore ? 1 : 0); + result = 31 * result + (limit != null ? limit.hashCode() : 0); + result = 31 * result + (unsafe ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=5fb4ca5ba648e6c9110f41d806206a6f (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteVertexStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteVertexStatement.java index 36766a7637a..63298c00063 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteVertexStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODeleteVertexStatement.java @@ -52,5 +52,39 @@ public void toString(Map params, StringBuilder builder) { result.batch = batch == null ? null : batch.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODeleteVertexStatement that = (ODeleteVertexStatement) o; + + if (from != that.from) + return false; + if (returnBefore != that.returnBefore) + return false; + if (fromClause != null ? !fromClause.equals(that.fromClause) : that.fromClause != null) + return false; + if (whereClause != null ? !whereClause.equals(that.whereClause) : that.whereClause != null) + return false; + if (limit != null ? !limit.equals(that.limit) : that.limit != null) + return false; + if (batch != null ? !batch.equals(that.batch) : that.batch != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = (from ? 1 : 0); + result = 31 * result + (fromClause != null ? fromClause.hashCode() : 0); + result = 31 * result + (whereClause != null ? whereClause.hashCode() : 0); + result = 31 * result + (returnBefore ? 1 : 0); + result = 31 * result + (limit != null ? limit.hashCode() : 0); + result = 31 * result + (batch != null ? batch.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=b62d3046f4bd1b9c1f78ed4f125b06d3 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java index 1e1119ca6ef..a9ca0e58792 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClassStatement.java @@ -31,5 +31,27 @@ public ODropClassStatement(OrientSql p, int id) { result.unsafe = unsafe; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODropClassStatement that = (ODropClassStatement) o; + + if (unsafe != that.unsafe) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (unsafe ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=8c475e1225074f68be37fce610987d54 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClusterStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClusterStatement.java index b90617dadc2..fd912cbd9b9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClusterStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropClusterStatement.java @@ -31,5 +31,27 @@ public ODropClusterStatement(OrientSql p, int id) { result.id = id == null ? null : id.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODropClusterStatement that = (ODropClusterStatement) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (id != null ? !id.equals(that.id) : that.id != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (id != null ? id.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=239ffe92e79e1d5c82976ed9814583ec (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropIndexStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropIndexStatement.java index c69be779871..6c3b3dc7dd4 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropIndexStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropIndexStatement.java @@ -32,5 +32,27 @@ public ODropIndexStatement(OrientSql p, int id) { result.name = name == null ? null : name.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODropIndexStatement that = (ODropIndexStatement) o; + + if (all != that.all) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = (all ? 1 : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=51c8221d049e4f114378e4be03797050 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropPropertyStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropPropertyStatement.java index 1d17fd3af9f..a0694156d8a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropPropertyStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropPropertyStatement.java @@ -35,5 +35,30 @@ public ODropPropertyStatement(OrientSql p, int id) { result.force = force; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODropPropertyStatement that = (ODropPropertyStatement) o; + + if (force != that.force) + return false; + if (className != null ? !className.equals(that.className) : that.className != null) + return false; + if (propertyName != null ? !propertyName.equals(that.propertyName) : that.propertyName != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = className != null ? className.hashCode() : 0; + result = 31 * result + (propertyName != null ? propertyName.hashCode() : 0); + result = 31 * result + (force ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=6a9b4b1694dc36caf2b801218faebe42 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropSequenceStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropSequenceStatement.java index 754b1ea0c31..b99d02e64ae 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropSequenceStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ODropSequenceStatement.java @@ -25,5 +25,23 @@ public ODropSequenceStatement(OrientSql p, int id) { result.name = name == null ? null : name.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ODropSequenceStatement that = (ODropSequenceStatement) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + return name != null ? name.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=def62b1d04db5223307fe51873a9edd0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OEqualsCompareOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OEqualsCompareOperator.java index 9302e3e69d4..50302ef898b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OEqualsCompareOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OEqualsCompareOperator.java @@ -39,5 +39,13 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { result.doubleEquals = doubleEquals; return result; } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()) && ((OEqualsCompareOperator)obj).doubleEquals == doubleEquals; + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=bd2ec5d13a1d171779c2bdbc9d3a56bc (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExplainStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExplainStatement.java index 16594521328..4cd931b0ffb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExplainStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExplainStatement.java @@ -48,5 +48,23 @@ public OExplainStatement(OrientSql p, int id) { result.statement = statement == null ? null : statement.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OExplainStatement that = (OExplainStatement) o; + + if (statement != null ? !statement.equals(that.statement) : that.statement != null) + return false; + + return true; + } + + @Override public int hashCode() { + return statement != null ? statement.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=9fdd24510993cbee32e38a51c838bdb4 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExpression.java index 0474ccebeb2..40745d693e8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExpression.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExpression.java @@ -329,5 +329,42 @@ public OExpression copy() { return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OExpression that = (OExpression) o; + + if (isNull != that.isNull) + return false; + if (singleQuotes != null ? !singleQuotes.equals(that.singleQuotes) : that.singleQuotes != null) + return false; + if (doubleQuotes != null ? !doubleQuotes.equals(that.doubleQuotes) : that.doubleQuotes != null) + return false; + if (rid != null ? !rid.equals(that.rid) : that.rid != null) + return false; + if (mathExpression != null ? !mathExpression.equals(that.mathExpression) : that.mathExpression != null) + return false; + if (json != null ? !json.equals(that.json) : that.json != null) + return false; + if (booleanValue != null ? !booleanValue.equals(that.booleanValue) : that.booleanValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = singleQuotes != null ? singleQuotes.hashCode() : 0; + result = 31 * result + (doubleQuotes != null ? doubleQuotes.hashCode() : 0); + result = 31 * result + (isNull ? 1 : 0); + result = 31 * result + (rid != null ? rid.hashCode() : 0); + result = 31 * result + (mathExpression != null ? mathExpression.hashCode() : 0); + result = 31 * result + (json != null ? json.hashCode() : 0); + result = 31 * result + (booleanValue != null ? booleanValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=9c860224b121acdc89522ae97010be01 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlan.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlan.java index 856766c6bfe..e89be9b8b1b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlan.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlan.java @@ -44,5 +44,23 @@ public OFetchPlan copy() { result.items = items.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OFetchPlan that = (OFetchPlan) o; + + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=b4cd86f2c6e8fc5e9dce8912389a1167 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlanItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlanItem.java index 476246d3775..b8697dc412d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlanItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFetchPlanItem.java @@ -67,5 +67,36 @@ public OFetchPlanItem copy() { result.fieldChain.addAll(fieldChain); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OFetchPlanItem that = (OFetchPlanItem) o; + + if (leftStar != that.leftStar) + return false; + if (star != null ? !star.equals(that.star) : that.star != null) + return false; + if (leftDepth != null ? !leftDepth.equals(that.leftDepth) : that.leftDepth != null) + return false; + if (rightDepth != null ? !rightDepth.equals(that.rightDepth) : that.rightDepth != null) + return false; + if (fieldChain != null ? !fieldChain.equals(that.fieldChain) : that.fieldChain != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = star != null ? star.hashCode() : 0; + result = 31 * result + (leftDepth != null ? leftDepth.hashCode() : 0); + result = 31 * result + (leftStar ? 1 : 0); + result = 31 * result + (rightDepth != null ? rightDepth.hashCode() : 0); + result = 31 * result + (fieldChain != null ? fieldChain.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=b7f4c9a97a8f2ca3d85020e054a9ad16 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFindReferencesStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFindReferencesStatement.java index 772d13cdd95..a819c0938fa 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFindReferencesStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFindReferencesStatement.java @@ -52,5 +52,30 @@ public OFindReferencesStatement(OrientSql p, int id) { result.targets = targets == null ? null : targets.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OFindReferencesStatement that = (OFindReferencesStatement) o; + + if (rid != null ? !rid.equals(that.rid) : that.rid != null) + return false; + if (subQuery != null ? !subQuery.equals(that.subQuery) : that.subQuery != null) + return false; + if (targets != null ? !targets.equals(that.targets) : that.targets != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = rid != null ? rid.hashCode() : 0; + result = 31 * result + (subQuery != null ? subQuery.hashCode() : 0); + result = 31 * result + (targets != null ? targets.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=be781e05acef94aa5edd7438b4ead6d5 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFloatingPoint.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFloatingPoint.java index e4a2aa99383..a3fe184bef9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFloatingPoint.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFloatingPoint.java @@ -17,8 +17,7 @@ public OFloatingPoint(OrientSql p, int id) { super(p, id); } - @Override - public Number getValue() { + @Override public Number getValue() { return Double.parseDouble((sign == -1 ? "-" : "") + stringValue); } @@ -44,5 +43,34 @@ public void toString(Map params, StringBuilder builder) { } builder.append(stringValue); } + + @Override public OFloatingPoint copy() { + OFloatingPoint result = new OFloatingPoint(-1); + result.sign = sign; + result.stringValue = stringValue; + return result; + } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OFloatingPoint that = (OFloatingPoint) o; + + if (sign != that.sign) + return false; + if (stringValue != null ? !stringValue.equals(that.stringValue) : that.stringValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = sign; + result = 31 * result + (stringValue != null ? stringValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=46acfb589f666717595e28f1b19611ae (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromClause.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromClause.java index 57057a3fe68..663f558a3f3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromClause.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromClause.java @@ -37,5 +37,23 @@ public OFromClause copy() { result.item = item.copy(); return null; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OFromClause that = (OFromClause) o; + + if (item != null ? !item.equals(that.item) : that.item != null) + return false; + + return true; + } + + @Override public int hashCode() { + return item != null ? item.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=051839d20dabfa4cce26ebcbe0d03a86 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromItem.java index 519de148e33..217861ce1a6 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFromItem.java @@ -143,5 +143,51 @@ public OFromItem copy() { return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OFromItem oFromItem = (OFromItem) o; + + if (rids != null ? !rids.equals(oFromItem.rids) : oFromItem.rids != null) + return false; + if (cluster != null ? !cluster.equals(oFromItem.cluster) : oFromItem.cluster != null) + return false; + if (clusterList != null ? !clusterList.equals(oFromItem.clusterList) : oFromItem.clusterList != null) + return false; + if (index != null ? !index.equals(oFromItem.index) : oFromItem.index != null) + return false; + if (metadata != null ? !metadata.equals(oFromItem.metadata) : oFromItem.metadata != null) + return false; + if (statement != null ? !statement.equals(oFromItem.statement) : oFromItem.statement != null) + return false; + if (inputParam != null ? !inputParam.equals(oFromItem.inputParam) : oFromItem.inputParam != null) + return false; + if (identifier != null ? !identifier.equals(oFromItem.identifier) : oFromItem.identifier != null) + return false; + if (functionCall != null ? !functionCall.equals(oFromItem.functionCall) : oFromItem.functionCall != null) + return false; + if (modifier != null ? !modifier.equals(oFromItem.modifier) : oFromItem.modifier != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = rids != null ? rids.hashCode() : 0; + result = 31 * result + (cluster != null ? cluster.hashCode() : 0); + result = 31 * result + (clusterList != null ? clusterList.hashCode() : 0); + result = 31 * result + (index != null ? index.hashCode() : 0); + result = 31 * result + (metadata != null ? metadata.hashCode() : 0); + result = 31 * result + (statement != null ? statement.hashCode() : 0); + result = 31 * result + (inputParam != null ? inputParam.hashCode() : 0); + result = 31 * result + (identifier != null ? identifier.hashCode() : 0); + result = 31 * result + (functionCall != null ? functionCall.hashCode() : 0); + result = 31 * result + (modifier != null ? modifier.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=f64e3b4d2a2627a1b5d04a7dcb95fa94 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFunctionCall.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFunctionCall.java index 4c4b46ddad6..093d9e1018e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFunctionCall.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFunctionCall.java @@ -255,5 +255,27 @@ public OFunctionCall copy() { result.params = params.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OFunctionCall that = (OFunctionCall) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (params != null ? !params.equals(that.params) : that.params != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (params != null ? params.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=290d4e1a3f663299452e05f8db718419 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java index 9ce0c78bbdb..8c80533b58a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java @@ -69,5 +69,13 @@ public String toString() { @Override public boolean isRangeOperator() { return true; } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=960da239569d393eb155f7d8a871e6d5 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGrantStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGrantStatement.java index a05d1400f51..95fc6c665ac 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGrantStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGrantStatement.java @@ -43,5 +43,30 @@ public OGrantStatement(OrientSql p, int id) { this.actor = actor == null ? null : actor.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OGrantStatement that = (OGrantStatement) o; + + if (permission != null ? !permission.equals(that.permission) : that.permission != null) + return false; + if (resourceChain != null ? !resourceChain.equals(that.resourceChain) : that.resourceChain != null) + return false; + if (actor != null ? !actor.equals(that.actor) : that.actor != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = permission != null ? permission.hashCode() : 0; + result = 31 * result + (resourceChain != null ? resourceChain.hashCode() : 0); + result = 31 * result + (actor != null ? actor.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=c5f7b91e57070a95c6ea490373d16f7f (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGroupBy.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGroupBy.java index e5051854d2d..554c90d6880 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGroupBy.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGroupBy.java @@ -45,5 +45,23 @@ public OGroupBy copy() { result.items = items.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OGroupBy oGroupBy = (OGroupBy) o; + + if (items != null ? !items.equals(oGroupBy.items) : oGroupBy.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=4739190aa6c1a3533a89b76a15bd6fdf (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java index 01c59655378..74d909d0f5d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java @@ -48,5 +48,13 @@ public String toString() { @Override public boolean isRangeOperator() { return true; } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=4b96739fc6e9ae496916d542db361376 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIdentifier.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIdentifier.java index ad35df34bb9..090924a5d1c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIdentifier.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIdentifier.java @@ -97,5 +97,30 @@ public OIdentifier copy(){ result.quoted = quoted; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIdentifier that = (OIdentifier) o; + + if (quoted != that.quoted) + return false; + if (internalAlias != that.internalAlias) + return false; + if (value != null ? !value.equals(that.value) : that.value != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = value != null ? value.hashCode() : 0; + result = 31 * result + (quoted ? 1 : 0); + result = 31 * result + (internalAlias ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=691a2eb5096f7b5e634b2ca8ac2ded3a (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIfStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIfStatement.java index 5610fafefb2..b6fdededac1 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIfStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIfStatement.java @@ -36,5 +36,27 @@ public OIfStatement(OrientSql p, int id) { result.statements = statements == null ? null : statements.stream().map(OStatement::copy).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIfStatement that = (OIfStatement) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + if (statements != null ? !statements.equals(that.statements) : that.statements != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = expression != null ? expression.hashCode() : 0; + result = 31 * result + (statements != null ? statements.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=a8cd4fb832a4f3b6e71bb1a12f8d8819 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInCondition.java index 9c593285866..6b5ba7f088f 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInCondition.java @@ -133,6 +133,42 @@ private String convertToString(Object o) { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OInCondition that = (OInCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (operator != null ? !operator.equals(that.operator) : that.operator != null) + return false; + if (rightStatement != null ? !rightStatement.equals(that.rightStatement) : that.rightStatement != null) + return false; + if (rightParam != null ? !rightParam.equals(that.rightParam) : that.rightParam != null) + return false; + if (rightMathExpression != null ? !rightMathExpression.equals(that.rightMathExpression) : that.rightMathExpression != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + if (inputFinalValue != null ? !inputFinalValue.equals(that.inputFinalValue) : that.inputFinalValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (operator != null ? operator.hashCode() : 0); + result = 31 * result + (rightStatement != null ? rightStatement.hashCode() : 0); + result = 31 * result + (rightParam != null ? rightParam.hashCode() : 0); + result = 31 * result + (rightMathExpression != null ? rightMathExpression.hashCode() : 0); + result = 31 * result + (right != null ? right.hashCode() : 0); + result = 31 * result + (inputFinalValue != null ? inputFinalValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=00df7cb1877c0a12d24205c1700653c7 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInOperator.java index 2c8e5b6f86b..64c935953a4 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInOperator.java @@ -77,5 +77,13 @@ public boolean execute(Object left, Object right) { @Override public OInOperator copy() { return new OInOperator(-1); } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=6650a720cb942fa3c4d588ff0f381b3a (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexIdentifier.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexIdentifier.java index 38f89281e31..460a70796e7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexIdentifier.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexIdentifier.java @@ -72,6 +72,30 @@ public OIndexIdentifier copy() { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIndexIdentifier that = (OIndexIdentifier) o; + + if (type != that.type) + return false; + if (indexNameString != null ? !indexNameString.equals(that.indexNameString) : that.indexNameString != null) + return false; + if (indexName != null ? !indexName.equals(that.indexName) : that.indexName != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = type != null ? type.hashCode() : 0; + result = 31 * result + (indexNameString != null ? indexNameString.hashCode() : 0); + result = 31 * result + (indexName != null ? indexName.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=025f134fd4b27b84210738cdb6dd027c (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexMatchCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexMatchCondition.java index 965ec3644ad..3807f84ef84 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexMatchCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexMatchCondition.java @@ -125,5 +125,32 @@ public void toString(Map params, StringBuilder builder) { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIndexMatchCondition that = (OIndexMatchCondition) o; + + if (operator != null ? !operator.equals(that.operator) : that.operator != null) + return false; + if (between != null ? !between.equals(that.between) : that.between != null) + return false; + if (leftExpressions != null ? !leftExpressions.equals(that.leftExpressions) : that.leftExpressions != null) + return false; + if (rightExpressions != null ? !rightExpressions.equals(that.rightExpressions) : that.rightExpressions != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = operator != null ? operator.hashCode() : 0; + result = 31 * result + (between != null ? between.hashCode() : 0); + result = 31 * result + (leftExpressions != null ? leftExpressions.hashCode() : 0); + result = 31 * result + (rightExpressions != null ? rightExpressions.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=702e9ab959e87b043b519844a7d31224 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexName.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexName.java index 5282818e631..ac068d41517 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexName.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIndexName.java @@ -5,6 +5,9 @@ import java.util.Map; public class OIndexName extends SimpleNode { + + protected Object value; + public OIndexName(int id) { super(id); } @@ -27,5 +30,23 @@ public OIndexName copy() { result.value = value; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIndexName that = (OIndexName) o; + + if (value != null ? !value.equals(that.value) : that.value != null) + return false; + + return true; + } + + @Override public int hashCode() { + return value != null ? value.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=06c827926e7e9ee650b76d42e31feb46 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertBody.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertBody.java index 7b58261ad98..f6ae2c6e739 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertBody.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertBody.java @@ -117,5 +117,42 @@ public OInsertBody copy() { result.returnProjection = returnProjection == null ? null : returnProjection.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OInsertBody that = (OInsertBody) o; + + if (selectInParentheses != that.selectInParentheses) + return false; + if (identifierList != null ? !identifierList.equals(that.identifierList) : that.identifierList != null) + return false; + if (valueExpressions != null ? !valueExpressions.equals(that.valueExpressions) : that.valueExpressions != null) + return false; + if (setExpressions != null ? !setExpressions.equals(that.setExpressions) : that.setExpressions != null) + return false; + if (selectStatement != null ? !selectStatement.equals(that.selectStatement) : that.selectStatement != null) + return false; + if (content != null ? !content.equals(that.content) : that.content != null) + return false; + if (returnProjection != null ? !returnProjection.equals(that.returnProjection) : that.returnProjection != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = identifierList != null ? identifierList.hashCode() : 0; + result = 31 * result + (valueExpressions != null ? valueExpressions.hashCode() : 0); + result = 31 * result + (setExpressions != null ? setExpressions.hashCode() : 0); + result = 31 * result + (selectStatement != null ? selectStatement.hashCode() : 0); + result = 31 * result + (selectInParentheses ? 1 : 0); + result = 31 * result + (content != null ? content.hashCode() : 0); + result = 31 * result + (returnProjection != null ? returnProjection.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=7d2079a41a1fc63a812cb679e729b23a (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertStatement.java index b500ff4689f..76bee97cc08 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInsertStatement.java @@ -81,5 +81,51 @@ public void toString(Map params, StringBuilder builder) { result.unsafe = unsafe; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OInsertStatement that = (OInsertStatement) o; + + if (selectInParentheses != that.selectInParentheses) + return false; + if (selectWithFrom != that.selectWithFrom) + return false; + if (unsafe != that.unsafe) + return false; + if (targetClass != null ? !targetClass.equals(that.targetClass) : that.targetClass != null) + return false; + if (targetClusterName != null ? !targetClusterName.equals(that.targetClusterName) : that.targetClusterName != null) + return false; + if (targetCluster != null ? !targetCluster.equals(that.targetCluster) : that.targetCluster != null) + return false; + if (targetIndex != null ? !targetIndex.equals(that.targetIndex) : that.targetIndex != null) + return false; + if (insertBody != null ? !insertBody.equals(that.insertBody) : that.insertBody != null) + return false; + if (returnStatement != null ? !returnStatement.equals(that.returnStatement) : that.returnStatement != null) + return false; + if (selectStatement != null ? !selectStatement.equals(that.selectStatement) : that.selectStatement != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = targetClass != null ? targetClass.hashCode() : 0; + result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0); + result = 31 * result + (targetCluster != null ? targetCluster.hashCode() : 0); + result = 31 * result + (targetIndex != null ? targetIndex.hashCode() : 0); + result = 31 * result + (insertBody != null ? insertBody.hashCode() : 0); + result = 31 * result + (returnStatement != null ? returnStatement.hashCode() : 0); + result = 31 * result + (selectStatement != null ? selectStatement.hashCode() : 0); + result = 31 * result + (selectInParentheses ? 1 : 0); + result = 31 * result + (selectWithFrom ? 1 : 0); + result = 31 * result + (unsafe ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=ccfabcf022d213caed873e6256cb26ad (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInstanceofCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInstanceofCondition.java index d9d9b7e6138..acbab2ccb18 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInstanceofCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInstanceofCondition.java @@ -83,5 +83,29 @@ public void toString(Map params, StringBuilder builder) { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OInstanceofCondition that = (OInstanceofCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + if (rightString != null ? !rightString.equals(that.rightString) : that.rightString != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + result = 31 * result + (rightString != null ? rightString.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=0b5eb529744f307228faa6b26f0592dc (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInteger.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInteger.java index 6d5bd83ec7d..db3f903e0b8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInteger.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OInteger.java @@ -33,5 +33,23 @@ public OInteger copy() { result.value = value; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OInteger oInteger = (OInteger) o; + + if (value != null ? !value.equals(oInteger.value) : oInteger.value != null) + return false; + + return true; + } + + @Override public int hashCode() { + return value != null ? value.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=2e6eee6366ff4e864dd6c8184d2766f5 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsDefinedCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsDefinedCondition.java index 7b23076f026..267e244e901 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsDefinedCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsDefinedCondition.java @@ -65,5 +65,22 @@ public void toString(Map params, StringBuilder builder) { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIsDefinedCondition that = (OIsDefinedCondition) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + + return true; + } + + @Override public int hashCode() { + return expression != null ? expression.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=075954b212c8cb44c8538bf5dea047d3 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotDefinedCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotDefinedCondition.java index effe2486e10..798fa19637c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotDefinedCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotDefinedCondition.java @@ -65,5 +65,22 @@ public void toString(Map params, StringBuilder builder) { builder.append(" is not defined"); } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIsNotDefinedCondition that = (OIsNotDefinedCondition) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + + return true; + } + + @Override public int hashCode() { + return expression != null ? expression.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=1c766d6caf5ccae19c1c291396bb56f2 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotNullCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotNullCondition.java index 1aeffdc49d0..06acfd89490 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotNullCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNotNullCondition.java @@ -71,5 +71,22 @@ public void toString(Map params, StringBuilder builder) { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIsNotNullCondition that = (OIsNotNullCondition) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + + return true; + } + + @Override public int hashCode() { + return expression != null ? expression.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=a292fa8a629abb7f6fe72a627fc91361 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNullCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNullCondition.java index f10910e257d..ce8d7b5ea2e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNullCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OIsNullCondition.java @@ -79,5 +79,22 @@ public void toString(Map params, StringBuilder builder) { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OIsNullCondition that = (OIsNullCondition) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + + return true; + } + + @Override public int hashCode() { + return expression != null ? expression.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=29ebbc506a98f90953af91a66a03aa1e (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OJson.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OJson.java index 4e2167e6631..67cb0901c70 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OJson.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OJson.java @@ -141,5 +141,23 @@ public OJson copy() { result.items = items.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OJson oJson = (OJson) o; + + if (items != null ? !items.equals(oJson.items) : oJson.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=3beec9f6db486de944498588b51a505d (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java index 24b84d0c2f8..bd17a85cd34 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java @@ -48,5 +48,13 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { @Override public boolean isRangeOperator() { return true; } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=8b3232c970fd654af947274a5f384a93 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetClause.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetClause.java index 189402e6654..d9649691f00 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetClause.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetClause.java @@ -43,6 +43,24 @@ public OLetClause copy() { result.items = items.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OLetClause that = (OLetClause) o; + + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=201a864b5ed7f1fbe0533843a7acd03d (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetItem.java index f6221adb038..9b5f3588d1c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetItem.java @@ -45,5 +45,29 @@ public OLetItem copy() { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OLetItem oLetItem = (OLetItem) o; + + if (varName != null ? !varName.equals(oLetItem.varName) : oLetItem.varName != null) + return false; + if (expression != null ? !expression.equals(oLetItem.expression) : oLetItem.expression != null) + return false; + if (query != null ? !query.equals(oLetItem.query) : oLetItem.query != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = varName != null ? varName.hashCode() : 0; + result = 31 * result + (expression != null ? expression.hashCode() : 0); + result = 31 * result + (query != null ? query.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=bb3cd298d79f50d72f6842e6d6ea4fb2 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetStatement.java index c1276929216..990adfda7a6 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLetStatement.java @@ -36,5 +36,30 @@ public OLetStatement(OrientSql p, int id) { result.expression = expression == null ? null : expression.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OLetStatement that = (OLetStatement) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (statement != null ? !statement.equals(that.statement) : that.statement != null) + return false; + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (statement != null ? statement.hashCode() : 0); + result = 31 * result + (expression != null ? expression.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=cc646e5449351ad9ced844f61b687928 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLevelZeroIdentifier.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLevelZeroIdentifier.java index 74a610f784d..ec3f7f0f3b8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLevelZeroIdentifier.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLevelZeroIdentifier.java @@ -176,5 +176,30 @@ public OLevelZeroIdentifier copy() { result.collection = collection==null?null:collection.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OLevelZeroIdentifier that = (OLevelZeroIdentifier) o; + + if (functionCall != null ? !functionCall.equals(that.functionCall) : that.functionCall != null) + return false; + if (self != null ? !self.equals(that.self) : that.self != null) + return false; + if (collection != null ? !collection.equals(that.collection) : that.collection != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = functionCall != null ? functionCall.hashCode() : 0; + result = 31 * result + (self != null ? self.hashCode() : 0); + result = 31 * result + (collection != null ? collection.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=0305fcf120ba9395b4c975f85cdade72 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLikeOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLikeOperator.java index 75656e828b2..076b8c20707 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLikeOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLikeOperator.java @@ -40,5 +40,12 @@ public String toString() { return new OLikeOperator(-1); } + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=16d302abf0f85b404e57b964606952ca (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLimit.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLimit.java index eac723ca45b..37f18d14186 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLimit.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLimit.java @@ -61,5 +61,27 @@ public OLimit copy() { result.inputParam = inputParam == null ? null : inputParam.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OLimit oLimit = (OLimit) o; + + if (num != null ? !num.equals(oLimit.num) : oLimit.num != null) + return false; + if (inputParam != null ? !inputParam.equals(oLimit.inputParam) : oLimit.inputParam != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = num != null ? num.hashCode() : 0; + result = 31 * result + (inputParam != null ? inputParam.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=1063b9489290bb08de6048ba55013171 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java index 2298e4af553..436a136f4ce 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java @@ -52,5 +52,13 @@ public boolean supportsBasicCalculation() { @Override public boolean isRangeOperator() { return true; } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=d8e97d52128198b373bb0c272c72de2c (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLuceneOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLuceneOperator.java index 62ac708954f..5fe920a18af 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLuceneOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLuceneOperator.java @@ -33,5 +33,13 @@ public String toString() { @Override public OLuceneOperator copy() { return new OLuceneOperator(-1); } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=bda1e010e6ba48c815829b22ce458b9d (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchExpression.java index 9abf184d7e9..6ae1d142cb7 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchExpression.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchExpression.java @@ -5,9 +5,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class OMatchExpression extends SimpleNode { - protected OMatchFilter origin; + protected OMatchFilter origin; protected List items = new ArrayList(); public OMatchExpression(int id) { @@ -18,7 +19,9 @@ public OMatchExpression(OrientSql p, int id) { super(p, id); } - /** Accept the visitor. **/ + /** + * Accept the visitor. + **/ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { return visitor.visit(this, data); } @@ -29,5 +32,34 @@ public void toString(Map params, StringBuilder builder) { item.toString(params, builder); } } + + @Override public OMatchExpression copy() { + OMatchExpression result = new OMatchExpression(-1); + result.origin = origin == null ? null : origin.copy(); + result.items = items == null ? null : items.stream().map(x -> x.copy()).collect(Collectors.toList()); + return result; + } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMatchExpression that = (OMatchExpression) o; + + if (origin != null ? !origin.equals(that.origin) : that.origin != null) + return false; + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = origin != null ? origin.hashCode() : 0; + result = 31 * result + (items != null ? items.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=73491fb653c32baf66997290db29f370 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilter.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilter.java index ca32763d542..b546d10b72d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilter.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilter.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class OMatchFilter extends SimpleNode { // TODO transform in a map @@ -137,5 +138,28 @@ public void toString(Map params, StringBuilder builder) { builder.append("}"); } + @Override public OMatchFilter copy() { + OMatchFilter result = new OMatchFilter(-1); + result.items = items == null ? null : items.stream().map(x -> x.copy()).collect(Collectors.toList()); + return result; + } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMatchFilter that = (OMatchFilter) o; + + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=6b099371c69e0d0c1c106fc96b3072de (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilterItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilterItem.java index 2e70f9a9b85..b31c64f5a8a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilterItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchFilterItem.java @@ -73,5 +73,58 @@ public void toString(Map params, StringBuilder builder) { return; } } + + @Override public OMatchFilterItem copy() { + OMatchFilterItem result = new OMatchFilterItem(-1); + result.className = className == null ? null : className.copy(); + result.classNames = classNames == null ? null : classNames.copy(); + result.alias = alias == null ? null : alias.copy(); + result.filter = filter == null ? null : filter.copy(); + result.whileCondition = whileCondition == null ? null : whileCondition.copy(); + result.depth = depth == null ? null : depth.copy(); + result.maxDepth = maxDepth == null ? null : maxDepth.copy(); + result.optional = optional; + return result; + } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMatchFilterItem that = (OMatchFilterItem) o; + + if (className != null ? !className.equals(that.className) : that.className != null) + return false; + if (classNames != null ? !classNames.equals(that.classNames) : that.classNames != null) + return false; + if (alias != null ? !alias.equals(that.alias) : that.alias != null) + return false; + if (filter != null ? !filter.equals(that.filter) : that.filter != null) + return false; + if (whileCondition != null ? !whileCondition.equals(that.whileCondition) : that.whileCondition != null) + return false; + if (depth != null ? !depth.equals(that.depth) : that.depth != null) + return false; + if (maxDepth != null ? !maxDepth.equals(that.maxDepth) : that.maxDepth != null) + return false; + if (optional != null ? !optional.equals(that.optional) : that.optional != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = className != null ? className.hashCode() : 0; + result = 31 * result + (classNames != null ? classNames.hashCode() : 0); + result = 31 * result + (alias != null ? alias.hashCode() : 0); + result = 31 * result + (filter != null ? filter.hashCode() : 0); + result = 31 * result + (whileCondition != null ? whileCondition.hashCode() : 0); + result = 31 * result + (depth != null ? depth.hashCode() : 0); + result = 31 * result + (maxDepth != null ? maxDepth.hashCode() : 0); + result = 31 * result + (optional != null ? optional.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=74bf4765509f102180cac29f2295031e (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItem.java index af95ae5f4c3..62fe0b441ee 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItem.java @@ -124,5 +124,41 @@ protected Iterable traversePatternEdge(OMatchStatement.MatchConte Object qR = this.method.execute(startingPoint, possibleResults, iCommandContext); return (qR instanceof Iterable) ? (Iterable) qR : Collections.singleton((OIdentifiable) qR); } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMatchPathItem that = (OMatchPathItem) o; + + if (method != null ? !method.equals(that.method) : that.method != null) + return false; + if (filter != null ? !filter.equals(that.filter) : that.filter != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = method != null ? method.hashCode() : 0; + result = 31 * result + (filter != null ? filter.hashCode() : 0); + return result; + } + + @Override public OMatchPathItem copy() { + OMatchPathItem result = null; + try { + result = getClass().getConstructor(Integer.TYPE).newInstance(-1); + } catch (Exception e) { + throw new RuntimeException(e); + } + result.method = method == null ? null : method.copy(); + result.filter = filter == null ? null : filter.copy(); + return result; + } + + } /* JavaCC - OriginalChecksum=ffe8e0ffde583d7b21c9084eff6a8944 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java index 572456ef5ba..e12a7326d1a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchPathItemFirst.java @@ -37,4 +37,28 @@ protected Iterable traversePatternEdge(OMatchStatement.MatchConte Object qR = this.function.execute(startingPoint, iCommandContext); return (qR instanceof Iterable) ? (Iterable) qR : Collections.singleton((OIdentifiable) qR); } + + @Override public OMatchPathItem copy() { + OMatchPathItemFirst result = (OMatchPathItemFirst) super.copy(); + result.function = function == null ? null : function.copy(); + return result; + } + + @Override public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + OMatchPathItemFirst that = (OMatchPathItemFirst) o; + + if (function != null ? !function.equals(that.function) : that.function != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (function != null ? function.hashCode() : 0); + return result; + } } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchStatement.java index e38f2d2ae3b..ea666710d90 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchStatement.java @@ -25,10 +25,11 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.*; +import java.util.stream.Collectors; public class OMatchStatement extends OStatement implements OCommandExecutor, OIterableRecordSource { - String DEFAULT_ALIAS_PREFIX = "$ORIENT_DEFAULT_ALIAS_"; + static final String DEFAULT_ALIAS_PREFIX = "$ORIENT_DEFAULT_ALIAS_"; private OSQLAsynchQuery request; @@ -87,6 +88,7 @@ public static class MatchExecutionPlan { protected List returnAliases = new ArrayList(); protected OLimit limit; + // post-parsing generated data protected Pattern pattern; private Map aliasFilters; @@ -155,6 +157,12 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { OErrorCode.QUERY_PARSE_ERROR.throwException(ex.getMessage(), ex); } + buildPatterns(); + pattern.validate(); + return (RET) this; + } + + private void buildPatterns() { assignDefaultAliases(this.matchExpressions); pattern = new Pattern(); for (OMatchExpression expr : this.matchExpressions) { @@ -171,10 +179,6 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { this.aliasClasses = aliasClasses; rebindFilters(aliasFilters); - - pattern.validate(); - - return (RET) this; } /** @@ -344,7 +348,7 @@ private boolean calculateMatch(Pattern pattern, Map estimatedRootE Set ids = new HashSet(); if (!matches.iterator().hasNext()) { - if(pattern.get(nextAlias).isOptionalNode()){ + if (pattern.get(nextAlias).isOptionalNode()) { continue; } return true; @@ -445,7 +449,8 @@ private boolean processContext(Pattern pattern, MatchExecutionPlan executionPlan } Object rightValues = outEdge.executeTraversal(matchContext, iCommandContext, startingPoint, 0); - if (outEdge.in.isOptionalNode() && (isEmptyResult(rightValues) || !contains(rightValues, matchContext.matched.get(outEdge.in.alias)))) { + if (outEdge.in.isOptionalNode() && (isEmptyResult(rightValues) || !contains(rightValues, + matchContext.matched.get(outEdge.in.alias)))) { MatchContext childContext = matchContext.copy(outEdge.in.alias, null); childContext.matched.put(outEdge.in.alias, null); childContext.currentEdgeNumber = matchContext.currentEdgeNumber + 1; //TODO testOptional 3 match passa con +1 @@ -505,7 +510,8 @@ private boolean processContext(Pattern pattern, MatchExecutionPlan executionPlan } if (!matchContext.matchedEdges.containsKey(inEdge)) { Object leftValues = inEdge.item.method.executeReverse(matchContext.matched.get(inEdge.in.alias), iCommandContext); - if (inEdge.out.isOptionalNode() && (isEmptyResult(leftValues) || !contains(leftValues, matchContext.matched.get(inEdge.out.alias)))) { + if (inEdge.out.isOptionalNode() && (isEmptyResult(leftValues) || !contains(leftValues, + matchContext.matched.get(inEdge.out.alias)))) { MatchContext childContext = matchContext.copy(inEdge.out.alias, null); childContext.matched.put(inEdge.out.alias, null); childContext.currentEdgeNumber = matchContext.currentEdgeNumber + 1; @@ -566,27 +572,27 @@ private boolean processContext(Pattern pattern, MatchExecutionPlan executionPlan } private boolean contains(Object rightValues, OIdentifiable oIdentifiable) { - if(oIdentifiable==null){ + if (oIdentifiable == null) { return true; } - if(rightValues==null){ + if (rightValues == null) { return false; } - if(rightValues instanceof OIdentifiable){ + if (rightValues instanceof OIdentifiable) { return ((OIdentifiable) rightValues).getIdentity().equals(oIdentifiable.getIdentity()); } Iterator iterator = null; - if(rightValues instanceof Iterable){ + if (rightValues instanceof Iterable) { iterator = ((Iterable) rightValues).iterator(); } - if(rightValues instanceof Iterator){ + if (rightValues instanceof Iterator) { iterator = (Iterator) rightValues; } - if(iterator!=null){ - while(iterator.hasNext()){ + if (iterator != null) { + while (iterator.hasNext()) { Object next = iterator.next(); - if(next instanceof OIdentifiable){ - if(((OIdentifiable) next).getIdentity().equals(oIdentifiable.getIdentity())) { + if (next instanceof OIdentifiable) { + if (((OIdentifiable) next).getIdentity().equals(oIdentifiable.getIdentity())) { return true; } } @@ -1049,5 +1055,44 @@ public void toString(Map params, StringBuilder builder) { Object result = execute(iArgs); return ((Iterable) result).iterator(); } + + @Override public OMatchStatement copy() { + OMatchStatement result = new OMatchStatement(-1); + result.matchExpressions = + matchExpressions == null ? null : matchExpressions.stream().map(x -> x.copy()).collect(Collectors.toList()); + result.returnItems = returnItems == null ? null : returnItems.stream().map(x -> x.copy()).collect(Collectors.toList()); + result.returnAliases = returnAliases == null ? null : returnAliases.stream().map(x -> x.copy()).collect(Collectors.toList()); + result.limit = limit == null ? null : limit.copy(); + result.buildPatterns(); + return result; + } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMatchStatement that = (OMatchStatement) o; + + if (matchExpressions != null ? !matchExpressions.equals(that.matchExpressions) : that.matchExpressions != null) + return false; + if (returnItems != null ? !returnItems.equals(that.returnItems) : that.returnItems != null) + return false; + if (returnAliases != null ? !returnAliases.equals(that.returnAliases) : that.returnAliases != null) + return false; + if (limit != null ? !limit.equals(that.limit) : that.limit != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = matchExpressions != null ? matchExpressions.hashCode() : 0; + result = 31 * result + (returnItems != null ? returnItems.hashCode() : 0); + result = 31 * result + (returnAliases != null ? returnAliases.hashCode() : 0); + result = 31 * result + (limit != null ? limit.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=6ff0afbe9d31f08b72159fcf24070c9f (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchesCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchesCondition.java index 2728013ec95..af79451e0a5 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchesCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMatchesCondition.java @@ -82,5 +82,29 @@ public void toString(Map params, StringBuilder builder) { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMatchesCondition that = (OMatchesCondition) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + if (rightParam != null ? !rightParam.equals(that.rightParam) : that.rightParam != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = expression != null ? expression.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + result = 31 * result + (rightParam != null ? rightParam.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=68712f476e2e633c2bbfc34cb6c39356 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMathExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMathExpression.java index 2a3bddc809d..694f32af5e6 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMathExpression.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMathExpression.java @@ -419,11 +419,37 @@ public AggregationContext getAggregationContext(OCommandContext ctx) { } public OMathExpression copy() { - OMathExpression result = new OMathExpression(-1); + OMathExpression result = null; + try { + result = getClass().getConstructor(Integer.TYPE).newInstance(-1); + } catch (Exception e) { + throw new RuntimeException(e); + } result.childExpressions = childExpressions.stream().map(x -> x.copy()).collect(Collectors.toList()); result.operators.addAll(operators); return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMathExpression that = (OMathExpression) o; + + if (childExpressions != null ? !childExpressions.equals(that.childExpressions) : that.childExpressions != null) + return false; + if (operators != null ? !operators.equals(that.operators) : that.operators != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = childExpressions != null ? childExpressions.hashCode() : 0; + result = 31 * result + (operators != null ? operators.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=c255bea24e12493e1005ba2a4d1dbb9d (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMetadataIdentifier.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMetadataIdentifier.java index 2d8f5ec5c12..9105cadb212 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMetadataIdentifier.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMetadataIdentifier.java @@ -37,5 +37,23 @@ public OMetadataIdentifier copy() { result.name = name; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMetadataIdentifier that = (OMetadataIdentifier) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + return name != null ? name.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=85e179b9505270f0596904070fdf0745 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java index 554460d96fc..1f280d818fb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMethodCall.java @@ -147,5 +147,27 @@ public OMethodCall copy() { result.params = params.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OMethodCall that = (OMethodCall) o; + + if (methodName != null ? !methodName.equals(that.methodName) : that.methodName != null) + return false; + if (params != null ? !params.equals(that.params) : that.params != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = methodName != null ? methodName.hashCode() : 0; + result = 31 * result + (params != null ? params.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=da95662da21ceb8dee3ad88c0d980413 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OModifier.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OModifier.java index 58b712b257a..2d27ea4bff4 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OModifier.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OModifier.java @@ -152,7 +152,7 @@ public OModifier copy() { OModifier result = new OModifier(-1); result.squareBrackets = squareBrackets; result.arrayRange = arrayRange == null ? null : arrayRange.copy(); - result.condition = condition == null ? null : (OOrBlock) condition.copy(); + result.condition = condition == null ? null : condition.copy(); result.arraySingleValues = arraySingleValues == null ? null : arraySingleValues.copy(); result.methodCall = methodCall == null ? null : methodCall.copy(); result.suffix = suffix == null ? null : suffix.copy(); @@ -160,5 +160,42 @@ public OModifier copy() { return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OModifier oModifier = (OModifier) o; + + if (squareBrackets != oModifier.squareBrackets) + return false; + if (arrayRange != null ? !arrayRange.equals(oModifier.arrayRange) : oModifier.arrayRange != null) + return false; + if (condition != null ? !condition.equals(oModifier.condition) : oModifier.condition != null) + return false; + if (arraySingleValues != null ? !arraySingleValues.equals(oModifier.arraySingleValues) : oModifier.arraySingleValues != null) + return false; + if (methodCall != null ? !methodCall.equals(oModifier.methodCall) : oModifier.methodCall != null) + return false; + if (suffix != null ? !suffix.equals(oModifier.suffix) : oModifier.suffix != null) + return false; + if (next != null ? !next.equals(oModifier.next) : oModifier.next != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = (squareBrackets ? 1 : 0); + result = 31 * result + (arrayRange != null ? arrayRange.hashCode() : 0); + result = 31 * result + (condition != null ? condition.hashCode() : 0); + result = 31 * result + (arraySingleValues != null ? arraySingleValues.hashCode() : 0); + result = 31 * result + (methodCall != null ? methodCall.hashCode() : 0); + result = 31 * result + (suffix != null ? suffix.hashCode() : 0); + result = 31 * result + (next != null ? next.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=39c21495d02f9b5007b4a2d6915496e1 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMultiMatchPathItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMultiMatchPathItem.java index c3485cfc95b..5cfc84b830e 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMultiMatchPathItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMultiMatchPathItem.java @@ -6,6 +6,7 @@ import com.orientechnologies.orient.core.db.record.OIdentifiable; import java.util.*; +import java.util.stream.Collectors; public class OMultiMatchPathItem extends OMatchPathItem { protected List items = new ArrayList(); @@ -18,7 +19,9 @@ public OMultiMatchPathItem(OrientSql p, int id) { super(p, id); } - /** Accept the visitor. **/ + /** + * Accept the visitor. + **/ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { return visitor.visit(this, data); } @@ -58,5 +61,33 @@ protected Iterable traversePatternEdge(OMatchStatement.MatchConte } return result; } + + @Override public OMultiMatchPathItem copy() { + OMultiMatchPathItem result = (OMultiMatchPathItem) super.copy(); + result.items = items == null ? null : items.stream().map(x -> x.copy()).collect(Collectors.toList()); + return result; + } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + if (!super.equals(o)) + return false; + + OMultiMatchPathItem that = (OMultiMatchPathItem) o; + + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (items != null ? items.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=f18f107768de80b8941f166d7fafb3c0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONamedParameter.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONamedParameter.java index 33f0ba9c31b..53608e5aa5d 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONamedParameter.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONamedParameter.java @@ -60,5 +60,27 @@ public Object bindFromInputParams(Map params) { result.paramNumber = paramNumber; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ONamedParameter that = (ONamedParameter) o; + + if (paramNumber != that.paramNumber) + return false; + if (paramName != null ? !paramName.equals(that.paramName) : that.paramName != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = paramNumber; + result = 31 * result + (paramName != null ? paramName.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=8a00a9cf51a15dd75202f6372257fc1c (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeOperator.java index fc46e1b124c..f51f3308549 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeOperator.java @@ -35,5 +35,13 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { @Override public ONeOperator copy() { return new ONeOperator(-1); } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=ac0ae426fb86c930dea83013ddc202ba (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONearOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONearOperator.java index ff174126ad7..ce296e7f249 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONearOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONearOperator.java @@ -33,5 +33,13 @@ public String toString() { @Override public ONearOperator copy() { return new ONearOperator(-1); } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=a79af9beed70f813658f38a0162320e0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeqOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeqOperator.java index 7baa99a09e9..b094c73a589 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeqOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONeqOperator.java @@ -35,5 +35,13 @@ public String toString() { @Override public ONeqOperator copy() { return new ONeqOperator(-1); } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=588c4112ae7d2c83239f97ab0d2d5989 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotBlock.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotBlock.java index 21408991ea2..731023f92bd 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotBlock.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotBlock.java @@ -109,5 +109,27 @@ public List getIndexedFunctionConditions(OClass iSchemaClass, result.negate = negate; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ONotBlock oNotBlock = (ONotBlock) o; + + if (negate != oNotBlock.negate) + return false; + if (sub != null ? !sub.equals(oNotBlock.sub) : oNotBlock.sub != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = sub != null ? sub.hashCode() : 0; + result = 31 * result + (negate ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=1926313b3f854235aaa20811c22d583b (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotInCondition.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotInCondition.java index f844bd793a3..028a3073cd9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotInCondition.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ONotInCondition.java @@ -137,5 +137,41 @@ protected List getExternalCalculationConditions() { return result; } + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ONotInCondition that = (ONotInCondition) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (operator != null ? !operator.equals(that.operator) : that.operator != null) + return false; + if (rightStatement != null ? !rightStatement.equals(that.rightStatement) : that.rightStatement != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + if (rightParam != null ? !rightParam.equals(that.rightParam) : that.rightParam != null) + return false; + if (rightMathExpression != null ? !rightMathExpression.equals(that.rightMathExpression) : that.rightMathExpression != null) + return false; + if (inputFinalValue != null ? !inputFinalValue.equals(that.inputFinalValue) : that.inputFinalValue != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (operator != null ? operator.hashCode() : 0); + result = 31 * result + (rightStatement != null ? rightStatement.hashCode() : 0); + result = 31 * result + (right != null ? right.hashCode() : 0); + result = 31 * result + (rightParam != null ? rightParam.hashCode() : 0); + result = 31 * result + (rightMathExpression != null ? rightMathExpression.hashCode() : 0); + result = 31 * result + (inputFinalValue != null ? inputFinalValue.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=8fb82bf72cc7d9cbdf2f9e2323ca8ee1 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOptimizeDatabaseStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOptimizeDatabaseStatement.java index c4456dd1aff..90016b29401 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOptimizeDatabaseStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOptimizeDatabaseStatement.java @@ -32,5 +32,23 @@ public OOptimizeDatabaseStatement(OrientSql p, int id) { result.options = options == null ? null : options.stream().map(OCommandLineOption::copy).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OOptimizeDatabaseStatement that = (OOptimizeDatabaseStatement) o; + + if (options != null ? !options.equals(that.options) : that.options != null) + return false; + + return true; + } + + @Override public int hashCode() { + return options != null ? options.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=b85d66f84bbae92224565361df9d0c91 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrBlock.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrBlock.java index 3dd07ee2cd4..0fd406b7c37 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrBlock.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrBlock.java @@ -156,5 +156,23 @@ public List flatten() { result.subBlocks = subBlocks.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OOrBlock oOrBlock = (OOrBlock) o; + + if (subBlocks != null ? !subBlocks.equals(oOrBlock.subBlocks) : oOrBlock.subBlocks != null) + return false; + + return true; + } + + @Override public int hashCode() { + return subBlocks != null ? subBlocks.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=98d3077303a598705894dbb7bd4e1573 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrderBy.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrderBy.java index 0cd6fda9550..0b3bcef26b2 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrderBy.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOrderBy.java @@ -66,5 +66,23 @@ public OOrderBy copy() { result.items = items == null ? null : items.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OOrderBy oOrderBy = (OOrderBy) o; + + if (items != null ? !items.equals(oOrderBy.items) : oOrderBy.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=d5529400217169f15e556e5dc6fe4f5b (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisBlock.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisBlock.java index 9ffa13ea7dd..7ccb0a7c1b6 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisBlock.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisBlock.java @@ -68,5 +68,23 @@ public void toString(Map params, StringBuilder builder) { result.subElement = subElement.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OParenthesisBlock that = (OParenthesisBlock) o; + + if (subElement != null ? !subElement.equals(that.subElement) : that.subElement != null) + return false; + + return true; + } + + @Override public int hashCode() { + return subElement != null ? subElement.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=9a16b6cf7d051382acb94c45067631a9 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisExpression.java index c3f6e24a912..49ce79bf7a4 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisExpression.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisExpression.java @@ -108,5 +108,30 @@ public SimpleNode splitForAggregation(AggregateProjectionSplit aggregateProj) { result.statement = statement == null ? null : statement.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + if (!super.equals(o)) + return false; + + OParenthesisExpression that = (OParenthesisExpression) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + if (statement != null ? !statement.equals(that.statement) : that.statement != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (expression != null ? expression.hashCode() : 0); + result = 31 * result + (statement != null ? statement.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=4656e5faf4f54dc3fc45a06d8e375c35 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPermission.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPermission.java index 94e52a22faf..400e19d3599 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPermission.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPermission.java @@ -24,5 +24,23 @@ public OPermission(OrientSql p, int id) { result.permission = permission; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OPermission that = (OPermission) o; + + if (permission != null ? !permission.equals(that.permission) : that.permission != null) + return false; + + return true; + } + + @Override public int hashCode() { + return permission != null ? permission.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=576b31633bf93fdbc597f7448fc3c3b3 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPositionalParameter.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPositionalParameter.java index a8e5ae4ac4d..be2fac69bb9 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPositionalParameter.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OPositionalParameter.java @@ -56,5 +56,23 @@ public Object bindFromInputParams(Map params) { result.paramNumber = paramNumber; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OPositionalParameter that = (OPositionalParameter) o; + + if (paramNumber != that.paramNumber) + return false; + + return true; + } + + @Override public int hashCode() { + return paramNumber; + } } /* JavaCC - OriginalChecksum=f73bea7d9b3994a9d4e79d2c330d8ba2 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProfileStorageStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProfileStorageStatement.java index 1e6e00d58eb..aaabd1a25e3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProfileStorageStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProfileStorageStatement.java @@ -78,6 +78,24 @@ public void toString(Map params, StringBuilder builder) { result.on = on; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OProfileStorageStatement that = (OProfileStorageStatement) o; + + if (on != that.on) + return false; + + return true; + } + + @Override public int hashCode() { + return (on ? 1 : 0); + } } /* JavaCC - OriginalChecksum=645887712797ae14a17820bfa944f78e (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java index 81d43c6c761..fcc3b7d3389 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java @@ -132,5 +132,23 @@ public OProjection copy() { } return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OProjection that = (OProjection) o; + + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=3a650307b53bae626dc063c4b35e62c3 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjectionItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjectionItem.java index e7ada9bc688..8b315300455 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjectionItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjectionItem.java @@ -170,5 +170,33 @@ public OProjectionItem copy() { result.aggregate = aggregate; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OProjectionItem that = (OProjectionItem) o; + + if (all != that.all) + return false; + if (alias != null ? !alias.equals(that.alias) : that.alias != null) + return false; + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + if (aggregate != null ? !aggregate.equals(that.aggregate) : that.aggregate != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = (all ? 1 : 0); + result = 31 * result + (alias != null ? alias.hashCode() : 0); + result = 31 * result + (expression != null ? expression.hashCode() : 0); + result = 31 * result + (aggregate != null ? aggregate.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=6d6010734c7434a6f516e2eac308e9ce (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORebuildIndexStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORebuildIndexStatement.java index 094428c4611..98c2afa44e5 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORebuildIndexStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORebuildIndexStatement.java @@ -32,5 +32,27 @@ public ORebuildIndexStatement(OrientSql p, int id) { result.name = name == null ? null : name.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ORebuildIndexStatement that = (ORebuildIndexStatement) o; + + if (all != that.all) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = (all ? 1 : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=baca3c54112f1c08700ebdb691fa85bd (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORecordAttribute.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORecordAttribute.java index 86187f1fca8..0ebf6ba0ba8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORecordAttribute.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORecordAttribute.java @@ -32,5 +32,23 @@ public ORecordAttribute copy() { result.name = name; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ORecordAttribute that = (ORecordAttribute) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + return name != null ? name.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=45ce3cd16399dec7d7ef89f8920d02ae (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OResourcePathItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OResourcePathItem.java index 2989683bd1c..daa63f69514 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OResourcePathItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OResourcePathItem.java @@ -34,5 +34,30 @@ public OResourcePathItem(OrientSql p, int id) { result.name = name; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OResourcePathItem that = (OResourcePathItem) o; + + if (star != that.star) + return false; + if (identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = (star ? 1 : 0); + result = 31 * result + (identifier != null ? identifier.hashCode() : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=b90ccdd61b6adcd40cde2adee353e89f (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORetry.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORetry.java index 902cc50ca81..663c13f023b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORetry.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORetry.java @@ -2,8 +2,7 @@ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.orientechnologies.orient.core.sql.parser; -public -class ORetry extends SimpleNode { +public class ORetry extends SimpleNode { public ORetry(int id) { super(id); } @@ -12,10 +11,19 @@ public ORetry(OrientSql p, int id) { super(p, id); } - - /** Accept the visitor. **/ + /** + * Accept the visitor. + **/ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { return visitor.visit(this, data); } + + @Override public boolean equals(Object obj) { + return obj != null && getClass().equals(obj.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=2a27e5f409442f80d26204c901e017c1 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OReturnStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OReturnStatement.java index fd9688288be..af66613de6b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OReturnStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OReturnStatement.java @@ -28,5 +28,23 @@ public OReturnStatement(OrientSql p, int id) { result.expression = expression == null ? null : expression.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OReturnStatement that = (OReturnStatement) o; + + if (expression != null ? !expression.equals(that.expression) : that.expression != null) + return false; + + return true; + } + + @Override public int hashCode() { + return expression != null ? expression.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=c72ec860d1fa92cbf52e42ae1c2935c0 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORevokeStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORevokeStatement.java index adbb6790ee7..bed3b805705 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORevokeStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORevokeStatement.java @@ -45,5 +45,30 @@ public ORevokeStatement(OrientSql p, int id) { result.actor = actor == null ? null : actor.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ORevokeStatement that = (ORevokeStatement) o; + + if (permission != null ? !permission.equals(that.permission) : that.permission != null) + return false; + if (resourceChain != null ? !resourceChain.equals(that.resourceChain) : that.resourceChain != null) + return false; + if (actor != null ? !actor.equals(that.actor) : that.actor != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = permission != null ? permission.hashCode() : 0; + result = 31 * result + (resourceChain != null ? resourceChain.hashCode() : 0); + result = 31 * result + (actor != null ? actor.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=d483850d10e1562c1b942fcc249278eb (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORid.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORid.java index 1b7dd92920f..384cb2240ed 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORid.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/ORid.java @@ -43,5 +43,27 @@ public ORid copy() { result.position = position; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + ORid oRid = (ORid) o; + + if (cluster != null ? !cluster.equals(oRid.cluster) : oRid.cluster != null) + return false; + if (position != null ? !position.equals(oRid.position) : oRid.position != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = cluster != null ? cluster.hashCode() : 0; + result = 31 * result + (position != null ? position.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=c2c6d67d7722e29212e438574698d7cd (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OScAndOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OScAndOperator.java index e1044be0e58..eaa4920e88b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OScAndOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OScAndOperator.java @@ -47,5 +47,13 @@ public String toString() { result.lowLevelOperator = lowLevelOperator; return result; } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=12592a24f576571470ce760aff503b30 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSelectStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSelectStatement.java index ab58b59ec47..9e64c3dd28c 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSelectStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSelectStatement.java @@ -238,7 +238,12 @@ public OInternalExecutionPlan createExecutionPlan(OCommandContext ctx) { } @Override public OSelectStatement copy() { - OSelectStatement result = new OSelectStatement(-1); + OSelectStatement result = null; + try { + result = getClass().getConstructor(Integer.TYPE).newInstance(-1); + } catch (Exception e) { + throw new RuntimeException(e); + } result.target = target == null ? null : target.copy(); result.projection = projection == null ? null : projection.copy(); result.whereClause = whereClause == null ? null : whereClause.copy(); @@ -256,5 +261,63 @@ public OInternalExecutionPlan createExecutionPlan(OCommandContext ctx) { return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OSelectStatement that = (OSelectStatement) o; + + if (target != null ? !target.equals(that.target) : that.target != null) + return false; + if (projection != null ? !projection.equals(that.projection) : that.projection != null) + return false; + if (whereClause != null ? !whereClause.equals(that.whereClause) : that.whereClause != null) + return false; + if (groupBy != null ? !groupBy.equals(that.groupBy) : that.groupBy != null) + return false; + if (orderBy != null ? !orderBy.equals(that.orderBy) : that.orderBy != null) + return false; + if (unwind != null ? !unwind.equals(that.unwind) : that.unwind != null) + return false; + if (skip != null ? !skip.equals(that.skip) : that.skip != null) + return false; + if (limit != null ? !limit.equals(that.limit) : that.limit != null) + return false; + if (lockRecord != that.lockRecord) + return false; + if (fetchPlan != null ? !fetchPlan.equals(that.fetchPlan) : that.fetchPlan != null) + return false; + if (letClause != null ? !letClause.equals(that.letClause) : that.letClause != null) + return false; + if (timeout != null ? !timeout.equals(that.timeout) : that.timeout != null) + return false; + if (parallel != null ? !parallel.equals(that.parallel) : that.parallel != null) + return false; + if (noCache != null ? !noCache.equals(that.noCache) : that.noCache != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = target != null ? target.hashCode() : 0; + result = 31 * result + (projection != null ? projection.hashCode() : 0); + result = 31 * result + (whereClause != null ? whereClause.hashCode() : 0); + result = 31 * result + (groupBy != null ? groupBy.hashCode() : 0); + result = 31 * result + (orderBy != null ? orderBy.hashCode() : 0); + result = 31 * result + (unwind != null ? unwind.hashCode() : 0); + result = 31 * result + (skip != null ? skip.hashCode() : 0); + result = 31 * result + (limit != null ? limit.hashCode() : 0); + result = 31 * result + (lockRecord != null ? lockRecord.hashCode() : 0); + result = 31 * result + (fetchPlan != null ? fetchPlan.hashCode() : 0); + result = 31 * result + (letClause != null ? letClause.hashCode() : 0); + result = 31 * result + (timeout != null ? timeout.hashCode() : 0); + result = 31 * result + (parallel != null ? parallel.hashCode() : 0); + result = 31 * result + (noCache != null ? noCache.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=b26959b9726a8cf35d6283eca931da6b (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSkip.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSkip.java index 9fd71d57264..595c11e2440 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSkip.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSkip.java @@ -61,5 +61,27 @@ public OSkip copy() { result.inputParam = inputParam == null ? null : inputParam.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OSkip oSkip = (OSkip) o; + + if (num != null ? !num.equals(oSkip.num) : oSkip.num != null) + return false; + if (inputParam != null ? !inputParam.equals(oSkip.inputParam) : oSkip.inputParam != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = num != null ? num.hashCode() : 0; + result = 31 * result + (inputParam != null ? inputParam.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=8e13ca184705a8fc1b5939ecefe56a60 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSleepStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSleepStatement.java index de8b5368f16..c0f9854c7a1 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSleepStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSleepStatement.java @@ -26,5 +26,23 @@ public OSleepStatement(OrientSql p, int id) { result.millis = millis == null ? null : millis.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OSleepStatement that = (OSleepStatement) o; + + if (millis != null ? !millis.equals(that.millis) : that.millis != null) + return false; + + return true; + } + + @Override public int hashCode() { + return millis != null ? millis.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=2ea765ee266d4215414908b0e09c0779 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSuffixIdentifier.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSuffixIdentifier.java index a433878ca79..cbff9d3f97a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSuffixIdentifier.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OSuffixIdentifier.java @@ -168,5 +168,30 @@ public OSuffixIdentifier copy() { result.star = star; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OSuffixIdentifier that = (OSuffixIdentifier) o; + + if (star != that.star) + return false; + if (identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) + return false; + if (recordAttribute != null ? !recordAttribute.equals(that.recordAttribute) : that.recordAttribute != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = identifier != null ? identifier.hashCode() : 0; + result = 31 * result + (recordAttribute != null ? recordAttribute.hashCode() : 0); + result = 31 * result + (star ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=5d9be0188c7d6e2b67d691fb88a518f8 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTimeout.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTimeout.java index 35599019ac9..426fc364512 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTimeout.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTimeout.java @@ -40,5 +40,27 @@ public OTimeout copy() { result.failureStrategy = failureStrategy; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OTimeout timeout = (OTimeout) o; + + if (val != null ? !val.equals(timeout.val) : timeout.val != null) + return false; + if (failureStrategy != null ? !failureStrategy.equals(timeout.failureStrategy) : timeout.failureStrategy != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = val != null ? val.hashCode() : 0; + result = 31 * result + (failureStrategy != null ? failureStrategy.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=fef7f5d488f7fca1b6ad0b70c6841931 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseProjectionItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseProjectionItem.java index edae500ee17..0b111cb57a5 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseProjectionItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseProjectionItem.java @@ -44,5 +44,30 @@ public OTraverseProjectionItem copy() { result.modifier = modifier == null ? null : modifier.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OTraverseProjectionItem that = (OTraverseProjectionItem) o; + + if (star != that.star) + return false; + if (base != null ? !base.equals(that.base) : that.base != null) + return false; + if (modifier != null ? !modifier.equals(that.modifier) : that.modifier != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = (star ? 1 : 0); + result = 31 * result + (base != null ? base.hashCode() : 0); + result = 31 * result + (modifier != null ? modifier.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=0c562254fd4d11266edc0504fd36fc99 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseStatement.java index 610ec6f0523..ecbab2ff9eb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseStatement.java @@ -88,5 +88,39 @@ public void toString(Map params, StringBuilder builder) { result.maxDepth = maxDepth == null ? null : maxDepth.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OTraverseStatement that = (OTraverseStatement) o; + + if (projections != null ? !projections.equals(that.projections) : that.projections != null) + return false; + if (target != null ? !target.equals(that.target) : that.target != null) + return false; + if (whereClause != null ? !whereClause.equals(that.whereClause) : that.whereClause != null) + return false; + if (limit != null ? !limit.equals(that.limit) : that.limit != null) + return false; + if (strategy != that.strategy) + return false; + if (maxDepth != null ? !maxDepth.equals(that.maxDepth) : that.maxDepth != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = projections != null ? projections.hashCode() : 0; + result = 31 * result + (target != null ? target.hashCode() : 0); + result = 31 * result + (whereClause != null ? whereClause.hashCode() : 0); + result = 31 * result + (limit != null ? limit.hashCode() : 0); + result = 31 * result + (strategy != null ? strategy.hashCode() : 0); + result = 31 * result + (maxDepth != null ? maxDepth.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=47399a3a3d5a423768bbdc70ee957464 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java index 32ba9c3bd2e..906da772912 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClassStatement.java @@ -42,5 +42,30 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { result.unsafe = unsafe; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OTruncateClassStatement that = (OTruncateClassStatement) o; + + if (polymorphic != that.polymorphic) + return false; + if (unsafe != that.unsafe) + return false; + if (className != null ? !className.equals(that.className) : that.className != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = className != null ? className.hashCode() : 0; + result = 31 * result + (polymorphic ? 1 : 0); + result = 31 * result + (unsafe ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=301f993f6ba2893cb30c8f189674b974 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClusterStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClusterStatement.java index 7bd5e8f9915..fe2fd030810 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClusterStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateClusterStatement.java @@ -44,5 +44,30 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { result.unsafe = unsafe; return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OTruncateClusterStatement that = (OTruncateClusterStatement) o; + + if (unsafe != that.unsafe) + return false; + if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) + return false; + if (clusterNumber != null ? !clusterNumber.equals(that.clusterNumber) : that.clusterNumber != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = clusterName != null ? clusterName.hashCode() : 0; + result = 31 * result + (clusterNumber != null ? clusterNumber.hashCode() : 0); + result = 31 * result + (unsafe ? 1 : 0); + return result; + } } /* JavaCC - OriginalChecksum=301f993f6ba2893cb30c8f189674b974 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateRecordStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateRecordStatement.java index b2175d567e9..eb019c8352a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateRecordStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTruncateRecordStatement.java @@ -42,5 +42,27 @@ public OTruncateRecordStatement(OrientSql p, int id) { result.records = records == null ? null : records.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OTruncateRecordStatement that = (OTruncateRecordStatement) o; + + if (record != null ? !record.equals(that.record) : that.record != null) + return false; + if (records != null ? !records.equals(that.records) : that.records != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = record != null ? record.hashCode() : 0; + result = 31 * result + (records != null ? records.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=9da68e9fe4c4bf94a12d8a6f8864097a (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUnwind.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUnwind.java index 12c135485f2..0ec0c232537 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUnwind.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUnwind.java @@ -41,5 +41,23 @@ public OUnwind copy() { result.items = items.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUnwind oUnwind = (OUnwind) o; + + if (items != null ? !items.equals(oUnwind.items) : oUnwind.items != null) + return false; + + return true; + } + + @Override public int hashCode() { + return items != null ? items.hashCode() : 0; + } } /* JavaCC - OriginalChecksum=4739190aa6c1a3533a89b76a15bd6fdf (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateAddItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateAddItem.java index d2f6411d28e..4c54d2257ad 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateAddItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateAddItem.java @@ -28,5 +28,27 @@ public void toString(Map params, StringBuilder builder) { builder.append(" = "); right.toString(params, builder); } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUpdateAddItem that = (OUpdateAddItem) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=769679aa2d2d8df58a13210152b50a9d (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatement.java index abbd79cc0d9..cee54136aa3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateEdgeStatement.java @@ -38,5 +38,7 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { result.timeout = timeout == null ? null : timeout.copy(); return result; } + + } /* JavaCC - OriginalChecksum=496f32976ee84e3a3a89d1410dc134c5 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateIncrementItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateIncrementItem.java index 90c61f88a50..7e0c2d3b470 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateIncrementItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateIncrementItem.java @@ -40,5 +40,30 @@ public OUpdateIncrementItem copy() { result.right = right == null ? null : right.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUpdateIncrementItem that = (OUpdateIncrementItem) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (leftModifier != null ? !leftModifier.equals(that.leftModifier) : that.leftModifier != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (leftModifier != null ? leftModifier.hashCode() : 0); + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=94dd82febb904e4e31130bdcbbb48fe3 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateItem.java index 5e4e15c9405..98381c26750 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateItem.java @@ -65,5 +65,33 @@ public OUpdateItem copy() { result.right = right == null ? null : right.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUpdateItem that = (OUpdateItem) o; + + if (operator != that.operator) + return false; + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (leftModifier != null ? !leftModifier.equals(that.leftModifier) : that.leftModifier != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (leftModifier != null ? leftModifier.hashCode() : 0); + result = 31 * result + operator; + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=df7444be87bba741316df8df0d653600 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateOperations.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateOperations.java index 1bda5fbdf4e..3297af664e3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateOperations.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateOperations.java @@ -121,5 +121,39 @@ public OUpdateOperations copy() { updateRemoveItems == null ? null : updateRemoveItems.stream().map(x -> x.copy()).collect(Collectors.toList()); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUpdateOperations that = (OUpdateOperations) o; + + if (type != that.type) + return false; + if (updateItems != null ? !updateItems.equals(that.updateItems) : that.updateItems != null) + return false; + if (updatePutItems != null ? !updatePutItems.equals(that.updatePutItems) : that.updatePutItems != null) + return false; + if (json != null ? !json.equals(that.json) : that.json != null) + return false; + if (updateIncrementItems != null ? !updateIncrementItems.equals(that.updateIncrementItems) : that.updateIncrementItems != null) + return false; + if (updateRemoveItems != null ? !updateRemoveItems.equals(that.updateRemoveItems) : that.updateRemoveItems != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = type; + result = 31 * result + (updateItems != null ? updateItems.hashCode() : 0); + result = 31 * result + (updatePutItems != null ? updatePutItems.hashCode() : 0); + result = 31 * result + (json != null ? json.hashCode() : 0); + result = 31 * result + (updateIncrementItems != null ? updateIncrementItems.hashCode() : 0); + result = 31 * result + (updateRemoveItems != null ? updateRemoveItems.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=0eca3b3e4e3d96c42db57b7cd89cf755 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdatePutItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdatePutItem.java index 241dcff7833..d88c1751c29 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdatePutItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdatePutItem.java @@ -40,5 +40,30 @@ public OUpdatePutItem copy() { result.value = value == null ? null : value.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUpdatePutItem that = (OUpdatePutItem) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (key != null ? !key.equals(that.key) : that.key != null) + return false; + if (value != null ? !value.equals(that.value) : that.value != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (key != null ? key.hashCode() : 0); + result = 31 * result + (value != null ? value.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=a38339c33ebf0a8b21e76ddb278f4958 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateRemoveItem.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateRemoveItem.java index d7a4666ee68..2128e3d97bf 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateRemoveItem.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateRemoveItem.java @@ -38,5 +38,27 @@ public OUpdateRemoveItem copy() { result.right = right == null ? null : right.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUpdateRemoveItem that = (OUpdateRemoveItem) o; + + if (left != null ? !left.equals(that.left) : that.left != null) + return false; + if (right != null ? !right.equals(that.right) : that.right != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=72e240d3dc1196fdea69e8fdc2bd69ca (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatement.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatement.java index e15e78c25eb..24947dcecdb 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatement.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateStatement.java @@ -97,7 +97,13 @@ protected String getStatementType() { } @Override public OUpdateStatement copy() { - OUpdateStatement result = new OUpdateStatement(-1); + OUpdateStatement result = null; + try { + result = getClass().getConstructor(Integer.TYPE).newInstance(-1); + } catch (Exception e) { + throw new RuntimeException(e); + } + result.target = target == null ? null : target.copy(); result.operations = operations == null ? null : operations.stream().map(x -> x.copy()).collect(Collectors.toList()); result.upsert = upsert; @@ -110,5 +116,51 @@ protected String getStatementType() { result.timeout = timeout == null ? null : timeout.copy(); return result; } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OUpdateStatement that = (OUpdateStatement) o; + + if (upsert != that.upsert) + return false; + if (returnBefore != that.returnBefore) + return false; + if (returnAfter != that.returnAfter) + return false; + if (target != null ? !target.equals(that.target) : that.target != null) + return false; + if (operations != null ? !operations.equals(that.operations) : that.operations != null) + return false; + if (returnProjection != null ? !returnProjection.equals(that.returnProjection) : that.returnProjection != null) + return false; + if (whereClause != null ? !whereClause.equals(that.whereClause) : that.whereClause != null) + return false; + if (lockRecord != that.lockRecord) + return false; + if (limit != null ? !limit.equals(that.limit) : that.limit != null) + return false; + if (timeout != null ? !timeout.equals(that.timeout) : that.timeout != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = target != null ? target.hashCode() : 0; + result = 31 * result + (operations != null ? operations.hashCode() : 0); + result = 31 * result + (upsert ? 1 : 0); + result = 31 * result + (returnBefore ? 1 : 0); + result = 31 * result + (returnAfter ? 1 : 0); + result = 31 * result + (returnProjection != null ? returnProjection.hashCode() : 0); + result = 31 * result + (whereClause != null ? whereClause.hashCode() : 0); + result = 31 * result + (lockRecord != null ? lockRecord.hashCode() : 0); + result = 31 * result + (limit != null ? limit.hashCode() : 0); + result = 31 * result + (timeout != null ? timeout.hashCode() : 0); + return result; + } } /* JavaCC - OriginalChecksum=093091d7273f1073ad49f2a2bf709a53 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWait.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWait.java index ff46fb13eec..4575de0a029 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWait.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWait.java @@ -2,8 +2,10 @@ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.orientechnologies.orient.core.sql.parser; -public -class OWait extends SimpleNode { +public class OWait extends SimpleNode { + + Object value; + public OWait(int id) { super(id); } @@ -12,10 +14,13 @@ public OWait(OrientSql p, int id) { super(p, id); } - - /** Accept the visitor. **/ + /** + * Accept the visitor. + **/ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { return visitor.visit(this, data); } + + } /* JavaCC - OriginalChecksum=e77b1496216c4d2b2f8ad564da0c3dac (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWhereClause.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWhereClause.java index bf1742c84e7..ce5d8d4b644 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWhereClause.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWhereClause.java @@ -268,6 +268,10 @@ public boolean containsSubqueries() { return false; } + public void setBaseExpression(OBooleanExpression baseExpression) { + this.baseExpression = baseExpression; + } + public OWhereClause copy() { OWhereClause result = new OWhereClause(-1); result.baseExpression = baseExpression.copy(); @@ -275,8 +279,26 @@ public OWhereClause copy() { return result; } - public void setBaseExpression(OBooleanExpression baseExpression) { - this.baseExpression = baseExpression; + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + OWhereClause that = (OWhereClause) o; + + if (baseExpression != null ? !baseExpression.equals(that.baseExpression) : that.baseExpression != null) + return false; + if (flattened != null ? !flattened.equals(that.flattened) : that.flattened != null) + return false; + + return true; + } + + @Override public int hashCode() { + int result = baseExpression != null ? baseExpression.hashCode() : 0; + result = 31 * result + (flattened != null ? flattened.hashCode() : 0); + return result; } } /* JavaCC - OriginalChecksum=e8015d01ce1ab2bc337062e9e3f2603e (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWithinOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWithinOperator.java index 7485d6a6c34..58526ed5957 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWithinOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OWithinOperator.java @@ -33,5 +33,13 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { @Override public OWithinOperator copy() { return new OWithinOperator(-1); } + + @Override public boolean equals(Object obj) { + return obj != null && obj.getClass().equals(this.getClass()); + } + + @Override public int hashCode() { + return getClass().hashCode(); + } } /* JavaCC - OriginalChecksum=e627b2d87bdac6de681d462e4b764288 (do not edit this line) */