org.apache.lucene.memory_2.9.1.v20100421-0704

16:41:12.364 INFO  jd.cli.Main - Decompiling org.apache.lucene.memory_2.9.1.v20100421-0704.jar
package org.apache.lucene.index.memory;

import java.io.IOException;
import java.io.PrintStream;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;

class AnalyzerUtil$1$1
  extends TokenFilter
{
  AnalyzerUtil$1$1(AnalyzerUtil.1 param1, TokenStream x0, String paramString)
  {
    super(x0);
  }
  
  private int position = -1;
  private TermAttribute termAtt = (TermAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TermAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TermAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.TermAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TermAttribute);
  private PositionIncrementAttribute posIncrAtt = (PositionIncrementAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$PositionIncrementAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$PositionIncrementAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$PositionIncrementAttribute);
  private OffsetAttribute offsetAtt = (OffsetAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.OffsetAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute);
  private TypeAttribute typeAtt = (TypeAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TypeAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TypeAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.TypeAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TypeAttribute);
  private final AnalyzerUtil.1 this$0;
  
  public boolean incrementToken()
    throws IOException
  {
    boolean hasNext = input.incrementToken();
    AnalyzerUtil.1.access$000(this$0).println(toString(hasNext));
    return hasNext;
  }
  
  private String toString(boolean hasNext)
  {
    if (!hasNext) {
      return "[" + AnalyzerUtil.1.access$100(this$0) + ":EOS:" + val$fieldName + "]\n";
    }
    position += posIncrAtt.getPositionIncrement();
    return "[" + AnalyzerUtil.1.access$100(this$0) + ":" + position + ":" + val$fieldName + ":" + termAtt.term() + ":" + offsetAtt.startOffset() + "-" + offsetAtt.endOffset() + ":" + typeAtt.type() + "]";
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.1.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;

final class AnalyzerUtil$1
  extends Analyzer
{
  private final Analyzer val$child;
  
  AnalyzerUtil$1(Analyzer paramAnalyzer, PrintStream paramPrintStream, String paramString) {}
  
  public TokenStream tokenStream(final String fieldName, Reader reader)
  {
    new TokenFilter(val$child.tokenStream(fieldName, reader))
    {
      private int position = -1;
      private TermAttribute termAtt = (TermAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TermAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TermAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.TermAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TermAttribute);
      private PositionIncrementAttribute posIncrAtt = (PositionIncrementAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$PositionIncrementAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$PositionIncrementAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$PositionIncrementAttribute);
      private OffsetAttribute offsetAtt = (OffsetAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.OffsetAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute);
      private TypeAttribute typeAtt = (TypeAttribute)addAttribute(AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TypeAttribute == null ? (AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TypeAttribute = AnalyzerUtil.class$("org.apache.lucene.analysis.tokenattributes.TypeAttribute")) : AnalyzerUtil.class$org$apache$lucene$analysis$tokenattributes$TypeAttribute);
      
      public boolean incrementToken()
        throws IOException
      {
        boolean hasNext = input.incrementToken();
        val$log.println(toString(hasNext));
        return hasNext;
      }
      
      private String toString(boolean hasNext)
      {
        if (!hasNext) {
          return "[" + val$logName + ":EOS:" + fieldName + "]\n";
        }
        position += posIncrAtt.getPositionIncrement();
        return "[" + val$logName + ":" + position + ":" + fieldName + ":" + termAtt.term() + ":" + offsetAtt.startOffset() + "-" + offsetAtt.endOffset() + ":" + typeAtt.type() + "]";
      }
    };
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;

class AnalyzerUtil$2$1
  extends TokenFilter
{
  AnalyzerUtil$2$1(AnalyzerUtil.2 param2, TokenStream x0)
  {
    super(x0);
  }
  
  private int todo = AnalyzerUtil.2.access$200(this$0);
  private final AnalyzerUtil.2 this$0;
  
  public boolean incrementToken()
    throws IOException
  {
    return --todo >= 0 ? input.incrementToken() : false;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.2.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;

final class AnalyzerUtil$2
  extends Analyzer
{
  private final Analyzer val$child;
  
  AnalyzerUtil$2(Analyzer paramAnalyzer, int paramInt) {}
  
  public TokenStream tokenStream(String fieldName, Reader reader)
  {
    new TokenFilter(val$child.tokenStream(fieldName, reader))
    {
      private int todo = val$maxTokens;
      
      public boolean incrementToken()
        throws IOException
      {
        return --todo >= 0 ? input.incrementToken() : false;
      }
    };
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.PorterStemFilter;
import org.apache.lucene.analysis.TokenStream;

final class AnalyzerUtil$3
  extends Analyzer
{
  private final Analyzer val$child;
  
  AnalyzerUtil$3(Analyzer paramAnalyzer) {}
  
  public TokenStream tokenStream(String fieldName, Reader reader)
  {
    return new PorterStemFilter(val$child.tokenStream(fieldName, reader));
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;

final class AnalyzerUtil$4
  extends Analyzer
{
  private final Analyzer val$child;
  
  AnalyzerUtil$4(Analyzer paramAnalyzer, SynonymMap paramSynonymMap, int paramInt) {}
  
  public TokenStream tokenStream(String fieldName, Reader reader)
  {
    return new SynonymTokenFilter(val$child.tokenStream(fieldName, reader), val$synonyms, val$maxSynonyms);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.4
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import java.util.ArrayList;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;

class AnalyzerUtil$5$1
  extends TokenFilter
{
  private final AnalyzerUtil.5 this$0;
  
  AnalyzerUtil$5$1(AnalyzerUtil.5 param5, TokenStream x0, ArrayList paramArrayList)
  {
    super(x0);
  }
  
  public boolean incrementToken()
    throws IOException
  {
    boolean hasNext = input.incrementToken();
    if (hasNext) {
      val$tokens2.add(captureState());
    }
    return hasNext;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.5.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.util.ArrayList;
import java.util.Iterator;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.util.AttributeSource.State;

class AnalyzerUtil$5$2
  extends TokenStream
{
  private Iterator iter = val$tokens.iterator();
  private final AnalyzerUtil.5 this$0;
  
  AnalyzerUtil$5$2(AnalyzerUtil.5 param5, ArrayList paramArrayList) {}
  
  public boolean incrementToken()
  {
    if (!iter.hasNext()) {
      return false;
    }
    restoreState((AttributeSource.State)iter.next());
    return true;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.5.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.util.AttributeSource.State;

final class AnalyzerUtil$5
  extends Analyzer
{
  private final HashMap cache = new HashMap();
  private final Analyzer val$child;
  
  AnalyzerUtil$5(Analyzer paramAnalyzer) {}
  
  public TokenStream tokenStream(String fieldName, Reader reader)
  {
    final ArrayList tokens = (ArrayList)cache.get(fieldName);
    if (tokens == null)
    {
      final ArrayList tokens2 = new ArrayList();
      TokenStream tokenStream = new TokenFilter(val$child.tokenStream(fieldName, reader))
      {
        public boolean incrementToken()
          throws IOException
        {
          boolean hasNext = input.incrementToken();
          if (hasNext) {
            tokens2.add(captureState());
          }
          return hasNext;
        }
      };
      cache.put(fieldName, tokens2);
      return tokenStream;
    }
    new TokenStream()
    {
      private Iterator iter = tokens.iterator();
      
      public boolean incrementToken()
      {
        if (!iter.hasNext()) {
          return false;
        }
        restoreState((AttributeSource.State)iter.next());
        return true;
      }
    };
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.5
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.util.Comparator;
import java.util.Map.Entry;

final class AnalyzerUtil$6
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    Map.Entry e1 = (Map.Entry)o1;
    Map.Entry e2 = (Map.Entry)o2;
    int f1 = ((AnalyzerUtil.MutableInteger)e1.getValue()).intValue();
    int f2 = ((AnalyzerUtil.MutableInteger)e2.getValue()).intValue();
    if (f2 - f1 != 0) {
      return f2 - f1;
    }
    String s1 = (String)e1.getKey();
    String s2 = (String)e2.getKey();
    return s1.compareTo(s2);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.6
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

final class AnalyzerUtil$MutableInteger
{
  private int value;
  
  public AnalyzerUtil$MutableInteger(int value)
  {
    this.value = value;
  }
  
  public int intValue()
  {
    return value;
  }
  
  public void setValue(int value)
  {
    this.value = value;
  }
  
  public String toString()
  {
    return String.valueOf(value);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil.MutableInteger
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Pattern;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.PorterStemFilter;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
import org.apache.lucene.util.AttributeSource.State;

public class AnalyzerUtil
{
  public static Analyzer getLoggingAnalyzer(Analyzer child, final PrintStream log, final String logName)
  {
    if (child == null) {
      throw new IllegalArgumentException("child analyzer must not be null");
    }
    if (log == null) {
      throw new IllegalArgumentException("logStream must not be null");
    }
    new Analyzer()
    {
      private final Analyzer val$child;
      
      public TokenStream tokenStream(final String fieldName, Reader reader)
      {
        new TokenFilter(val$child.tokenStream(fieldName, reader))
        {
          private int position = -1;
          private TermAttribute termAtt = (TermAttribute)addAttribute(TermAttribute.class);
          private PositionIncrementAttribute posIncrAtt = (PositionIncrementAttribute)addAttribute(PositionIncrementAttribute.class);
          private OffsetAttribute offsetAtt = (OffsetAttribute)addAttribute(OffsetAttribute.class);
          private TypeAttribute typeAtt = (TypeAttribute)addAttribute(TypeAttribute.class);
          
          public boolean incrementToken()
            throws IOException
          {
            boolean hasNext = input.incrementToken();
            val$log.println(toString(hasNext));
            return hasNext;
          }
          
          private String toString(boolean hasNext)
          {
            if (!hasNext) {
              return "[" + val$logName + ":EOS:" + fieldName + "]\n";
            }
            position += posIncrAtt.getPositionIncrement();
            return "[" + val$logName + ":" + position + ":" + fieldName + ":" + termAtt.term() + ":" + offsetAtt.startOffset() + "-" + offsetAtt.endOffset() + ":" + typeAtt.type() + "]";
          }
        };
      }
    };
  }
  
  public static Analyzer getMaxTokenAnalyzer(Analyzer child, final int maxTokens)
  {
    if (child == null) {
      throw new IllegalArgumentException("child analyzer must not be null");
    }
    if (maxTokens < 0) {
      throw new IllegalArgumentException("maxTokens must not be negative");
    }
    if (maxTokens == Integer.MAX_VALUE) {
      return child;
    }
    new Analyzer()
    {
      private final Analyzer val$child;
      
      public TokenStream tokenStream(String fieldName, Reader reader)
      {
        new TokenFilter(val$child.tokenStream(fieldName, reader))
        {
          private int todo = val$maxTokens;
          
          public boolean incrementToken()
            throws IOException
          {
            return --todo >= 0 ? input.incrementToken() : false;
          }
        };
      }
    };
  }
  
  public static Analyzer getPorterStemmerAnalyzer(Analyzer child)
  {
    if (child == null) {
      throw new IllegalArgumentException("child analyzer must not be null");
    }
    new Analyzer()
    {
      private final Analyzer val$child;
      
      public TokenStream tokenStream(String fieldName, Reader reader)
      {
        return new PorterStemFilter(val$child.tokenStream(fieldName, reader));
      }
    };
  }
  
  public static Analyzer getSynonymAnalyzer(Analyzer child, final SynonymMap synonyms, final int maxSynonyms)
  {
    if (child == null) {
      throw new IllegalArgumentException("child analyzer must not be null");
    }
    if (synonyms == null) {
      throw new IllegalArgumentException("synonyms must not be null");
    }
    if (maxSynonyms < 0) {
      throw new IllegalArgumentException("maxSynonyms must not be negative");
    }
    if (maxSynonyms == 0) {
      return child;
    }
    new Analyzer()
    {
      private final Analyzer val$child;
      
      public TokenStream tokenStream(String fieldName, Reader reader)
      {
        return new SynonymTokenFilter(val$child.tokenStream(fieldName, reader), synonyms, maxSynonyms);
      }
    };
  }
  
  public static Analyzer getTokenCachingAnalyzer(Analyzer child)
  {
    if (child == null) {
      throw new IllegalArgumentException("child analyzer must not be null");
    }
    new Analyzer()
    {
      private final HashMap cache = new HashMap();
      private final Analyzer val$child;
      
      public TokenStream tokenStream(String fieldName, Reader reader)
      {
        final ArrayList tokens = (ArrayList)cache.get(fieldName);
        if (tokens == null)
        {
          final ArrayList tokens2 = new ArrayList();
          TokenStream tokenStream = new TokenFilter(val$child.tokenStream(fieldName, reader))
          {
            public boolean incrementToken()
              throws IOException
            {
              boolean hasNext = input.incrementToken();
              if (hasNext) {
                tokens2.add(captureState());
              }
              return hasNext;
            }
          };
          cache.put(fieldName, tokens2);
          return tokenStream;
        }
        new TokenStream()
        {
          private Iterator iter = tokens.iterator();
          
          public boolean incrementToken()
          {
            if (!iter.hasNext()) {
              return false;
            }
            restoreState((AttributeSource.State)iter.next());
            return true;
          }
        };
      }
    };
  }
  
  public static String[] getMostFrequentTerms(Analyzer analyzer, String text, int limit)
  {
    if (analyzer == null) {
      throw new IllegalArgumentException("analyzer must not be null");
    }
    if (text == null) {
      throw new IllegalArgumentException("text must not be null");
    }
    if (limit <= 0) {
      limit = Integer.MAX_VALUE;
    }
    HashMap map = new HashMap();
    TokenStream stream = analyzer.tokenStream("", new StringReader(text));
    TermAttribute termAtt = (TermAttribute)stream.addAttribute(TermAttribute.class);
    try
    {
      while (stream.incrementToken())
      {
        MutableInteger freq = (MutableInteger)map.get(termAtt.term());
        if (freq == null)
        {
          freq = new MutableInteger(1);
          map.put(termAtt.term(), freq);
        }
        else
        {
          freq.setValue(freq.intValue() + 1);
        }
      }
      try
      {
        stream.close();
      }
      catch (IOException e2)
      {
        throw new RuntimeException(e2);
      }
      entries = new Map.Entry[map.size()];
    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
    finally
    {
      try
      {
        stream.close();
      }
      catch (IOException e2)
      {
        throw new RuntimeException(e2);
      }
    }
    Map.Entry[] entries;
    map.entrySet().toArray(entries);
    Arrays.sort(entries, new Comparator()
    {
      public int compare(Object o1, Object o2)
      {
        Map.Entry e1 = (Map.Entry)o1;
        Map.Entry e2 = (Map.Entry)o2;
        int f1 = ((AnalyzerUtil.MutableInteger)e1.getValue()).intValue();
        int f2 = ((AnalyzerUtil.MutableInteger)e2.getValue()).intValue();
        if (f2 - f1 != 0) {
          return f2 - f1;
        }
        String s1 = (String)e1.getKey();
        String s2 = (String)e2.getKey();
        return s1.compareTo(s2);
      }
    });
    int size = Math.min(limit, entries.length);
    String[] pairs = new String[size];
    for (int i = 0; i < size; i++) {
      pairs[i] = (entries[i].getValue() + ":" + entries[i].getKey());
    }
    return pairs;
  }
  
  private static final class MutableInteger
  {
    private int value;
    
    public MutableInteger(int value)
    {
      this.value = value;
    }
    
    public int intValue()
    {
      return value;
    }
    
    public void setValue(int value)
    {
      this.value = value;
    }
    
    public String toString()
    {
      return String.valueOf(value);
    }
  }
  
  private static final Pattern PARAGRAPHS = Pattern.compile("([\\r\\n\\u0085\\u2028\\u2029][ \\t\\x0B\\f]*){2,}");
  
  public static String[] getParagraphs(String text, int limit)
  {
    return tokenize(PARAGRAPHS, text, limit);
  }
  
  private static String[] tokenize(Pattern pattern, String text, int limit)
  {
    String[] tokens = pattern.split(text, limit);
    for (int i = tokens.length;; tokens[i] = tokens[i].trim())
    {
      i--;
      if (i < 0) {
        break;
      }
    }
    return tokens;
  }
  
  private static final Pattern SENTENCES = Pattern.compile("[!\\.\\?\\xA1\\xBF]+");
  
  public static String[] getSentences(String text, int limit)
  {
    int len = text.length();
    if (len == 0) {
      return new String[] { text };
    }
    if (limit <= 0) {
      limit = Integer.MAX_VALUE;
    }
    String[] tokens = new String[Math.min(limit, 1 + len / 40)];
    int size = 0;
    int i = 0;
    for (; (i < len) && (size < limit); goto 132)
    {
      int start = i;
      while ((i < len) && (!isSentenceSeparator(text.charAt(i)))) {
        i++;
      }
      if (size == tokens.length)
      {
        String[] tmp = new String[tokens.length << 1];
        System.arraycopy(tokens, 0, tmp, 0, size);
        tokens = tmp;
      }
      tokens[(size++)] = text.substring(start, i).trim();
      if ((i < len) && (isSentenceSeparator(text.charAt(i)))) {
        i++;
      }
    }
    if (size == tokens.length) {
      return tokens;
    }
    String[] results = new String[size];
    System.arraycopy(tokens, 0, results, 0, size);
    return results;
  }
  
  private static boolean isSentenceSeparator(char c)
  {
    switch (c)
    {
    case '!': 
      return true;
    case '.': 
      return true;
    case '?': 
      return true;
    case '�': 
      return true;
    case '�': 
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.AnalyzerUtil
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.util.Comparator;
import java.util.Map.Entry;

final class MemoryIndex$1
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    if ((o1 instanceof Map.Entry)) {
      o1 = ((Map.Entry)o1).getKey();
    }
    if ((o2 instanceof Map.Entry)) {
      o2 = ((Map.Entry)o2).getKey();
    }
    if (o1 == o2) {
      return 0;
    }
    return ((String)o1).compareTo((String)o2);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.util.Collection;
import java.util.Iterator;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;

class MemoryIndex$2
  extends TokenStream
{
  private Iterator iter = val$keywords.iterator();
  private int start = 0;
  private TermAttribute termAtt = (TermAttribute)addAttribute(MemoryIndex.class$org$apache$lucene$analysis$tokenattributes$TermAttribute == null ? (MemoryIndex.class$org$apache$lucene$analysis$tokenattributes$TermAttribute = MemoryIndex.class$("org.apache.lucene.analysis.tokenattributes.TermAttribute")) : MemoryIndex.class$org$apache$lucene$analysis$tokenattributes$TermAttribute);
  private OffsetAttribute offsetAtt = (OffsetAttribute)addAttribute(MemoryIndex.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute == null ? (MemoryIndex.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute = MemoryIndex.class$("org.apache.lucene.analysis.tokenattributes.OffsetAttribute")) : MemoryIndex.class$org$apache$lucene$analysis$tokenattributes$OffsetAttribute);
  private final MemoryIndex this$0;
  
  MemoryIndex$2(MemoryIndex paramMemoryIndex, Collection paramCollection) {}
  
  public boolean incrementToken()
  {
    if (!iter.hasNext()) {
      return false;
    }
    Object obj = iter.next();
    if (obj == null) {
      throw new IllegalArgumentException("keyword must not be null");
    }
    String term = obj.toString();
    termAtt.setTermBuffer(term);
    offsetAtt.setOffset(start, start + termAtt.termLength());
    start += term.length() + 1;
    return true;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import org.apache.lucene.search.HitCollector;

class MemoryIndex$3
  extends HitCollector
{
  private final MemoryIndex this$0;
  
  MemoryIndex$3(MemoryIndex paramMemoryIndex, float[] paramArrayOfFloat) {}
  
  public void collect(int doc, float score)
  {
    val$scores[0] = score;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.Serializable;

final class MemoryIndex$ArrayIntList
  implements Serializable
{
  private int[] elements;
  private int size = 0;
  private static final long serialVersionUID = 2282195016849084649L;
  
  public MemoryIndex$ArrayIntList()
  {
    this(10);
  }
  
  public MemoryIndex$ArrayIntList(int initialCapacity)
  {
    elements = new int[initialCapacity];
  }
  
  public void add(int elem)
  {
    if (size == elements.length) {
      ensureCapacity(size + 1);
    }
    elements[(size++)] = elem;
  }
  
  public void add(int pos, int start, int end)
  {
    if (size + 3 > elements.length) {
      ensureCapacity(size + 3);
    }
    elements[size] = pos;
    elements[(size + 1)] = start;
    elements[(size + 2)] = end;
    size += 3;
  }
  
  public int get(int index)
  {
    if (index >= size) {
      throwIndex(index);
    }
    return elements[index];
  }
  
  public int size()
  {
    return size;
  }
  
  public int[] toArray(int stride)
  {
    int[] arr = new int[size() / stride];
    if (stride == 1)
    {
      System.arraycopy(elements, 0, arr, 0, size);
    }
    else
    {
      int i = 0;
      for (int j = 0; j < size; j += stride)
      {
        arr[i] = elements[j];i++;
      }
    }
    return arr;
  }
  
  private void ensureCapacity(int minCapacity)
  {
    int newCapacity = Math.max(minCapacity, elements.length * 3 / 2 + 1);
    int[] newElements = new int[newCapacity];
    System.arraycopy(elements, 0, newElements, 0, size);
    elements = newElements;
  }
  
  private void throwIndex(int index)
  {
    throw new IndexOutOfBoundsException("index: " + index + ", size: " + size);
  }
  
  public String toString(int stride)
  {
    int s = size() / stride;
    int len = Math.min(10, s);
    StringBuffer buf = new StringBuffer(4 * len);
    buf.append("[");
    for (int i = 0; i < len; i++)
    {
      buf.append(get(i * stride));
      if (i < len - 1) {
        buf.append(", ");
      }
    }
    if (len != s) {
      buf.append(", ...");
    }
    buf.append("]");
    return buf.toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.ArrayIntList
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map.Entry;
import org.apache.lucene.index.Term;

final class MemoryIndex$Info
  implements Serializable
{
  private final HashMap terms;
  private transient Map.Entry[] sortedTerms;
  private final int numTokens;
  private final int numOverlapTokens;
  private final float boost;
  public transient Term template;
  private static final long serialVersionUID = 2882195016849084649L;
  
  public MemoryIndex$Info(HashMap terms, int numTokens, int numOverlapTokens, float boost)
  {
    this.terms = terms;
    this.numTokens = numTokens;
    this.numOverlapTokens = numOverlapTokens;
    this.boost = boost;
  }
  
  public void sortTerms()
  {
    if (sortedTerms == null) {
      sortedTerms = MemoryIndex.access$400(terms);
    }
  }
  
  public MemoryIndex.ArrayIntList getPositions(String term)
  {
    return (MemoryIndex.ArrayIntList)terms.get(term);
  }
  
  public MemoryIndex.ArrayIntList getPositions(int pos)
  {
    return (MemoryIndex.ArrayIntList)sortedTerms[pos].getValue();
  }
  
  public float getBoost()
  {
    return boost;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.Info
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.util.Map.Entry;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermEnum;

class MemoryIndex$MemoryIndexReader$1
  extends TermEnum
{
  private int i = val$ix;
  private int j = val$jx;
  private final MemoryIndex.MemoryIndexReader this$1;
  
  MemoryIndex$MemoryIndexReader$1(MemoryIndex.MemoryIndexReader paramMemoryIndexReader, int paramInt1, int paramInt2) {}
  
  public boolean next()
  {
    if (j >= MemoryIndex.access$600(MemoryIndex.MemoryIndexReader.access$1000(this$1)).length) {
      return false;
    }
    MemoryIndex.Info info = MemoryIndex.MemoryIndexReader.access$1100(this$1, j);
    if (++i < MemoryIndex.Info.access$200(info).length) {
      return true;
    }
    j += 1;
    i = 0;
    if (j >= MemoryIndex.access$600(MemoryIndex.MemoryIndexReader.access$1000(this$1)).length) {
      return false;
    }
    MemoryIndex.MemoryIndexReader.access$1100(this$1, j).sortTerms();
    return true;
  }
  
  public Term term()
  {
    if (j >= MemoryIndex.access$600(MemoryIndex.MemoryIndexReader.access$1000(this$1)).length) {
      return null;
    }
    MemoryIndex.Info info = MemoryIndex.MemoryIndexReader.access$1100(this$1, j);
    if (i >= MemoryIndex.Info.access$200(info).length) {
      return null;
    }
    return createTerm(info, j, (String)MemoryIndex.Info.access$200(info)[i].getKey());
  }
  
  public int docFreq()
  {
    if (j >= MemoryIndex.access$600(MemoryIndex.MemoryIndexReader.access$1000(this$1)).length) {
      return 0;
    }
    MemoryIndex.Info info = MemoryIndex.MemoryIndexReader.access$1100(this$1, j);
    if (i >= MemoryIndex.Info.access$200(info).length) {
      return 0;
    }
    return MemoryIndex.access$1200(MemoryIndex.MemoryIndexReader.access$1000(this$1), info.getPositions(i));
  }
  
  public void close() {}
  
  private Term createTerm(MemoryIndex.Info info, int pos, String text)
  {
    Term template = template;
    if (template == null)
    {
      String fieldName = (String)MemoryIndex.access$600(MemoryIndex.MemoryIndexReader.access$1000(this$1))[pos].getKey();
      template = new Term(fieldName);
      template = template;
    }
    return template.createTerm(text);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.MemoryIndexReader.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermEnum;
import org.apache.lucene.index.TermPositions;

class MemoryIndex$MemoryIndexReader$2
  implements TermPositions
{
  private boolean hasNext;
  private int cursor = 0;
  private MemoryIndex.ArrayIntList current;
  private Term term;
  private final MemoryIndex.MemoryIndexReader this$1;
  
  MemoryIndex$MemoryIndexReader$2(MemoryIndex.MemoryIndexReader paramMemoryIndexReader) {}
  
  public void seek(Term term)
  {
    this.term = term;
    if (term == null)
    {
      hasNext = true;
    }
    else
    {
      MemoryIndex.Info info = MemoryIndex.MemoryIndexReader.access$1300(this$1, term.field());
      current = (info == null ? null : info.getPositions(term.text()));
      hasNext = (current != null);
      cursor = 0;
    }
  }
  
  public void seek(TermEnum termEnum)
  {
    seek(termEnum.term());
  }
  
  public int doc()
  {
    return 0;
  }
  
  public int freq()
  {
    int freq = term == null ? 1 : current != null ? MemoryIndex.access$1200(MemoryIndex.MemoryIndexReader.access$1000(this$1), current) : 0;
    
    return freq;
  }
  
  public boolean next()
  {
    boolean next = hasNext;
    hasNext = false;
    return next;
  }
  
  public int read(int[] docs, int[] freqs)
  {
    if (!hasNext) {
      return 0;
    }
    hasNext = false;
    docs[0] = 0;
    freqs[0] = freq();
    return 1;
  }
  
  public boolean skipTo(int target)
  {
    return next();
  }
  
  public void close() {}
  
  public int nextPosition()
  {
    int pos = current.get(cursor);
    cursor += MemoryIndex.access$1400(MemoryIndex.MemoryIndexReader.access$1000(this$1));
    
    return pos;
  }
  
  public int getPayloadLength()
  {
    throw new UnsupportedOperationException();
  }
  
  public byte[] getPayload(byte[] data, int offset)
    throws IOException
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean isPayloadAvailable()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.MemoryIndexReader.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.util.Arrays;
import java.util.Map.Entry;
import org.apache.lucene.index.TermPositionVector;
import org.apache.lucene.index.TermVectorOffsetInfo;

class MemoryIndex$MemoryIndexReader$3
  implements TermPositionVector
{
  private final Map.Entry[] sortedTerms = MemoryIndex.Info.access$200(val$info);
  private final MemoryIndex.MemoryIndexReader this$1;
  
  MemoryIndex$MemoryIndexReader$3(MemoryIndex.MemoryIndexReader paramMemoryIndexReader, MemoryIndex.Info paramInfo, String paramString) {}
  
  public String getField()
  {
    return val$fieldName;
  }
  
  public int size()
  {
    return sortedTerms.length;
  }
  
  public String[] getTerms()
  {
    String[] terms = new String[sortedTerms.length];
    int i = sortedTerms.length;
    for (;;)
    {
      i--;
      if (i < 0) {
        break;
      }
      terms[i] = ((String)sortedTerms[i].getKey());
    }
    return terms;
  }
  
  public int[] getTermFrequencies()
  {
    int[] freqs = new int[sortedTerms.length];
    int i = sortedTerms.length;
    for (;;)
    {
      i--;
      if (i < 0) {
        break;
      }
      freqs[i] = MemoryIndex.access$1200(MemoryIndex.MemoryIndexReader.access$1000(this$1), (MemoryIndex.ArrayIntList)sortedTerms[i].getValue());
    }
    return freqs;
  }
  
  public int indexOf(String term)
  {
    int i = Arrays.binarySearch(sortedTerms, term, MemoryIndex.access$900());
    return i >= 0 ? i : -1;
  }
  
  public int[] indexesOf(String[] terms, int start, int len)
  {
    int[] indexes = new int[len];
    for (int i = 0; i < len; i++) {
      indexes[i] = indexOf(terms[(start++)]);
    }
    return indexes;
  }
  
  public int[] getTermPositions(int index)
  {
    return ((MemoryIndex.ArrayIntList)sortedTerms[index].getValue()).toArray(MemoryIndex.access$1400(MemoryIndex.MemoryIndexReader.access$1000(this$1)));
  }
  
  public TermVectorOffsetInfo[] getOffsets(int index)
  {
    if (MemoryIndex.access$1400(MemoryIndex.MemoryIndexReader.access$1000(this$1)) == 1) {
      return null;
    }
    MemoryIndex.ArrayIntList positions = (MemoryIndex.ArrayIntList)sortedTerms[index].getValue();
    int size = positions.size();
    TermVectorOffsetInfo[] offsets = new TermVectorOffsetInfo[size / MemoryIndex.access$1400(MemoryIndex.MemoryIndexReader.access$1000(this$1))];
    
    int i = 0;
    for (int j = 1; j < size; j += MemoryIndex.access$1400(MemoryIndex.MemoryIndexReader.access$1000(this$1)))
    {
      int start = positions.get(j);
      int end = positions.get(j + 1);
      offsets[i] = new TermVectorOffsetInfo(start, end);i++;
    }
    return offsets;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.index.memory.MemoryIndex.MemoryIndexReader.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.index.memory;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.FieldSelector;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReader.FieldOption;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
import org.apache.lucene.index.TermEnum;
import org.apache.lucene.index.TermFreqVector;
import org.apache.lucene.index.TermPositionVector;
import org.apache.lucene.index.TermPositions;
import org.apache.lucene.index.TermVectorMapper;
import org.apache.lucene.index.TermVectorOffsetInfo;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.Similarity;

final class MemoryIndex$MemoryIndexReader
  extends IndexReader
{
  private Searcher searcher;
  private byte[] cachedNorms;
  private String cachedFieldName;
  private Similarity cachedSimilarity;
  private final MemoryIndex this$0;
  
  MemoryIndex$MemoryIndexReader(MemoryIndex x0, MemoryIndex.1 x1)
  {
    this(x0);
  }
  
  private MemoryIndex$MemoryIndexReader(MemoryIndex paramMemoryIndex)
  {
    super(null);
  }
  
  private MemoryIndex.Info getInfo(String fieldName)
  {
    return (MemoryIndex.Info)MemoryIndex.access$500(this$0).get(fieldName);
  }
  
  private MemoryIndex.Info getInfo(int pos)
  {
    return (MemoryIndex.Info)MemoryIndex.access$600(this$0)[pos].getValue();
  }
  
  public int docFreq(Term term)
  {
    MemoryIndex.Info info = getIn
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd