use of org.eclipse.nebula.widgets.nattable.filterrow.ParseResult in project nebula.widgets.nattable by eclipse.
the class FilterRowUtils method parseExpression.
/**
* Parses the text entered in the filter row. The text is parsed to figure
* out the type of match operation (<, > etc.) and the value next to
* it.
*
* @param string
* entered by the user in the filter row text box
*/
public static ParseResult parseExpression(String string) {
Scanner scanner = new Scanner(string.trim());
ParseResult parseResult = new ParseResult();
// $NON-NLS-1$
Pattern p = Pattern.compile("<>|([>|<]?=?)");
String opToken = scanner.findWithinHorizon(p, 2);
if (isNotEmpty(opToken)) {
parseResult.setMatchType(MatchType.parse(opToken));
while (scanner.hasNext()) {
parseResult.setValueToMatch(scanner.next());
}
} else {
parseResult.setValueToMatch(string);
}
scanner.close();
return parseResult;
}
use of org.eclipse.nebula.widgets.nattable.filterrow.ParseResult in project nebula.widgets.nattable by eclipse.
the class FilterRowUtils method parseLiteral.
public static ParseResult parseLiteral(String string) {
ParseResult parseResult = new ParseResult();
parseResult.setMatchType(MatchType.NONE);
parseResult.setValueToMatch(string);
return parseResult;
}
Aggregations