Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

package gov.va.med.pbm.ampl.utility.operations;

/**
* This class provides the allowable operators used in a search query.
*
* @author Ian Meinert
* @since 1.0
*/
public enum SearchOperators {
/**
* the equality operator.
*/
EQUALITY(":"),

/**
* the negation operator.
*/
NEGATION("!"),

/**
* the greater than operator.
*/
GREATER_THAN(">"),

/**
* the greater than or equal to operator.
*/
GREATER_THAN_OR_EQUAL_TO(">:"),

/**
* the less than operator.
*/
LESS_THAN("<"),

/**
* the less than or equal to operator.
*/
LESS_THAN_OR_EQUAL_TO("<:"),

/**
* the contains to operator.
*/
CONTAINS("~");

private final String value;

/**
* The constructor enables string value of given enum.
*
* @param value String
*/
SearchOperators(String value) {
this.value = value;
}

/**
* The string value of the enum.
*
* @return String
*/
public String getValue() {
return value;
}

/**
* A collection of the acceptable formats for the operators.
*/
public static final String[] SIMPLE_OPERATION_SET = { ":", "!", ">", "<", ">:", "<:", "~" };

/**
* Gets the enum representation for a given operator.
*
* @param input String value of key
* @return enum
*/
public static SearchOperators getSimpleOperation(String input) {
switch (input) {
case ":":
return EQUALITY;
case "!":
return NEGATION;
case ">":
return GREATER_THAN;
case ">:":
return GREATER_THAN_OR_EQUAL_TO;
case "<":
return LESS_THAN;
case "<:":
return LESS_THAN_OR_EQUAL_TO;
case "~":
return CONTAINS;
default:
return null;
}
}
}