fix: removed unused file
This commit is contained in:
parent
edc3243a8e
commit
3067e47dc6
@ -1,53 +0,0 @@
|
|||||||
package eirb.pg203.weather.utils;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
class Cache {
|
|
||||||
HashMap<String, String> hashMap;
|
|
||||||
|
|
||||||
public Cache() {
|
|
||||||
this.hashMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean has(String key) {
|
|
||||||
return this.hashMap.get(key) == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String get(String key) {
|
|
||||||
return this.hashMap.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set(String key, String value) {
|
|
||||||
this.hashMap.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void flush() {
|
|
||||||
this.hashMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fromString(String input) {
|
|
||||||
JSONArray data = new JSONArray(input);
|
|
||||||
|
|
||||||
for (int i = 0 ; i < data.length() ; ++i)
|
|
||||||
{
|
|
||||||
JSONObject entry = data.getJSONObject(i);
|
|
||||||
String key = entry.getString("key");
|
|
||||||
String value = entry.getString("value");
|
|
||||||
|
|
||||||
this.hashMap.put(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String exportString() {
|
|
||||||
JSONArray data = new JSONArray();
|
|
||||||
|
|
||||||
for (String key: this.hashMap.keySet())
|
|
||||||
data.put(this.hashMap.get(key));
|
|
||||||
|
|
||||||
return data.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user