package application.enums; import application.res.*; //https://developer.apple.com/documentation/healthkit/hkfitzpatrickskintype public enum SkinType { CASE_I("pale white skin", "HKFitzpatrickSkinTypeI"), //Pale white skin that always burns easily in the sun and never tans. CASE_II("white skin", "HKFitzpatrickSkinTypeII"), //White skin that burns easily and tans minimally. CASE_III("white to light brown skin", "HKFitzpatrickSkinTypeIII"), //White to light brown skin that burns moderately and tans uniformly. CASE_IV("beige-olive skin", "HKFitzpatrickSkinTypeIV"), //Beige-olive, lightly tanned skin that burns minimally and tans moderately. CASE_V("brown skin", "HKFitzpatrickSkinTypeV"), //Brown skin that rarely burns and tans profusely. CASE_VI("dark brown to black skin", "HKFitzpatrickSkinTypeVI"), //Dark brown to black skin that never burns and tans profusely. NOT_SET(Text.NOT_SET,"HKFitzpatrickSkinTypeNotSet"), NOT_PARSED("",""); //Those two are used to match the found values with the enum /** A word which could be contained**/ private final String shortTag; /** The exact value the attribute should have, but I don't know if they are correct **/ private final String exactTag; SkinType(String shor, String exact) { this.shortTag=shor; this.exactTag=exact; } /** * Returns a short string which can be used to identify the value. Readable for users. * @return the respective String */ public String getReadableValue() { return shortTag; } /** * For the input string returns the matching enum value * @param input String to compare * @return matched enum value */ public static SkinType getValue(String input) { if(input.equalsIgnoreCase(CASE_I.exactTag)|| input.contains(CASE_I.shortTag)) { return CASE_I; } if(input.equalsIgnoreCase(CASE_II.exactTag)|| input.contains(CASE_II.shortTag)) { return CASE_II; } if(input.equalsIgnoreCase(CASE_III.exactTag)|| input.contains(CASE_III.shortTag)) { return CASE_II; } if(input.equalsIgnoreCase(CASE_IV.exactTag)|| input.contains(CASE_IV.shortTag)) { return CASE_IV; } if(input.equalsIgnoreCase(CASE_V.exactTag)|| input.contains(CASE_V.shortTag)) { return CASE_V; } if(input.equalsIgnoreCase(CASE_VI.exactTag)|| input.contains(CASE_VI.shortTag)) { return CASE_VI; } if(input.equalsIgnoreCase(NOT_SET.exactTag)|| input.contains(NOT_SET.shortTag)) { return NOT_SET; } return NOT_PARSED; } }