diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-07-08 09:42:07 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-07-08 09:42:07 +0400 |
commit | 4f1481208d60db88be5390f0584dc5e33fd83571 (patch) | |
tree | aa1764074b3f111cd3cf80447c167da2edae6053 /src/org/traccar/model/DatabaseDataManager.java | |
parent | a5dff88bb3ec84224240f6a40965234b58e9ad85 (diff) | |
download | trackermap-server-4f1481208d60db88be5390f0584dc5e33fd83571.tar.gz trackermap-server-4f1481208d60db88be5390f0584dc5e33fd83571.tar.bz2 trackermap-server-4f1481208d60db88be5390f0584dc5e33fd83571.zip |
Use generics
Diffstat (limited to 'src/org/traccar/model/DatabaseDataManager.java')
-rw-r--r-- | src/org/traccar/model/DatabaseDataManager.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/model/DatabaseDataManager.java b/src/org/traccar/model/DatabaseDataManager.java index f312c3dcd..384d87828 100644 --- a/src/org/traccar/model/DatabaseDataManager.java +++ b/src/org/traccar/model/DatabaseDataManager.java @@ -114,7 +114,7 @@ public class DatabaseDataManager implements DataManager { public synchronized List<Device> getDevices() throws SQLException { - List<Device> deviceList = new LinkedList(); + List<Device> deviceList = new LinkedList<Device>(); queryGetDevices.prepare(); ResultSet result = queryGetDevices.executeQuery(); @@ -165,21 +165,21 @@ public class DatabaseDataManager implements DataManager { /** * Devices cache */ - private Map devices; + private Map<String, Device> devices; private Calendar devicesLastUpdate; private Long devicesRefreshDelay; public Device getDeviceByImei(String imei) throws SQLException { if ((devices == null) || (Calendar.getInstance().getTimeInMillis() - devicesLastUpdate.getTimeInMillis() > devicesRefreshDelay)) { - devices = new HashMap(); + devices = new HashMap<String, Device>(); for (Device device: getDevices()) { devices.put(device.getImei(), device); } devicesLastUpdate = Calendar.getInstance(); } - return (Device) devices.get(imei); + return devices.get(imei); } public Device getDeviceByPhoneNumber(String phoneNumber) { @@ -194,7 +194,7 @@ public class DatabaseDataManager implements DataManager { public synchronized List<Position> getPositions(Long deviceId) throws SQLException { - List<Position> positionList = new LinkedList(); + List<Position> positionList = new LinkedList<Position>(); queryGetPositions.prepare(); queryGetPositions.setLong("device_id", deviceId); |