if (ahead <= MAX_LOOKAHEAD && pos + ahead < nodes.length && nodes[pos].equals(nodes[pos + ahead])) {
if (ahead <= MAX_LOOKAHEAD && pos + ahead < seq.length && seq[pos].equals(seq[pos + ahead])) {
    private CompressedSequence compress(Object[] nodes) {        //This is the compressed list that we will return compossed of CompressedSequences         CompressedSequence compressed = new CompressedSequence(1);         // System.out.println("Joiner sched size " + nodes.length);        // pos is our location in <nodes>        int pos = 0;        // keep going 'til we've printed all the nodes        while (pos < nodes.length) {            // ahead is our repetition-looking device            int ahead = 1;            do {                while (ahead <= MAX_LOOKAHEAD && pos + ahead < nodes.length                       && !nodes[pos].equals(nodes[pos + ahead])) {                    //System.out.println(nodes[pos] + " != " + nodes[pos + ahead]);                    ahead++;                }                // if we found a match, try to build on it. <reps> denotes                // how many iterations of a loop we have.                int reps = 0;                if (ahead <= MAX_LOOKAHEAD && pos + ahead < nodes.length                    && nodes[pos].equals(nodes[pos + ahead])) {                    // see how many repetitions of the loop we can make...                    do {                        int i;                        for (i = pos + reps * ahead; i < pos + (reps + 1)                                 * ahead; i++) {                            // quit if we reach the end of the array                            if (i + ahead >= nodes.length) {                                break;                            }                            // quit if there's something non-matching                            if (!nodes[i].equals(nodes[i + ahead])) {                                break;                            }                        }                        // if we finished loop, increment <reps>; otherwise                        // break                        if (i == pos + (reps + 1) * ahead) {                            reps++;                        } else {                            break;                        }                    } while (true);                }                //add one to reps because we now want reps to count how many repetitions of the                 //ahead sequence we have and we at least have one...                reps++;                // if reps is <= 1, no loop was found                                if (reps <= 1) {                    // if we've't exhausted the possibility of finding                    // loops, then make a single statement and we will pop out of the loop                    //and try the next position with a new ahead value                    if (ahead >= MAX_LOOKAHEAD) {                        //create a compressed sequence to add that is only looped once,                        //with one element in the sequence                        CompressedSequence seq1 = new CompressedSequence(1);                        seq1.addToSeq(nodes[pos]);                        compressed.addToSeq(seq1);                        pos++;                    }                } else {                    CompressedSequence comp = new CompressedSequence(reps);                                       // add the component code                    for (int i = 0; i < ahead; i++) {                        comp.addToSeq(nodes[pos + i]);                    }                    compressed.addToSeq(comp);                    //remember that some compression was performed                    didCompress = true;                    // increment the position                    pos += reps * ahead;                    // quit looking for loops                    break;                }                // increment ahead so that we have a chance the next time                // through                ahead++;            } while (ahead <= MAX_LOOKAHEAD);        }        //all done, return the compressed sequence array        return compressed;    }