Repository for the HealthTool which enables Apple users to analyse their health data from the Apple health app and prepares the data for contributing it for future studies on wearable data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

59 lines
1.4 KiB

package application.enums;
import application.res.*;
public enum BiologicalSex
{
MALE("male", "HKBiologicalSexMale"),
FEMALE("female","HKBiologicalSexFemale"),
OTHER("other","HKBiologicalSexOther"),
NOT_SET(Text.NOT_SET,"HKBiologicalSexNotSet"),
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;
BiologicalSex(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 BiologicalSex getValue(String input)
{
if(input.equalsIgnoreCase(FEMALE.exactTag)|| input.contains(FEMALE.shortTag))
{
return FEMALE;
}
if(input.equalsIgnoreCase(MALE.exactTag)|| input.contains(MALE.shortTag))
{
return MALE;
}
if(input.equalsIgnoreCase(OTHER.exactTag)|| input.contains(OTHER.shortTag))
{
return OTHER;
}
if(input.equalsIgnoreCase(NOT_SET.exactTag)|| input.contains(NOT_SET.shortTag))
{
return NOT_SET;
}
return NOT_PARSED;
}
}