lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1209562 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/FieldInfos.java
Date Fri, 02 Dec 2011 16:26:16 GMT
Author: rmuir
Date: Fri Dec  2 16:26:16 2011
New Revision: 1209562

URL: http://svn.apache.org/viewvc?rev=1209562&view=rev
Log:
LUCENE-3612: remove dead code

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/FieldInfos.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/FieldInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/FieldInfos.java?rev=1209562&r1=1209561&r2=1209562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/FieldInfos.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/FieldInfos.java Fri Dec  2 16:26:16
2011
@@ -17,23 +17,15 @@ package org.apache.lucene.index;
  * limitations under the License.
  */
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
-import java.util.Map.Entry;
 
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.values.ValueType;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.util.CodecUtil;
 
 /** Access to the Field Info file that describes document fields and whether or
  *  not they are indexed. Each segment has a separate Field Info file. Objects
@@ -45,18 +37,9 @@ import org.apache.lucene.util.CodecUtil;
 public final class FieldInfos implements Iterable<FieldInfo> {
   static final class FieldNumberBiMap {
     
-    final static String CODEC_NAME = "GLOBAL_FIELD_MAP";
-    
-    // Initial format
-    private static final int VERSION_START = 0;
-
-    private static final int VERSION_CURRENT = VERSION_START;
-
     private final Map<Integer,String> numberToName;
     private final Map<String,Integer> nameToNumber;
     private int lowestUnassignedFieldNumber = -1;
-    private long lastVersion = 0;
-    private long version = 0;
     
     FieldNumberBiMap() {
       this.nameToNumber = new HashMap<String, Integer>();
@@ -85,7 +68,6 @@ public final class FieldInfos implements
           fieldNumber = lowestUnassignedFieldNumber;
         }
         
-        version++;
         numberToName.put(fieldNumber, fieldName);
         nameToNumber.put(fieldName, fieldNumber);
         
@@ -101,7 +83,6 @@ public final class FieldInfos implements
       final Integer boxedFieldNumber = Integer.valueOf(fieldNumber);
       if (!numberToName.containsKey(boxedFieldNumber)
           && !nameToNumber.containsKey(fieldName)) {
-        version++;
         numberToName.put(boxedFieldNumber, fieldName);
         nameToNumber.put(fieldName, boxedFieldNumber);
       } else {
@@ -109,70 +90,6 @@ public final class FieldInfos implements
       }
     }
     
-    /**
-     * Writes this {@link FieldNumberBiMap} to the given output and returns its
-     * version.
-     */
-    public synchronized long write(IndexOutput output) throws IOException{
-      Set<Entry<String, Integer>> entrySet = nameToNumber.entrySet();
-      CodecUtil.writeHeader(output, CODEC_NAME, VERSION_CURRENT); 
-      output.writeVInt(entrySet.size());
-      for (Entry<String, Integer> entry : entrySet) {
-        output.writeVInt(entry.getValue().intValue());
-        output.writeString(entry.getKey());
-      }
-      return version;
-    }
-
-    /**
-     * Reads the {@link FieldNumberBiMap} from the given input and resets the
-     * version to 0.
-     */
-    public synchronized void read(IndexInput input) throws IOException{
-      CodecUtil.checkHeader(input, CODEC_NAME,
-          VERSION_START,
-          VERSION_CURRENT);
-      final int size = input.readVInt();
-      for (int i = 0; i < size; i++) {
-        final int num = input.readVInt();
-        final String name = input.readString();
-        setIfNotSet(num, name);
-      }
-      version = lastVersion = 0;
-    }
-    
-    /**
-     * Returns <code>true</code> iff the last committed version differs from
the
-     * current version, otherwise <code>false</code>
-     * 
-     * @return <code>true</code> iff the last committed version differs from
the
-     *         current version, otherwise <code>false</code>
-     */
-    public synchronized boolean isDirty() {
-      return lastVersion != version;
-    }
-    
-    /**
-     * commits the given version if the given version is greater than the previous committed
version
-     * 
-     * @param version
-     *          the version to commit
-     * @return <code>true</code> iff the version was successfully committed otherwise
<code>false</code>
-     * @see #write(IndexOutput)
-     */
-    public synchronized boolean commitLastVersion(long version) {
-      if (version > lastVersion) {
-        lastVersion = version;
-        return true;
-      }
-      return false;
-    }
-    
-    // just for testing
-    Set<Entry<String, Integer>> entries() {
-      return new HashSet<Entry<String, Integer>>(nameToNumber.entrySet());
-    }
-    
     // used by assert
     synchronized boolean containsConsistent(Integer number, String name) {
       return name.equals(numberToName.get(number))



Mime
View raw message