Well I feel kind of dumb.
I found my problem..
It is specifically at the rounding function of the implementation of my
FieldBridgeThe relevant snippet of the bridge is the following:
Code:
private long round(double price)
{
double rounded = Math.floor(price / 3) * 3;
if (rounded != price)
{
rounded += 3; //we round up
}
return (long) rounded;
}
Notice for
price = 100000 the variable
rounded is
99999After checking the
if condition since its different from
price, it will add 3, hence indexing 100002 instead of 100000, therefore If I look up for 100002 I will find the appropriate record..
Lesson learned here:
[*]If you are implementing a customized DoubleBridge that pads and/or rounds make sure the rounding function meets all your data value ranges to avoid problems like the one I had..
[*]If you need to show in screen rounded up Doubles in plain notation and not scientific, you will need to implemnt a
TwoWayStringBridge that performs the
ObjectToString conversion padding and rounding and later on the StringToObject conversion returning a plain notation Double and not on its scientific notation.
Hope this post can help anyone with similar issues. Greets