Java Reference
In-Depth Information
for (i=0; i<store.getNumRecords(); i++) {
Location l = new Location(e.nextRecord());
result[i] = l.getLocation();
l = null;
}
closeStore();
}
catch(Exception ex) { closeStore(); }
return result;
}
public Location getLocation( final String location ) throws
RecordStoreException {
openStore();
Location l = null;
RecordEnumeration e = store.enumerateRecords(
new RecordFilter () {
public boolean matches(byte[] b) {
Location r = new Location(b);
if (r.getLocation().equalsIgnoreCase(location))
return true;
else return false;
}
},
null,
false);
if (e.hasNextElement()) {
int id = e.nextRecordId();
l = new Location(store.getRecord(id), id);
}
closeStore();
return l;
}
public void addLocation(Location l) throws RecordStoreException {
Location existing = getLocation(l.getLocation());
if (existing!=null) {
existing.setForecast(l.getForecast());
updateLocation(existing);
 
Search WWH ::




Custom Search