Hi Alessandro,
Although you might not be able to get the two outputs to correspond
exactly, you can try one of the two following options to get a closer
correspondence:
- tweak the behavior of the PrettyPrinter by:
unp.SetClassAdIndent(-1)
unp.SetListIndent(-1)
unp.SetMinimalParentheses(false)
- alternatively, you can directly use the ClassAdUnParser object
instead of the PrettyPrinter
++Rajesh
--- Alessandro Maraschini <alessandro.maraschini@xxxxxxxxxx> wrote:
> Hi, while performing some test I've came across a different behaviour
> between java & c++ classad implementation.
>
> C++ code
> =====
>
> ClassAdParser cp ;
> ClassAd* classAd = new ClassAd ();
> classAd->Insert( "one" , cp.ParseExpression( "-5" ) );
> string buffer="";
> PrettyPrint unp ;
> unp.Unparse(buffer, classAd ) ;
> cout << "OUTPUT = " << buffer << endl << flush ;
>
> C++ output
> ======
>
> OUTPUT =
> [
> one = -5
> ]
>
>
>
>
> JAVA code
> ========
>
> RecordExpr re = new RecordExpr() ;
> ClassAdParser cp = new ClassAdParser( "-5" ) ;
> re.insertAttribute( "one" , cp.parse() );
> System.out.println( "OUTPUT: " + re );
>
> JAVA output
> ==========
>
>
> OUTPUT: [ one = (-5) ]
>
>
>
>
> ---------------
>
> As you can see the use of parentesys is different, I don't know wheter
> it has been fixed in the latest java release but if not, can you please
> check it?
>
> BTW, which should be the right representation ? (I guess it's the second
> one but... never know..)
>
>
>
> thank you,
>
> Alessandro
>
>
> --
> ***
> Alessandro Maraschini
> GRID R&D Group
> Defence, Space & Environment Division
> DATAMAT S.p.A.
> Via Laurentina, 760 -I- 00143 Rome - Italy
> http://www.datamat.it
> mailto:alessandro.maraschini@xxxxxxxxxx
> Phone: +39 06 5027 4501
> Fax: +39 06 5027 2500
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
Condor Classads Info:
http://www.cs.wisc.edu/condor/classad/
|