protected void parseCombineIntegerLists ( TokenList tokens ) { TokenList . Token t = tokens . getFirst ( ) ; if ( t == null || t . next == null ) return ; int numFound = 0 ; TokenList . Token start = null ; TokenList . Token end = null ; while ( t != null ) { if ( t . getType ( ) == Type . VARIABLE && ( isVariableInteger ( t ) || t . getVariable ( ) . getType ( ) == VariableType . INTEGER_SEQUENCE ) ) { if ( numFound == 0 ) { numFound = 1 ; start = end = t ; } else { numFound ++ ; end = t ; } } else if ( numFound > 1 ) { IntegerSequence sequence = new IntegerSequence . Combined ( start , end ) ; VariableIntegerSequence varSequence = functions . getManagerTemp ( ) . createIntegerSequence ( sequence ) ; replaceSequence ( tokens , varSequence , start , end ) ; numFound = 0 ; } else { numFound = 0 ; } t = t . next ; } if ( numFound > 1 ) { IntegerSequence sequence = new IntegerSequence . Combined ( start , end ) ; VariableIntegerSequence varSequence = functions . getManagerTemp ( ) . createIntegerSequence ( sequence ) ; replaceSequence ( tokens , varSequence , start , end ) ; } }
Looks for sequences of integer lists and combine them into one big sequence