From 2e5c0de21b0f35531e3d42e63c27df80cf3fad02 Mon Sep 17 00:00:00 2001 From: dam Date: Wed, 1 Dec 2021 02:26:44 +0000 Subject: Convert from native to godot --- .../src/com/example/surgerylog/MedLogRoot.java | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100755 old_native_project/src/com/example/surgerylog/MedLogRoot.java (limited to 'old_native_project/src/com/example/surgerylog/MedLogRoot.java') diff --git a/old_native_project/src/com/example/surgerylog/MedLogRoot.java b/old_native_project/src/com/example/surgerylog/MedLogRoot.java new file mode 100755 index 0000000..073701b --- /dev/null +++ b/old_native_project/src/com/example/surgerylog/MedLogRoot.java @@ -0,0 +1,142 @@ +package com.example.surgerylog; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.List; + +public class MedLogRoot implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7337501254153966693L; + private Dictionary _typeDictionary = new Hashtable(); + private List _typeList = new ArrayList(); + + private List _firsAiderList = new ArrayList(); + private List _anesthesiaList = new ArrayList(); + private List _placeList = new ArrayList(); + + public MedLogRoot() { + } + + public void GrowTreeWithInfo(MedLogInfo info) { + // try to add new first aider + if (HasFirstAider(info.FirstAider) == false) { + AddFirstAider(info.FirstAider); + } + + // try to add new anesthesia + if (HasAnesthesia(info.Anesthesia) == false) { + AddAnesthesia(info.Anesthesia); + } + + // try to add new place + if (HasPlace(info.Place) == false) { + AddPlace(info.Place); + } + + // try to add new Type + if (HasType(info.Type) == false) { + AddType(info.Type); + } + + // Only add branches if has root... + if (HasType(info.Type) == true) { + + // get Type + MedLogType type = _typeDictionary.get(info.Type); + + // add Type related information + if (type.HasSubType(info.SubType) == false) { + type.AddSubType(info.SubType); + } + + // Only add branches if has root... + if (type.HasSubType(info.SubType) == true) { + + // get SubType + MedLogSubType subType = type.GetMedLogSubType(info.SubType); + + // add SubTyppe related information + if (subType.HasSubSubType(info.SubSubType) == false) { + subType.AddSubSubType(info.SubSubType); + } + if (subType.HasPathology(info.Pathology) == false) { + subType.AddPathology(info.Pathology); + } + if (subType.HasIntervention(info.Intervention) == false) { + subType.AddIntervention(info.Intervention); + } + } + } + } + + private Boolean IsValid(String verify) { + return verify.trim().isEmpty() == false; + } + + public Boolean HasFirstAider(String firstAider) { + return _firsAiderList.contains(firstAider.trim()); + } + + public void AddFirstAider(String firstAider) { + if (IsValid(firstAider)) + _firsAiderList.add(firstAider.trim()); + } + + public Boolean HasAnesthesia(String anesthesia) { + return _anesthesiaList.contains(anesthesia.trim()); + } + + public void AddAnesthesia(String anesthesia) { + if (IsValid(anesthesia)) + _anesthesiaList.add(anesthesia.trim()); + } + + public Boolean HasPlace(String place) { + return _placeList.contains(place.trim()); + } + + public void AddPlace(String place) { + if (IsValid(place)) + _placeList.add(place.trim()); + } + + public Boolean HasType(String type) { + return _typeList.contains(type.trim()); + } + + public void AddType(String type) { + if (IsValid(type)) { + String typeTrim = type.trim(); + + _typeList.add(typeTrim); + + MedLogType surgeryType = new MedLogType(); + _typeDictionary.put(typeTrim, surgeryType); + } + } + + public MedLogType GetMedLogType(String type) { + return _typeDictionary.get(type.trim()); + } + + public List GetTypeList() { + return _typeList; + } + + public List GetFirstAiderList() { + return _firsAiderList; + } + + public List GetAnesthesiaList() { + return _anesthesiaList; + } + + public List GetPlaceList() { + return _placeList; + } +} -- cgit v1.2.3