Skip to content

Commit

Permalink
add API to get CDT model from ID
Browse files Browse the repository at this point in the history
  • Loading branch information
slogan621 committed Dec 3, 2020
1 parent c4f724f commit 4ca6702
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
public class CDTCodesModelList {
static private CDTCodesModelList m_instance = null;
private HashMap<String, CDTCodesModel> m_list = new HashMap<String, CDTCodesModel>();
private HashMap<Integer, CDTCodesModel> m_idHash = new HashMap<Integer, CDTCodesModel>();

public ArrayList<CDTCodesModel> getModels() {
return new ArrayList<CDTCodesModel>(m_list.values());
Expand All @@ -47,6 +48,10 @@ public CDTCodesModel getModel(String repr) {
return m_list.get(repr);
}

public CDTCodesModel getModel(int id) {
return m_idHash.get(id);
}

public ArrayList<String> getReprStrings() {
return new ArrayList<String>(m_list.keySet());
}
Expand All @@ -68,6 +73,7 @@ public boolean setModelData(JSONArray items) {
try {
CDTCodesModel model = new CDTCodesModel(items.getJSONObject(i));
m_list.put(model.repr(), model);
m_idHash.put(model.getId(), model);
} catch (Exception e) {
ret = false;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,10 @@ public String[] getCDTCodesListStringArray()
return m_cdtCodesList.getReprStringArray();
}

public CDTCodesModelList getCDTCodeModelList() {
return m_cdtCodesList;
}

public static CommonSessionSingleton getInstance() {
if (m_instance == null) {
m_instance = new CommonSessionSingleton();
Expand Down

0 comments on commit 4ca6702

Please sign in to comment.