org.apache.lucene.analysis_2.9.1.v201101211721

16:41:09.439 INFO  jd.cli.Main - Decompiling org.apache.lucene.analysis_2.9.1.v201101211721.jar
package org.apache.lucene.analysis.ar;

class ArabicAnalyzer$1 {}

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

import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;

class ArabicAnalyzer$SavedStreams
{
  Tokenizer source;
  TokenStream result;
  private final ArabicAnalyzer this$0;
  
  private ArabicAnalyzer$SavedStreams(ArabicAnalyzer paramArabicAnalyzer) {}
  
  ArabicAnalyzer$SavedStreams(ArabicAnalyzer x0, ArabicAnalyzer.1 x1)
  {
    this(x0);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.ar.ArabicAnalyzer.SavedStreams
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.ar;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.WordlistLoader;
import org.apache.lucene.util.Version;

public final class ArabicAnalyzer
  extends Analyzer
{
  public static final String DEFAULT_STOPWORD_FILE = "stopwords.txt";
  private Set stoptable = new HashSet();
  public static final String STOPWORDS_COMMENT = "#";
  private final Version matchVersion;
  
  /**
   * @deprecated
   */
  public ArabicAnalyzer()
  {
    this(Version.LUCENE_24);
  }
  
  public ArabicAnalyzer(Version matchVersion)
  {
    this.matchVersion = matchVersion;
    try
    {
      InputStream stream = ArabicAnalyzer.class.getResourceAsStream("stopwords.txt");
      InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
      stoptable = WordlistLoader.getWordSet(reader, "#");
      reader.close();
      stream.close();
    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
  }
  
  /**
   * @deprecated
   */
  public ArabicAnalyzer(String[] stopwords)
  {
    this(Version.LUCENE_24, stopwords);
  }
  
  public ArabicAnalyzer(Version matchVersion, String[] stopwords)
  {
    stoptable = StopFilter.makeStopSet(stopwords);
    this.matchVersion = matchVersion;
  }
  
  /**
   * @deprecated
   */
  public ArabicAnalyzer(Hashtable stopwords)
  {
    this(Version.LUCENE_24, stopwords);
  }
  
  public ArabicAnalyzer(Version matchVersion, Hashtable stopwords)
  {
    stoptable = new HashSet(stopwords.keySet());
    this.matchVersion = matchVersion;
  }
  
  /**
   * @deprecated
   */
  public ArabicAnalyzer(File stopwords)
    throws IOException
  {
    this(Version.LUCENE_24, stopwords);
  }
  
  public ArabicAnalyzer(Version matchVersion, File stopwords)
    throws IOException
  {
    stoptable = WordlistLoader.getWordSet(stopwords, "#");
    this.matchVersion = matchVersion;
  }
  
  public final TokenStream tokenStream(String fieldName, Reader reader)
  {
    TokenStream result = new ArabicLetterTokenizer(reader);
    result = new LowerCaseFilter(result);
    result = new StopFilter(StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion), result, stoptable);
    
    result = new ArabicNormalizationFilter(result);
    result = new ArabicStemFilter(result);
    
    return result;
  }
  
  private class SavedStreams
  {
    Tokenizer source;
    TokenStream result;
    
    private SavedStreams() {}
    
    SavedStreams(ArabicAnalyzer.1 x1)
    {
      this();
    }
  }
  
  public TokenStream reusableTokenStream(String fieldName, Reader reader)
    throws IOException
  {
    SavedStreams streams = (SavedStreams)getPreviousTokenStream();
    if (streams == null)
    {
      streams = new SavedStreams(null);
      source = new ArabicLetterTokenizer(reader);
      result = new LowerCaseFilter(source);
      result = new StopFilter(StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion), result, stoptable);
      
      result = new ArabicNormalizationFilter(result);
      result = new ArabicStemFilter(result);
      setPreviousTokenStream(streams);
    }
    else
    {
      source.reset(reader);
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.ar.ArabicAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.ar;

import java.io.Reader;
import org.apache.lucene.analysis.LetterTokenizer;
import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.AttributeSource.AttributeFactory;

public class ArabicLetterTokenizer
  extends LetterTokenizer
{
  public ArabicLetterTokenizer(Reader in)
  {
    super(in);
  }
  
  public ArabicLetterTokenizer(AttributeSource source, Reader in)
  {
    super(source, in);
  }
  
  public ArabicLetterTokenizer(AttributeSource.AttributeFactory factory, Reader in)
  {
    super(factory, in);
  }
  
  protected boolean isTokenChar(char c)
  {
    return (super.isTokenChar(c)) || (Character.getType(c) == 6);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.ar.ArabicLetterTokenizer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.ar;

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

public final class ArabicNormalizationFilter
  extends TokenFilter
{
  protected ArabicNormalizer normalizer = null;
  private TermAttribute termAtt;
  
  public ArabicNormalizationFilter(TokenStream input)
  {
    super(input);
    normalizer = new ArabicNormalizer();
    termAtt = ((TermAttribute)addAttribute(TermAttribute.class));
  }
  
  public boolean incrementToken()
    throws IOException
  {
    if (input.incrementToken())
    {
      int newlen = normalizer.normalize(termAtt.termBuffer(), termAtt.termLength());
      termAtt.setTermLength(newlen);
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.ar.ArabicNormalizationFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.ar;

public class ArabicNormalizer
{
  public static final char ALEF = '?';
  public static final char ALEF_MADDA = '?';
  public static final char ALEF_HAMZA_ABOVE = '?';
  public static final char ALEF_HAMZA_BELOW = '?';
  public static final char YEH = '?';
  public static final char DOTLESS_YEH = '?';
  public static final char TEH_MARBUTA = '?';
  public static final char HEH = '?';
  public static final char TATWEEL = '?';
  public static final char FATHATAN = '?';
  public static final char DAMMATAN = '?';
  public static final char KASRATAN = '?';
  public static final char FATHA = '?';
  public static final char DAMMA = '?';
  public static final char KASRA = '?';
  public static final char SHADDA = '?';
  public static final char SUKUN = '?';
  
  public int normalize(char[] s, int len)
  {
    for (int i = 0; i < len; i++)
    {
      if ((s[i] == '?') || (s[i] == '?') || (s[i] == '?')) {
        s[i] = '?';
      }
      if (s[i] == '?') {
        s[i] = '?';
      }
      if (s[i] == '?') {
        s[i] = '?';
      }
      if ((s[i] == '?') || (s[i] == '?') || (s[i] == '?') || (s[i] == '?') || (s[i] == '?') || (s[i] == '?') || (s[i] == '?') || (s[i] == '?') || (s[i] == '?'))
      {
        len = delete(s, i, len);
        i--;
      }
    }
    return len;
  }
  
  protected int delete(char[] s, int pos, int len)
  {
    if (pos < len) {
      System.arraycopy(s, pos + 1, s, pos, len - pos - 1);
    }
    return len - 1;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.ar.ArabicNormalizer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.ar;

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

public final class ArabicStemFilter
  extends TokenFilter
{
  protected ArabicStemmer stemmer = null;
  private TermAttribute termAtt;
  
  public ArabicStemFilter(TokenStream input)
  {
    super(input);
    stemmer = new ArabicStemmer();
    termAtt = ((TermAttribute)addAttribute(TermAttribute.class));
  }
  
  public boolean incrementToken()
    throws IOException
  {
    if (input.incrementToken())
    {
      int newlen = stemmer.stem(termAtt.termBuffer(), termAtt.termLength());
      termAtt.setTermLength(newlen);
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.ar.ArabicStemFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.ar;

public class ArabicStemmer
{
  public static final char ALEF = '?';
  public static final char BEH = '?';
  public static final char TEH_MARBUTA = '?';
  public static final char TEH = '?';
  public static final char FEH = '?';
  public static final char KAF = '?';
  public static final char LAM = '?';
  public static final char NOON = '?';
  public static final char HEH = '?';
  public static final char WAW = '?';
  public static final char YEH = '?';
  public static final char[][] prefixes = { "??".toCharArray(), "???".toCharArray(), "???".toCharArray(), "???".toCharArray(), "???".toCharArray(), "??".toCharArray(), "?".toCharArray() };
  public static final char[][] suffixes = { "??".toCharArray(), "??".toCharArray(), "??".toCharArray(), "??".toCharArray(), "??".toCharArray(), "??".toCharArray(), "??".toCharArray(), "?".toCharArray(), "?".toCharArray(), "?".toCharArray() };
  
  public int stem(char[] s, int len)
  {
    len = stemPrefix(s, len);
    len = stemSuffix(s, len);
    
    return len;
  }
  
  public int stemPrefix(char[] s, int len)
  {
    for (int i = 0; i < prefixes.length; i++) {
      if (startsWith(s, len, prefixes[i])) {
        return deleteN(s, 0, len, prefixes[i].length);
      }
    }
    return len;
  }
  
  public int stemSuffix(char[] s, int len)
  {
    for (int i = 0; i < suffixes.length; i++) {
      if (endsWith(s, len, suffixes[i])) {
        len = deleteN(s, len - suffixes[i].length, len, suffixes[i].length);
      }
    }
    return len;
  }
  
  boolean startsWith(char[] s, int len, char[] prefix)
  {
    if ((prefix.length == 1) && (len < 4)) {
      return false;
    }
    if (len < prefix.length + 2) {
      return false;
    }
    for (int i = 0; i < prefix.length; i++) {
      if (s[i] != prefix[i]) {
        return false;
      }
    }
    return true;
  }
  
  boolean endsWith(char[] s, int len, char[] suffix)
  {
    if (len < suffix.length + 2) {
      return false;
    }
    for (int i = 0; i < suffix.length; i++) {
      if (s[(len - suffix.length + i)] != suffix[i]) {
        return false;
      }
    }
    return true;
  }
  
  protected int deleteN(char[] s, int pos, int len, int nChars)
  {
    for (int i = 0; i < nChars; i++) {
      len = delete(s, pos, len);
    }
    return len;
  }
  
  protected int delete(char[] s, int pos, int len)
  {
    if (pos < len) {
      System.arraycopy(s, pos + 1, s, pos, len - pos - 1);
    }
    return len - 1;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.ar.ArabicStemmer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.br;

class BrazilianAnalyzer$1 {}

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

import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;

class BrazilianAnalyzer$SavedStreams
{
  Tokenizer source;
  TokenStream result;
  private final BrazilianAnalyzer this$0;
  
  private BrazilianAnalyzer$SavedStreams(BrazilianAnalyzer paramBrazilianAnalyzer) {}
  
  BrazilianAnalyzer$SavedStreams(BrazilianAnalyzer x0, BrazilianAnalyzer.1 x1)
  {
    this(x0);
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.br.BrazilianAnalyzer.SavedStreams
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.br;

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.WordlistLoader;
import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.util.Version;

public final class BrazilianAnalyzer
  extends Analyzer
{
  public static final String[] BRAZILIAN_STOP_WORDS = { "a", "ainda", "alem", "ambas", "ambos", "antes", "ao", "aonde", "aos", "apos", "aquele", "aqueles", "as", "assim", "com", "como", "contra", "contudo", "cuja", "cujas", "cujo", "cujos", "da", "das", "de", "dela", "dele", "deles", "demais", "depois", "desde", "desta", "deste", "dispoe", "dispoem", "diversa", "diversas", "diversos", "do", "dos", "durante", "e", "ela", "elas", "ele", "eles", "em", "entao", "entre", "essa", "essas", "esse", "esses", "esta", "estas", "este", "estes", "ha", "isso", "isto", "logo", "mais", "mas", "mediante", "menos", "mesma", "mesmas", "mesmo", "mesmos", "na", "nas", "nao", "nas", "nem", "nesse", "neste", "nos", "o", "os", "ou", "outra", "outras", "outro", "outros", "pelas", "pelas", "pelo", "pelos", "perante", "pois", "por", "porque", "portanto", "proprio", "propios", "quais", "qual", "qualquer", "quando", "quanto", "que", "quem", "quer", "se", "seja", "sem", "sendo", "seu", "seus", "sob", "sobre", "sua", "suas", "tal", "tambem", "teu", "teus", "toda", "todas", "todo", "todos", "tua", "tuas", "tudo", "um", "uma", "umas", "uns" };
  private Set stoptable = new HashSet();
  private Set excltable = new HashSet();
  private final Version matchVersion;
  
  /**
   * @deprecated
   */
  public BrazilianAnalyzer()
  {
    this(Version.LUCENE_23);
  }
  
  public BrazilianAnalyzer(Version matchVersion)
  {
    stoptable = StopFilter.makeStopSet(BRAZILIAN_STOP_WORDS);
    this.matchVersion = matchVersion;
  }
  
  /**
   * @deprecated
   */
  public BrazilianAnalyzer(String[] stopwords)
  {
    this(Version.LUCENE_23, stopwords);
  }
  
  public BrazilianAnalyzer(Version matchVersion, String[] stopwords)
  {
    stoptable = StopFilter.makeStopSet(stopwords);
    this.matchVersion = matchVersion;
  }
  
  /**
   * @deprecated
   */
  public BrazilianAnalyzer(Map stopwords)
  {
    this(Version.LUCENE_23, stopwords);
  }
  
  public BrazilianAnalyzer(Version matchVersion, Map stopwords)
  {
    stoptable = new HashSet(stopwords.keySet());
    this.matchVersion = matchVersion;
  }
  
  /**
   * @deprecated
   */
  public BrazilianAnalyzer(File stopwords)
    throws IOException
  {
    this(Version.LUCENE_23, stopwords);
  }
  
  public BrazilianAnalyzer(Version matchVersion, File stopwords)
    throws IOException
  {
    stoptable = WordlistLoader.getWordSet(stopwords);
    this.matchVersion = matchVersion;
  }
  
  public void setStemExclusionTable(String[] exclusionlist)
  {
    excltable = StopFilter.makeStopSet(exclusionlist);
    setPreviousTokenStream(null);
  }
  
  public void setStemExclusionTable(Map exclusionlist)
  {
    excltable = new HashSet(exclusionlist.keySet());
    setPreviousTokenStream(null);
  }
  
  public void setStemExclusionTable(File exclusionlist)
    throws IOException
  {
    excltable = WordlistLoader.getWordSet(exclusionlist);
    setPreviousTokenStream(null);
  }
  
  public final TokenStream tokenStream(String fieldName, Reader reader)
  {
    TokenStream result = new StandardTokenizer(matchVersion, reader);
    result = new LowerCaseFilter(result);
    result = new StandardFilter(result);
    result = new StopFilter(StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion), result, stoptable);
    
    result = new BrazilianStemFilter(result, excltable);
    return result;
  }
  
  private class SavedStreams
  {
    Tokenizer source;
    TokenStream result;
    
    private SavedStreams() {}
    
    SavedStreams(BrazilianAnalyzer.1 x1)
    {
      this();
    }
  }
  
  public TokenStream reusableTokenStream(String fieldName, Reader reader)
    throws IOException
  {
    SavedStreams streams = (SavedStreams)getPreviousTokenStream();
    if (streams == null)
    {
      streams = new SavedStreams(null);
      source = new StandardTokenizer(matchVersion, reader);
      result = new LowerCaseFilter(source);
      result = new StandardFilter(result);
      result = new StopFilter(StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion), result, stoptable);
      
      result = new BrazilianStemFilter(result, excltable);
      setPreviousTokenStream(streams);
    }
    else
    {
      source.reset(reader);
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.br.BrazilianAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.br;

import java.io.IOException;
import java.util.Set;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;

public final class BrazilianStemFilter
  extends TokenFilter
{
  private BrazilianStemmer stemmer = null;
  private Set exclusions = null;
  private TermAttribute termAtt;
  
  public BrazilianStemFilter(TokenStream in)
  {
    super(in);
    stemmer = new BrazilianStemmer();
    termAtt = ((TermAttribute)addAttribute(TermAttribute.class));
  }
  
  public BrazilianStemFilter(TokenStream in, Set exclusiontable)
  {
    this(in);
    exclusions = exclusiontable;
  }
  
  public boolean incrementToken()
    throws IOException
  {
    if (input.incrementToken())
    {
      String term = termAtt.term();
      if ((exclusions == null) || (!exclusions.contains(term)))
      {
        String s = stemmer.stem(term);
        if ((s != null) && (!s.equals(term))) {
          termAtt.setTermBuffer(s);
        }
      }
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.lucene.analysis.br.BrazilianStemFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.lucene.analysis.br;

public class BrazilianStemmer
{
  private String TERM;
  private String CT;
  private String R1;
  private String R2;
  private String RV;
  
  protected String stem(String term)
  {
    boolean altered = false;
    
    createCT(term);
    if (!isIndexable(CT)) {
      return null;
    }
    if (!isStemmable(CT)) {
      return CT;
    }
    R1 = getR1(CT);
    R2 = getR1(R1);
    RV = getRV(CT);
    TERM = (term + ";" + CT);
    
    altered = step1();
    if (!altered) {
      altered = step2();
    }
    if (altered) {
      step3();
    } else {
      step4();
    }
    step5();
    
    return CT;
  }
  
  private boolean isStemmable(String term)
  {
    for (int c = 0; c < term.length(); c++) {
      if (!Character.isLetter(term.charAt(c))) {
        return false;
      }
    }
    return true;
  }
  
  private boolean isIndexable(String term)
  {
    return (term.length() < 30) && (term.length() > 2);
  }
  
  private boolean isVowel(char value)
  {
    return (value == 'a') || (value == 'e') || (value == 'i') || (value == 'o') || (value == 'u');
  }
  
  private String getR1(String value)
  {
    if (value == null) {
      return null;
    }
    int i = value.length() - 1;
    for (int j = 0; j < i; j++) {
      if (isVowel(value.charAt(j))) {
        break;
      }
    }
    if (j >= i) {
      return null;
    }
    for (; j < i; j++) {
      if (!isVowel(value.charAt(j))) {
        break;
      }
    }
    if (j >= i) {
      return null;
    }
    return value.substring(j + 1);
  }
  
  private String getRV(String value)
  {
    if (value == null) {
      return null;
    }
    int i = value.length() - 1;
    if ((i > 0) && (!isVowel(value.charAt(1))))
    {
      for (int j = 2; j < i; j++) {
        if (isVowel(value.charAt(j))) {
          break;
        }
      }
      if (j < i) {
        return value.substring(j + 1);
      }
    }
    if ((i > 1) && (isVowel(value.charAt(0))) && (isVowel(value.charAt(1))))
    {
      for (int j = 2; j < i; j++) {
        if (!isVowel(value.charAt(j))) {
          break;
        }
      }
      if (j < i) {
        return value.substring(j + 1);
      }
    }
    if (i > 2) {
      return value.substring(3);
    }
    return null;
  }
  
  private String changeTerm(String value)
  {
    String r = "";
    if (value == null) {
      return null;
    }
    value = value.toLowerCase();
    for (int j = 0; j < value.length(); j++) {
      if ((value.charAt(j) == '�') || (value.charAt(j) == '�') || (value.charAt(j) == '�')) {
        r = r + "a";
      } else if ((value.charAt(j) == '�') || (value.charAt(j) == '�')) {
        r = r + "e";
      } else if (value.charAt(j) == '�') {
        r = r + "i";
      } else if ((value.charAt(j) == '�') || (value.charAt(j) == '�') || (value.charAt(j) == '�')) {
        r = r + "o";
      } else if ((value.charAt(j) == '�') || (value.charAt(j) == '�')) {
        r = r + "u";
      } else if (value.charAt(j) == '�') {
        r = r + "c";
      } else if (value.charAt(j) == '�') {
        r = r + "n";
      } else {
        r = r + value.charAt(j);
      }
    }
    return r;
  }
  
  private boolean suffix(String value, String suffix)
  {
    if ((value == null) || (suffix == null)) {
      return false;
    }
    if (suffix.length() > value.length()) {
      return false;
    }
    return value.substring(value.length() - suffix.length()).equals(suffix);
  }
  
  private String replaceSuffix(String value, String toReplace, String changeTo)
  {
    if ((value == null) || (toReplace == null) || (changeTo == null)) {
      return value;
    }
    String vvalue = removeSuffix(value, toReplace);
    if (value.equals(vvalue)) {
      return value;
    }
    return vvalue + changeTo;
  }
  
  private String removeSuffix(String value, String toRemove)
  {
    if ((value == null) || (toRemove == null) || (!suffix(value, toRemove))) {
      return value;
    }
    return value.substring(0, value.length() - toRemove.length());
  }
  
  private boolean suffixPreceded(String value, String suffix, String preceded)
  {
    if ((value == null) || (suffix == null) || (preceded == null) || (!suffix(value, suffix))) {
      return false;
    }
    return suffix(removeSuffix(value, suffix), preceded);
  }
  
  private void createCT(String term)
  {
    CT = changeTerm(term);
    if (CT.length() < 2) {
      return;
    }
    if ((CT.charAt(0) == '"') || (CT.charAt(0) == '\'') || (CT.charAt(0) == '-') || (CT.charAt(0) == ',') || (CT.charAt(0) == ';') || (CT.charAt(0) == '.') || (CT.charAt(0) == '?') || (CT.charAt(0) == '!')) {
      CT = CT.substring(1);
    }
    if (CT.length() < 2) {
      return;
    }
    if ((CT.charAt(CT.length() - 1) == '-') || (CT.charAt(CT.length() - 1) == ',') || (CT.charAt(CT.length() - 1) == ';') || (CT.charAt(CT.length() - 1) == '.') || (CT.charAt(CT.length() - 1) == '?') || (CT.charAt(CT.length() - 1) == '!') || (CT.charAt(CT.length() - 1) == '\'') || (CT.charAt(CT.length() - 1) == '"')) {
      CT = CT.substring(0, CT.length() - 1);
    }
  }
  
  private boolean step1()
  {
    if (CT == null) {
      return false;
    }
    if ((suffix(CT, "uciones")) && (suffix(R2, "uciones")))
    {
      CT = replaceSuffix(CT, "uciones", "u");return true;
    }
    if (CT.length() >= 6)
    {
      if ((suffix(CT, "imentos")) && (suffix(R2, "imentos")))
      {
        CT = removeSuffix(CT, "imentos");return true;
      }
      if ((suffix(CT, "amentos")) && (suffix(R2, "amentos")))
      {
        CT = removeSuffix(CT, "amentos");return true;
      }
      if ((suffix(CT, "adores")) && (suffix(R2, "adores")))
      {
        CT = removeSuffix(CT, "adores");return true;
      }
      if ((suffix(CT, "adoras")) && (suffix(R2, "adoras")))
      {
        CT = removeSuffix(CT, "adoras");return true;
      }
      if ((suffix(CT, "logias")) && (suffix(R2, "logias")))
      {
        replaceSuffix(CT, "logias", "log");return true;
      }
      if ((suffix(CT, "encias")) && (suffix(R2, "encias")))
      {
        CT = replaceSuffix(CT, "encias", "ente");return true;
      }
      if ((suffix(CT, "amente")) && (suffix(R1, "amente")))
      {
        CT = removeSuffix(CT, "amente");return true;
      }
      if ((suffix(CT, "idades")) && (suffix(R2, "idades")))
      {
        CT = removeSuffix(CT, "idades");return true;
      }
    }
    if (CT.length() >= 5)
    {
      if ((suffix(CT, "acoes")) && (suffix(R2, "acoes")))
      {
        CT = removeSuffix(CT, "acoes");return true;
      }
      if ((suffix(CT, "imento")) && (suffix(R2, "imento")))
      {
        CT = removeSuffix(CT, "imento");return true;
      }
      if ((suffix(CT, "amento")) && (suffix(R2, "amento")))
      {
        CT = removeSuffix(CT, "amento");return true;
      }
      if ((suffix(CT, "adora")) && (suffix(R2, "adora")))
      {
        CT = removeSuffix(CT, "adora");return true;
      }
      if ((suffix(CT, "ismos")) && (suffix(R2, "ismos")))
      {
        CT = removeSuffix(CT, "ismos");return true;
      }
      if ((suffix(CT, "istas")) && (suffix(R2, "istas")))
      {
        CT = removeSuffix(CT, "istas");return true;
      }
      if ((suffix(CT, "logia")) && (suffix(R2, "logia")))
      {
        CT = replaceSuffix(CT, "logia", "log");return true;
      }
      if ((suffix(CT, "ucion")) && (suffix(R2, "ucion")))
      {
        CT = replaceSuffix(CT, "ucion", "u");return true;
      }
      if ((suffix(CT, "encia")) && (suffix(R2, "encia")))
      {
        CT = replaceSuffix(CT, "encia", "ente");return true;
      }
      if ((suffix(CT, "mente")) && (suffix(R2, "mente")))
      {
        CT = removeSuffix(CT, "mente");return true;
      }
      if ((suffix(CT, "idade")) && (suffix(R2, "idade")))
      {
        CT = removeSuffix(CT, "idade");return true;
      }
    }
    if (CT.length() >= 4)
    {
      if ((suffix(CT, "acao")) && (suffix(R2, "acao")))
      {
        CT = removeSuffix(CT, "acao");return true;
      }
      if ((suffix(CT, "ezas")) && (suffix(R2, "ezas")))
      {
        CT = removeSuffix(CT, "ezas");return true;
      }
      if ((suffix(CT, "icos")) && (suffix(R2, "icos")))
      {
        CT = removeSuffix(CT, "icos");return true;
      }
      if ((suffix(CT, "icas")) && (suffix(R2, "icas")))
      {
        CT = removeSuffix(CT, "icas");return true;
      }
      if ((suffix(CT, "ismo")) && (suffix(R2, "ismo")))
      {
        CT = removeSuffix(CT, "ismo");return true;
      }
      if ((suffix(CT, "avel")) && (suffix(R2, "avel")))
      {
        CT = removeSuffix(CT, "avel");return true;
      }
      if ((suffix(CT, "ivel")) && (suffix(R2, "ivel")))
      {
        CT = removeSuffix(CT, "ivel");return true;
      }
      if ((suffix(CT, "ista")) && (suffix(R2, "ista")))
      {
        CT = removeSuffix(CT, "ista");return true;
      }
      if ((suffix(CT, "osos")) && (suffix(R2, "osos")))
      {
        CT = removeSuffix(CT, "osos");return true;
      }
      if ((suffix(CT, "osas")) && (suffix(R2, "osas")))
      {
        CT = removeSuffix(CT, "osas");return true;
      }
      if ((suffix(CT, "ador")) && (suffix(R2, "ador")))
      {
        CT = removeSuffix(CT, "ador");return true;
      }
      if ((suffix(CT, "ivas")) && (suffix(R2, "ivas")))
      {
        CT = removeSuffix(CT, "ivas");return true;
      }
      if ((suffix(CT, "ivos")) && (suffix(R2, "ivos")))
      {
        CT = removeSuffix(CT, "ivos");return true;
      }
      if ((suffix(CT, "iras")) && (suffix(RV, "iras")) && (suffixPreceded(CT, "iras", "e")))
      {
        CT = replaceSuffix(CT, "iras", "ir");return true;
      }
    }
    if (CT.length() >= 3)
    {
      if ((suffix(CT, "eza")) && (suffix(R2, "eza")))
      {
        CT = removeSuffix(CT, "eza");return true;
      }
      if ((suffix(CT, "ico")) && (suffix(R2, "ico")))
      {
        CT = removeSuffix(CT, "ico");return true;
      }
      if ((suffix(CT, "ica")) && (suffix(R2, "ica")))
      {
        CT = removeSuffix(CT, "ica");return true;
      }
      if ((suffix(CT, "oso")) && (suffix(R2, "oso")))
      {
        CT = removeSuffix(CT, "oso");return true;
      }
      if ((suffix(CT, "osa")) && (suffix(R2, "osa")))
      {
        CT = removeSuffix(CT, "osa");return true;
      }
      if ((suffix(CT, "iva")) && (suffix(R2, "iva")))
      {
        CT = removeSuffix(CT, "iva");return true;
      }
      if ((suffix(CT, "ivo")) && (suffix(R2, "ivo")))
      {
        CT = removeSuffix(CT, "ivo");return true;
      }
      if ((suffix(CT, "ira")) && (suffix(RV, "ira")) && (suffixPreceded(CT, "ira", "e")))
      {
        CT = replaceSuffix(CT, "ira", "ir");return true;
      }
    }
    return false;
  }
  
  private boolean step2()
  {
    if (RV == null) {
      return false;
    }
    if (RV.length() >= 7)
    {
      if (suffix(RV, "issemos"))
      {
        CT = removeSuffix(CT, "issemos");return true;
      }
      if (suffix(RV, "essemos"))
      {
        CT = removeSuffix(CT, "essemos");return true;
      }
      if (suffix(RV, "assemos"))
      {
        CT = removeSuffix(CT, "assemos");return true;
      }
      if (suffix(RV, "ariamos"))
      {
        CT = removeSuffix(CT, "ariamos");return true;
      }
      if (suffix(RV, "eriamos"))
      {
        CT = removeSuffix(CT, "eriamos");return true;
      }
      if (suffix(RV, "iriamos"))
      {
        CT = removeSuffix(CT, "iriamos");return true;
      }
    }
    if (RV.length() >= 6)
    {
      if (suffix(RV, "iremos"))
      {
        CT = removeSuffix(CT, "iremos");return true;
      }
      if (suffix(RV, "eremos"))
      {
        CT = removeSuffix(CT, "eremos");return true;
      }
      if (suffix(RV, "aremos"))
      {
        CT = removeSuffix(CT, "aremos");return true;
      }
      if (suffix(RV, "avamos"))
      {
        CT = removeSuffix(CT, "avamos");return true;
      }
      if (suffix(RV, "iramos"))
      {
        CT = removeSuffix(CT, "iramos");return true;
      }
      if (suffix(RV, "eramos"))
      {
        CT = removeSuffix(CT, "eramos");return true;
      }
      if (suffix(RV, "aramos"))
      {
        CT = removeSuffix(CT, "aramos");return true;
      }
      if (suffix(RV, "asseis"))
      {
        CT = removeSuffix(CT, "asseis");return true;
      }
      if (suffix(RV, "esseis"))
      {
        CT = removeSuffix(CT, "esseis");return true;
      }
      if (suffix(RV, "isseis"))
      {
        CT = removeSuffix(CT, "isseis");return true;
      }
      if (suffix(RV, "arieis"))
      {
        CT = removeSuffix(CT, "arieis");return true;
      }
      if (suffix(RV, "erieis"))
      {
        CT = removeSuffix(CT, "erieis");return true;
      }
      if (suffix(RV, "irieis"))
      {
        CT = removeSuffix(CT, "irieis");return true;
      }
    }
    if (RV.length() >= 5)
    {
      if (suffix(RV, "irmos"))
      {
        CT = removeSuffix(CT, "irmos");return true;
      }
      if (suffix(RV, "iamos"))
      {
        CT = removeSuffix(CT, "iamos");return true;
      }
      if (suffix(RV, "armos"))
      {
        CT = removeSuffix(CT, "armos");return true;
      }
      if (suffix(RV, "ermos"))
      {
        CT = removeSuffix(CT, "ermos");return true;
      }
      if (suffix(RV, "areis"))
      {
        CT = removeSuffix(CT, "areis");return true;
      }
      if (suffix(RV, "ereis"))
      {
        CT = removeSuffix(CT, "ereis");return true;
      }
      if (suffix(RV, "ireis"))
      {
        CT = removeSuffix(CT, "ireis");return true;
      }
      if (suffix(RV, "asses"))
      {
        CT = removeSuffix(CT, "asses");return true;
      }
      if (suffix(RV, "esses"))
      {
        CT = removeSuffix(CT, "esses");return true;
      }
      if (suffix(RV, "isses"))
      {
        CT = removeSuffix(CT, "isses");return true;
      }
      if (suffix(RV, "astes"))
      {
        CT = removeSuffix(CT, "astes");return true;
      }
      if (suffix(RV, "assem"))
      {
        CT = removeSuffix(CT, "assem");return true;
      }
      if (suffix(RV, "essem"))
      {
        CT = removeSuffix(CT, "essem");return true;
      }
      if (suffix(RV, "issem"))
      {
        CT = removeSuffix(CT, "issem");return true;
      }
      if (suffix(RV, "ardes"))
      {
        CT = removeSuffix(CT, "ardes");return true;
      }
      if (suffix(RV, "erdes"))
      {
        CT = removeSuffix(CT, "erdes");return true;
      }
      if (suffix(RV, "irdes"))
      {
        CT = removeSuffix(CT, "irdes");return true;
      }
      if (suffix(RV, "ariam"))
      {
        CT = removeSuffix(CT, "ariam");return true;
      }
      if (suffix(RV, "eriam"))
      {
        CT = removeSuffix(CT, "eriam");return true;
      }
      if (suffix(RV, "iriam"))
      {
        CT = removeSuffix(CT, "iriam");return true;
      }
      if (suffix(RV, "arias"))
      {
        CT = removeSuffix(CT, "arias");return true;
      }
      if (suffix(RV, "erias"))
      {
        CT = removeSuffix(CT, "erias");return true;
      }
      if (suffix(RV, "irias"))
      {
        CT = removeSuffix(CT, "irias");return true;
      }
      if (suffix(RV, "estes"))
      {
        CT = removeSuffix(CT, "estes");return true;
      }
      if (suffix(RV, "istes"))
      {
        CT = removeSuffix(CT, "istes");return true;
      }
      if (suffix(RV, "areis"))
      {
        CT = removeSuffix(CT, "areis");return true;
      }
      if (suffix(RV, "aveis"))
      {
        CT = removeSuffix(CT, "aveis");return true;
      }
    }
    if (RV.length() >= 4)
    {
      if (suffix(RV, "aria"))
      {
        CT = removeSuffix(CT, "aria");return true;
      }
      if (suffix(RV, "eria"))
      {
        CT = removeSuffix(CT, "eria");return true;
      }
      if (suffix(RV, "iria"))
      {
        CT = removeSuffix(CT, "iria");return true;
      }
      if (suffix(RV, "asse"))
      {
        CT = removeSuffix(CT, "asse");return true;
      }
      if (suffix(RV, "esse"))
      {
        CT = removeSuffix(CT, "esse");return true;
      }
      if (suffix(RV, "isse"))
      {
        CT = removeSuffix(CT, "isse");return true;
      }
      if (suffix(RV, "aste"))
      {
        CT = removeSuffix(CT, "aste");return true;
      }
      if (suffix(RV, "este"))
      {
        CT = removeSuffix(CT, "este");return true;
      }
      if (suffix(RV, "iste"))
      {
        CT = removeSuffix(CT, "iste");return true;
      }
      if (suffix(RV, "arei"))
      {
        CT = removeSuffix(CT, "arei");return true;
      }
      if (suffix(RV, "erei"))
      {
        CT = removeSuffix(CT, "erei");return true;
      }
      if (suffix(RV, "irei"))
      {
        CT = removeSuffix(CT, "irei");return true;
      }
      if (suffix(RV, "aram"))
      {
        CT = removeSuffix(CT, "aram");return true;
      }
      if (suffix(RV, "eram"))
      {
        CT = removeSuffix(CT, "eram");return true;
      }
      if (suffix(RV, "iram"))
      {
        CT = removeSuffix(CT, "iram");return true;
      }
      if (suffix(RV, "avam"))
      {
        CT = removeSuffix(CT, "avam");return true;
      }
      if (suffix(RV, "arem"))
      {
        CT = removeSuffix(CT, "arem");return true;
      }
      if (suffix(RV, "erem"))
      {
        CT = removeSuffix(CT, "erem");return true;
      }
      if (suffix(RV, "irem"))
      {
        CT = removeSuffix(CT, "irem");return true;
      }
      if (suffix(RV, "ando"))
      {
        CT = removeSuffix(CT, "ando");return true;
      }
      if (suffix(RV, "endo"))
      {
        CT = removeSuffix(CT, "endo");return true;
      }
      if (suffix(RV, "indo"))
      {
        CT = removeSuffix(CT, "indo");return true;
      }
      if (suffix(RV, "arao"))
      {
        CT = removeSuffix(CT, "arao");return true;
      }
      if (suffix(RV, "erao"))
      {
        CT = removeSuffix(CT, "erao");return true;
      }
      if (suffix(RV, "irao"))
      {
        CT = removeSuffix(CT, "irao");return true;
      }
      if (suffix(RV, "adas"))
      {
        CT = removeSuffix(CT, "adas");return true;
      }
      if (suffix(RV, "idas"))
      {
        CT = removeSuffix(CT, "idas");return true;
      }
      if (suffix(RV, "aras"))
      {
        CT = removeSuffix(CT, "aras");return true;
      }
      if (suffix(RV, "eras"))
      {
        CT = removeSuffix(CT, "eras");return true;
      }
      if (suffix(RV, "iras"))
      {
        CT = removeSuffix(CT, "iras");return true;
      }
      if (suffix(RV, "avas"))
      {
        CT = removeSuffix(CT, "avas");return true;
      }
      if (suffix(RV, "ares"))
      {
        CT = removeSuffix(CT, "ares");return true;
      }
      if (suffix(RV, "eres"))
      {
        CT = removeSuffix(CT, "eres");return true;
      }
      if (suffix(RV, "ires"))
      {
        CT = removeSuffix(CT, "ires");return true;
      }
      if (suffix(RV, "ados"))
      {
        CT = removeSuffix(CT, "ados");return true;
      }
      if (suffix(RV, "idos"))
      {
        CT = removeSuffix(CT, "idos");return true;
      }
      if (suffix(RV, "amos"))
      {
        CT = removeSuffix(CT, "amos");return true;
      }
      if (suffix(RV, "emos"))
      {
        CT = removeSuffix(CT, "emos");return true;
      }
      if (suffix(RV, "imos"))
      {
        CT = removeSuffix(CT, "imos");return true;
      }
      if (suffix(RV, "iras"))
      {
        CT = removeSuffix(CT, "iras");return true;
      }
      if (suffix(RV, "ieis"))
      {
        CT = removeSuffix(CT, "ieis");return true;
      }
    }
    if (RV.length() >= 3)
    {
      if (suffix(RV, "ada"))
      {
        CT = removeSuffix(CT, "ada");return true;
      }
      if (suffix(RV, "ida"))
      {
        CT = removeSuffix(CT, "ida");return true;
      }
      if (suffix(RV, "ara"))
      {
        CT = removeSuffix(CT, "ara");return true;
      }
      if (suffix(RV, "era"))
      {
        CT = removeSuffix(CT, "era");return true;
      }
      if (suffix(RV, "ira"))
      {
        CT = removeSuffix(CT, "ava");return true;
      }
      if (suffix(RV, "iam"))
      {
        CT = removeSuffix(CT, "iam");return true;
      }
      if (suffix(RV, "ado"))
      {
        CT = removeSuffix(CT, "ado");return true;
      }
      if (suffix(RV, "ido"))
      {
        CT = removeSuffix(CT, "ido");return true;
      }
      if (suffix(RV, "ias"))
      {
        CT = removeSuffix(CT, "ias");return true;
      }
      if (suffix(RV, "ais"))
      {
        CT = removeSuffix(CT, "ais");return true;
      }
      if (suffix(RV, "eis"))
      {
        CT = removeSuffix(CT, "eis");return true;
      }
      if (suffix(RV, "ira"))
      {
        CT = removeSuffix(CT, "ira");return true;
      }
      if (suffix(RV, "ear"))
      {
        CT = removeSuffix(CT, "ear");return true;
      }
    }
    if (RV.length() >= 2)
    {
      if (suffix(RV, "ia"))
      {
        CT = removeSuffix(CT, "ia");return true;
      }
      if (suffix(RV, "ei"))
      {
        CT = removeSuffix(CT, "ei");return true;
      }
      if (suffix(RV, "am"))
      {
        CT = removeSuffix(CT, "am");r
1 2 3 4 5 6 7 8 9

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