public WordSequence trim(int maxSize) { if (maxSize <= 0 || this.size() == 0) { return(WordSequence.__EMPTY); } if (maxSize == this.size()) { return(this); } if (maxSize > this.size()) { maxSize = this.size(); } WordSequence wordSequence = new WordSequence(maxSize); int num = this.words.Length - 1; int num2 = wordSequence.words.Length - 1; for (int i = 0; i < maxSize; i++) { Word[] array = wordSequence.words; int num3 = num2; num2--; Word[] array2 = this.words; int num4 = num; num--; array[num3] = array2[num4]; } return(wordSequence); }
public WordSequence addWord(Word word, int maxSize) { if (maxSize <= 0) { return(WordSequence.__EMPTY); } int num = (this.size() + 1 <= maxSize) ? (this.size() + 1) : maxSize; WordSequence wordSequence = new WordSequence(num); int num2 = num - 1; int num3 = this.size() - 1; Word[] array = wordSequence.words; int num4 = num2; num2--; array[num4] = word; while (num2 >= 0 && num3 >= 0) { Word[] array2 = wordSequence.words; int num5 = num2; num2--; Word[] array3 = this.words; int num6 = num3; num3--; array2[num5] = array3[num6]; } wordSequence.check(); return(wordSequence); }
public WordSequence getOldest() { WordSequence wordSequence = WordSequence.__EMPTY; if (this.size() >= 1) { wordSequence = new WordSequence(this.words.Length - 1); ByteCodeHelper.arraycopy(this.words, 0, wordSequence.words, 0, wordSequence.words.Length); } return(wordSequence); }
public int compareTo(WordSequence other) { int num = Math.min(this.words.Length, other.words.Length); for (int i = 0; i < num; i++) { if (!this.words[i].equals(other.words[i])) { return(this.words[i].compareTo(other.words[i])); } } return(this.words.Length - other.words.Length); }
public int compare(WordSequence wordSequence, WordSequence wordSequence2) { return(wordSequence.getOldest().compareTo(wordSequence2.getOldest())); }