public static String getElementAsString ( Element element ) { StringBuilder sb = new StringBuilder ( ) ; if ( element . isNegated ( ) != null && element . isNegated ( ) . booleanValue ( ) ) { sb . append ( "~" ) ; } int masks = element . getMask ( ) . size ( ) ; if ( masks > 1 ) { sb . append ( "(" ) ; } int maskCounter = 0 ; for ( Mask mask : element . getMask ( ) ) { // Encloses lexemes between quotes. if ( mask . getLexemeMask ( ) != null ) { sb . append ( "\"" ) . append ( mask . getLexemeMask ( ) ) . append ( "\"" ) ; } else if ( mask . getPrimitiveMask ( ) != null ) { // Primitives are enclosed between curly brackets. sb . append ( "{" ) . append ( mask . getPrimitiveMask ( ) ) . append ( "}" ) ; } else if ( mask . getTagMask ( ) != null ) { sb . append ( getTagMaskAsString ( mask . getTagMask ( ) ) ) ; } else if ( mask . getTagReference ( ) != null ) { sb . append ( getTagReferenceAsString ( mask . getTagReference ( ) ) ) ; } if ( maskCounter < masks - 1 ) { sb . append ( "|" ) ; } maskCounter ++ ; } if ( masks > 1 ) { sb . append ( ")" ) ; } return sb . toString ( ) ; }
Gets the string representation of an element .