You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/07/03 14:10:12 UTC

svn commit: r1607598 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/CHANGES.txt lucene/core/ lucene/core/src/java/org/apache/lucene/document/FieldType.java lucene/core/src/test/org/apache/lucene/document/TestFieldType.java

Author: rmuir
Date: Thu Jul  3 12:10:12 2014
New Revision: 1607598

URL: http://svn.apache.org/r1607598
Log:
LUCENE-5793: add equals/hashCode to FieldType

Added:
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java
      - copied unchanged from r1607595, lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java
Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/document/FieldType.java

Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1607598&r1=1607597&r2=1607598&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Thu Jul  3 12:10:12 2014
@@ -18,6 +18,8 @@ API Changes
 
 * LUCENE-5752: Simplified Automaton API to be immutable. (Mike McCandless)
 
+* LUCENE-5793: Add equals/hashCode to FieldType. (Shay Banon, Robert Muir)
+
 Optimizations
 
 * LUCENE-5780: Make OrdinalMap more memory-efficient, especially in case the

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/document/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/document/FieldType.java?rev=1607598&r1=1607597&r2=1607598&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/document/FieldType.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/document/FieldType.java Thu Jul  3 12:10:12 2014
@@ -432,4 +432,44 @@ public class FieldType implements Indexa
     checkIfFrozen();
     docValueType = type;
   }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((docValueType == null) ? 0 : docValueType.hashCode());
+    result = prime * result + ((indexOptions == null) ? 0 : indexOptions.hashCode());
+    result = prime * result + (indexed ? 1231 : 1237);
+    result = prime * result + numericPrecisionStep;
+    result = prime * result + ((numericType == null) ? 0 : numericType.hashCode());
+    result = prime * result + (omitNorms ? 1231 : 1237);
+    result = prime * result + (storeTermVectorOffsets ? 1231 : 1237);
+    result = prime * result + (storeTermVectorPayloads ? 1231 : 1237);
+    result = prime * result + (storeTermVectorPositions ? 1231 : 1237);
+    result = prime * result + (storeTermVectors ? 1231 : 1237);
+    result = prime * result + (stored ? 1231 : 1237);
+    result = prime * result + (tokenized ? 1231 : 1237);
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) return true;
+    if (obj == null) return false;
+    if (getClass() != obj.getClass()) return false;
+    FieldType other = (FieldType) obj;
+    if (docValueType != other.docValueType) return false;
+    if (indexOptions != other.indexOptions) return false;
+    if (indexed != other.indexed) return false;
+    if (numericPrecisionStep != other.numericPrecisionStep) return false;
+    if (numericType != other.numericType) return false;
+    if (omitNorms != other.omitNorms) return false;
+    if (storeTermVectorOffsets != other.storeTermVectorOffsets) return false;
+    if (storeTermVectorPayloads != other.storeTermVectorPayloads) return false;
+    if (storeTermVectorPositions != other.storeTermVectorPositions) return false;
+    if (storeTermVectors != other.storeTermVectors) return false;
+    if (stored != other.stored) return false;
+    if (tokenized != other.tokenized) return false;
+    return true;
+  }
 }