public void setFidelity ( String key , boolean decision ) throws UnsupportedOption { if ( key . equals ( FEATURE_STRICT ) ) { if ( decision ) { // no other features allowed // (LEXICAL_VALUE is an exception) boolean prevContainedLexVal = options . contains ( FEATURE_LEXICAL_VALUE ) ; options . clear ( ) ; isComment = false ; isPI = false ; isDTD = false ; isPrefix = false ; isLexicalValue = false ; isSC = false ; if ( prevContainedLexVal ) { options . add ( FEATURE_LEXICAL_VALUE ) ; isLexicalValue = true ; } options . add ( FEATURE_STRICT ) ; isStrict = true ; } else { // remove strict (if present) options . remove ( key ) ; isStrict = false ; } } else if ( key . equals ( FEATURE_LEXICAL_VALUE ) ) { // LEXICAL_VALUE is special --> does affect grammars if ( decision ) { options . add ( key ) ; isLexicalValue = true ; } else { // remove option (if present) options . remove ( key ) ; isLexicalValue = false ; } } else if ( key . equals ( FEATURE_COMMENT ) || key . equals ( FEATURE_PI ) || key . equals ( FEATURE_DTD ) || key . equals ( FEATURE_PREFIX ) || key . equals ( FEATURE_SC ) ) { if ( decision ) { if ( isStrict ( ) ) { options . remove ( FEATURE_STRICT ) ; this . isStrict = false ; // TODO inform user that STRICT mode is de-activated // throw new UnsupportedOption( // "StrictMode is exclusive and does not allow any other option."); } options . add ( key ) ; if ( key . equals ( FEATURE_COMMENT ) ) { isComment = true ; } if ( key . equals ( FEATURE_PI ) ) { isPI = true ; } if ( key . equals ( FEATURE_DTD ) ) { isDTD = true ; } if ( key . equals ( FEATURE_PREFIX ) ) { isPrefix = true ; } if ( key . equals ( FEATURE_SC ) ) { isSC = true ; } } else { // remove option (if present) options . remove ( key ) ; if ( key . equals ( FEATURE_COMMENT ) ) { isComment = false ; } if ( key . equals ( FEATURE_PI ) ) { isPI = false ; } if ( key . equals ( FEATURE_DTD ) ) { isDTD = false ; } if ( key . equals ( FEATURE_PREFIX ) ) { isPrefix = false ; } if ( key . equals ( FEATURE_SC ) ) { isSC = false ; } } } else { throw new UnsupportedOption ( "FidelityOption '" + key + "' is unknown!" ) ; } }
Enables or disables the specified fidelity feature .