//------------------------------------------------------------------------------
// Essential Mutator: Increments the count associated with the given word. If
// the word is not in the collection then it is added prior to the count being
// incremented.
//------------------------------------------------------------------------------
public boolean Increment(String Word) {
boolean result = false;
int index = indexOf(Word);
if(index < 0) {
if(next < limit) {
WC[next] = new WordCount(Word);
next = WC[previous];
index = next;
next = next + 1;
}
else {
index = -1;
}
}
if(index >= 0) {
result = (WC[index].Increment() > 0);
}
return result;
}
//------------------------------------------------------------------------------
// Sorts the words in ascending order
//------------------------------------------------------------------------------
Alright so I need some clarification/help with this program. I need to take a word and insert into an array then take the next and insert that into the array and so on. The words need to be in ascending order. My question is should I make some sort of new method that sorts them or could I just somehow compare the words band then add them into there correct ascended position? using:
WC[next] = new WordCount(Word);
Thanks!

New Topic/Question
Reply




MultiQuote





|