private static String prepareTotalExpression( String oldExpression,
private String prepareTotalExpression( String oldExpression,
	private static String prepareTotalExpression( String oldExpression,			List columnBindings, String groupName )	{		if ( oldExpression == null )			return null;				char[] chars = oldExpression.toCharArray( );		// 5 is the minium length of expression that can cantain a row		// expression		if ( chars.length < 8 )			return oldExpression;		else		{			ParseIndicator indicator = new ParseIndicator( 0,					0,					false,					false,					true,					true );			for ( int i = 0; i < chars.length; i++ )			{				indicator = getParseIndicator( chars,						i,						indicator.omitNextQuote( ),						indicator.getCandidateKey1( ),						indicator.getCandidateKey2( ) );				i = indicator.getNewIndex( );				if ( i >= indicator.getRetrieveSize( ) + 6 )				{					if ( indicator.isCandidateKey( )							&& chars[i - indicator.getRetrieveSize( ) - 6] == 'T'							&& chars[i - indicator.getRetrieveSize( ) - 5] == 'o'							&& chars[i - indicator.getRetrieveSize( ) - 4] == 't'							&& chars[i - indicator.getRetrieveSize( ) - 3] == 'a'							&& chars[i - indicator.getRetrieveSize( ) - 2] == 'l'							&& chars[i - indicator.getRetrieveSize( ) - 1] == '.' )					{						if ( i - indicator.getRetrieveSize( ) - 7 <= 0								|| isValidProceeding( chars[i										- indicator.getRetrieveSize( ) - 7] ) )						{							String firstPart = oldExpression.substring( 0, i									- indicator.getRetrieveSize( ) - 6 );							int startIndex = i - indicator.getRetrieveSize( ) - 6;							i = advanceToNextValidEncloser( chars, i );							String secondPart = "";							String name = "";							String expr = "";							if ( i < chars.length )							{								int endIndex = i + 1;								expr = oldExpression.substring( startIndex,										endIndex );								secondPart = prepareTotalExpression( oldExpression.substring( i										+ 1 - indicator.getRetrieveSize( ) ),										columnBindings, groupName );							}							else							{								expr = oldExpression.substring( startIndex );							}							boolean shouldAddToList = true;							for( int j = 0; j < columnBindings.size( ); j++ )							{								IBaseExpression expression = ((IColumnBinding)columnBindings.get( j )).getBoundExpression( );								if( expression instanceof IScriptExpression )								{									if( oldExpression.equals( ((IScriptExpression) expression).getText( ) ))									{										shouldAddToList = false;										name = ((IColumnBinding)columnBindings.get( j )).getResultSetColumnName( );										break;									}								}							}							if ( shouldAddToList )							{								name = TOTAL_PREFIX + totalColumnSuffix;								totalColumnSuffix++;								columnBindings.add( new ColumnBinding( name, expr, groupName ) );							}														String newExpression = firstPart									+ "row[\"" + name + "\"]" + secondPart;							return newExpression;						}					}				}			}		}		return oldExpression;	}