From: Peter C. M. <pcm...@em...> - 2005-07-29 21:08:01
|
Outch! Index screwup in ElementInfo.get/setLongElement(), no idea how this sneaked in. The index values in Fields are int[] based, so the ElementInfo methods have to be adjusted *2: public void setLongElement(int index, long value) { checkArray(index); cloneFields().setLongValue(index*2, value); } public long getLongElement(int index) { checkArray(index); return fields.getLongValue(index*2); } It's committed, but as always it takes a while until this shows up in the public CVS -- Peter On Jul 29, 2005, at 1:08 PM, Chiu C. Tan wrote: > Hi > > I experimenting with Java Pathfinder for a class and came across a > strange behaviour. > In a nutshell, I have an array of 4 doubles, [0.0, 1.0, 2.0, 3.0] > and I > want to swap the first element with the > third element. So the final result should be [0.0, 3.0, 2.0, 1.0]. > > However, running this simple code through jpf shows that after the > swap, > the array becomes > [0.0, 3.0, 0.0, 1.0] > > (The actual values are a little different, I just rounded them up for > clarity.) > Does anyone have an explanation for this? > > Thanks > Chiu > |