com.google.appengine.api.search.query
Class ParserUtils

java.lang.Object
  extended by com.google.appengine.api.search.query.ParserUtils

public class ParserUtils
extends java.lang.Object

A helper class that holds various, state-less utility functions used by the query parser.


Method Summary
static boolean isDate(java.lang.String text)
          Returns if the given string looks like a date to us.
static boolean isNumber(java.lang.String text)
          Returns whether or not the given text looks like a number.
static java.lang.String normalizePhrase(java.lang.String phrase)
          Normalizes the phrase text.
static java.lang.String trimLast(java.lang.String text)
          Removes the last character from the given text
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

trimLast

public static java.lang.String trimLast(java.lang.String text)
Removes the last character from the given text


normalizePhrase

public static java.lang.String normalizePhrase(java.lang.String phrase)
Normalizes the phrase text. It strips external quote characters. Replaces white space with a single space character. Converts escape sequences to Java characters.

Parameters:
phrase - the phrase to be normalized
Returns:
the phrase with characters and white space normalized

isNumber

public static boolean isNumber(java.lang.String text)
Returns whether or not the given text looks like a number. The number is defined as '-'? digit* ('.' digit* ('E' ('+' | '-')? digit+)?)?

Parameters:
text - the text tested if it looks like a number
Returns:
whether or not the text represents a floating point number

isDate

public static boolean isDate(java.lang.String text)
Returns if the given string looks like a date to us. We only accept ISO 8601 dates, which have the dddd-dd-dd format.

Parameters:
text - text checked if it looks like a date
Returns:
whether this could be an ISO 8601 date