[Soot-list] how to handle numerical Constant in different sub-types

dingsun xyz031702 at hotmail.com
Mon Jun 28 10:47:44 EDT 2010


Dear All     If I have a binoExpr, the leftOp is DoubleConstant and the rightOp is IntConstant,  and I prefer to compare the equality between them. I use the following code:     NumericConstant n1= (NumericConstant)exp.getLeft();     NumericConstant n2= (NumericConstant)exp.getRight();          n1.equalEqual(n2);   
The soot will not allow me to do so, because there is a type checking in the soot source code:
   public NumericConstant equalEqual(NumericConstant c)    {        if (!(c instanceof DoubleConstant))            throw new IllegalArgumentException("DoubleConstant expected");        return IntConstant.v((this.value == ((DoubleConstant)c).value) ? 1 : 0);    }


So what should I do if I want to do such similar operations when the two numbers have different sub types(IntConstant, LongConstant, DoubleConstatn, FloatConstant) in a simple way.
Best Regards,Ding Sun 		 	   		  
_________________________________________________________________
约会说不清地方?来试试微软地图最新msn互动功能!
http://ditu.live.com/?form=TL&swm=1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100628/a7b91b92/attachment.html 


More information about the Soot-list mailing list