// Make sure we've consumed everything.
if (theLexer.getLexemeType() != EOF_LEXEME) {
throw new IllegalArgumentException();
}
// Save the pieces. Parameters are not in ascending order yet.
int n = thePieces.size();
myPieces = (String[]) thePieces.toArray (new String [n]);
// Sort the parameters into ascending order using an insertion sort.
int i, j;
String temp;
for (i = 4; i < n; i += 2) {
j = 2;
while (j < i && myPieces[j].compareTo (myPieces[i]) <= 0) {
j += 2;
}
while (j < i) {
temp = myPieces[j];
myPieces[j] = myPieces[i];
myPieces[i] = temp;
temp = myPieces[j+1];
myPieces[j+1] = myPieces[i+1];
myPieces[i+1] = temp;
j += 2;
}
}
}
}
=7=
THE END |