protected List < EquPart > multiplize ( final List < EquPart > oldTokens ) { final EquPart [ ] equParts = oldTokens . toArray ( new EquPart [ 0 ] ) ; final EquPart [ ] fixed = new EquPart [ equParts . length * 2 ] ; /* * )(, operand (, operand operand, operand function, ) operand, ) * function */ fixed [ 0 ] = equParts [ 0 ] ; EquPart m ; int left = 0 ; for ( int right = 1 ; right < equParts . length ; right ++ ) { if ( fixed [ left ] . multiplize ( equParts [ right ] ) ) { m = new OpMultiply ( fixed [ left ] ) ; left ++ ; fixed [ left ] = m ; } left ++ ; fixed [ left ] = equParts [ right ] ; } final List < EquPart > tokens = new ArrayList <> ( ) ; for ( int i = 0 ; i < fixed . length ; i ++ ) if ( fixed [ i ] != null ) tokens . add ( fixed [ i ] ) ; return tokens ; }
put implied multipliers into the equation