关于RMS记录排序的问题
我照例子上写的代码怎么在3条记录及以下时可以正常排序,超过3条后又成乱序了。代码如下。
public DXD[] listRecord() throws ApplicationException
{
DXD[] dxds = new DXD[0];
RecordEnumeration re = null;
if (rs_dxd == null){
return dxds;
}
try
{
re = rs_dxd.enumerateRecords(null, new dxdComparator(), false);
dxds = new DXD[re.numRecords()];
int dxdRecords = 0;
while (re.hasNextElement()) {
byte[] tmp = re.nextRecord();
dxds[dxdRecords] = DXD.deserialize(tmp);
dxdRecords++;
}
return dxds;
}
catch (
IOException e)
{
e.printStackTrace();
return new DXD[0];
} catch (RecordStoreException e)
{
e.printStackTrace();
return new DXD[0];
}
}
private static class dxdComparator implements RecordComparator{
public int compare(byte[] dxd_1, byte[] dxd_2) {
try {
DXD dxd1 = DXD.deserialize(dxd_1);
DXD dxd2 = DXD.deserialize(dxd_2);
double id1 = dxd1.getid();