package foundation.action; public enum Moment { Before, After, On; public static Moment parse(String value) { if (value == null) { return On; } value = value.toLowerCase(); if ("before".equals(value)) { return Before; } else if ("after".equals(value)) { return After; } return On; } public static int subtract(Moment one, Moment another) { if (one == null) { if (another == null) { return 0; } else if (Moment.Before == another) { return 1; } else if (Moment.After == another) { return -1; } } else if (Moment.Before == one) { if (another == null) { return -1; } else if (Moment.Before == another) { return 0; } else if (Moment.After == another) { return -1; } } else if (Moment.After == one) { if (another == null) { return 1; } else if (Moment.Before == another) { return 1; } else if (Moment.After == another) { return 0; } } return 0; } }