private FieldTextBuilder binaryOp ( final String operator , final FieldTextBuilder fieldText ) { // Special case when we're empty if ( componentCount == 0 ) { // Just copy the argument fieldTextString . append ( fieldText . fieldTextString ) ; lastOperator = fieldText . lastOperator ; not = fieldText . not ; componentCount = fieldText . componentCount ; } else { // Add the NOTs, parentheses and operator addOperator ( operator ) ; if ( fieldText . lastOperator == null || fieldText . lastOperator . equals ( operator ) || fieldText . not ) { fieldTextString . append ( fieldText . toString ( ) ) ; } else { fieldTextString . append ( ' ' ) . append ( fieldText . toString ( ) ) . append ( ' ' ) ; } componentCount += fieldText . size ( ) ; not = false ; } return this ; }
Does the work for the OR AND and XOR methods in the optimized case where fieldText is a FieldTextBuilder .