atom feed1 message in org.codehaus.javancss.scm[javancss-scm] [javancss] [198] trunk...
FromSent OnAttachments
hbou...@codehaus.orgSep 7, 2009 2:43 pm 
Subject:[javancss-scm] [javancss] [198] trunk/src/main/java/javancss/Javancss.java: code simplification
From:hbou...@codehaus.org (hbou@codehaus.org)
Date:Sep 7, 2009 2:43:02 pm
List:org.codehaus.javancss.scm

Revision [1]198

Author hboutemy

Date 2009-09-07 16:43:19 -0500 (Mon, 07 Sep 2009)

Log Message

code simplification

Modified Paths

* [2]trunk/src/main/java/javancss/Javancss.java

Diff

Modified: trunk/src/main/java/javancss/Javancss.java (197 => 198)

--- trunk/src/main/java/javancss/Javancss.java 2009-06-23 22:08:43 UTC (rev 197) +++ trunk/src/main/java/javancss/Javancss.java 2009-09-07 21:43:19 UTC (rev 198) @@ -205,33 +205,41 @@

private void _measureSource( Reader reader ) throws IOException, Exception, Error { - Util.debug( "_measureSource(Reader).ENTER" ); - //Util.debug( "_measureSource(Reader).parser15: -->" + (_pInit.getOptions().get( "parser15" ) + "<--" ); - //Util.panicIf( _pInit == null ); - //Util.panicIf( _pInit.getOptions() == null ); - Util.debug( "_measureSource(Reader).ENTER2" ); - try - { - // create a parser object - if ( Util.isDebug() == false ) + Util.debug( "_measureSource(Reader).ENTER" ); + // Util.debug( "_measureSource(Reader).parser15: -->" + (_pInit.getOptions().get( "parser15" ) + "<--" ); + // Util.panicIf( _pInit == null ); + // Util.panicIf( _pInit.getOptions() == null ); + Util.debug( "_measureSource(Reader).ENTER2" ); + try { - if ( _pInit == null || _pInit.getOptions() == null || _pInit.getOptions().get( "parser15" ) == null ) { - Util.debug( "creating JavaParser" ); - _pJavaParser = (JavaParserInterface)(new JavaParser( reader )); - } else { - Util.debug( "creating JavaParser15" ); - _pJavaParser = (JavaParserInterface)(new JavaParser15( reader )); - } - } else { - if ( _pInit == null || _pInit.getOptions() == null || _pInit.getOptions().get( "parser15" ) == null ) { - Util.debug( "creating JavaParserDebug" ); - Util.println( "creating JavaParserDebug" ); - _pJavaParser = (JavaParserInterface)(new JavaParserDebug( reader )); - } else { - Util.debug( "creating JavaParser15Debug" ); - _pJavaParser = (JavaParserInterface)(new JavaParser15Debug( reader )); - } - } + // create a parser object + boolean parser15 = _pInit != null && _pInit.getOptions() != null && _pInit.getOptions().get( "parser15" ) != null; + if ( Util.isDebug() ) + { + if ( parser15 ) + { + Util.debug( "creating JavaParser15Debug" ); + _pJavaParser = new JavaParser15Debug( reader ); + } + else + { + Util.debug( "creating JavaParserDebug" ); + _pJavaParser = new JavaParserDebug( reader ); + } + } + else + { + if ( parser15 ) + { + Util.debug( "creating JavaParser15" ); + _pJavaParser = new JavaParser15( reader ); + } + else + { + Util.debug( "creating JavaParser" ); + _pJavaParser = new JavaParser( reader ); + } + }

// execute the parser _pJavaParser.parse();

------------------------------------------------------------------------------

To unsubscribe from this list please visit:

References