Package com.yahoo.prelude.query
Class Substring
- java.lang.Object
-
- com.yahoo.prelude.query.Substring
-
public class Substring extends Object
An substring which also provides access to the full (query) string it is a substring of. This is a value object.- Author:
- bratseth
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
charAfter(int n)
Returns the character n places (0 base) after the end of the value substring into the superstring.char
charBefore(int n)
Returns the character n places (0 base) before the start of the value substring into the superstring.boolean
equals(Object o)
String
getSuperstring()
Returns the entire string this is a substring of.String
getValue()
int
hashCode()
String
toString()
-
-
-
Field Detail
-
start
public final int start
The start of the substring
-
end
public final int end
The end of the substring
-
string
public final String string
The string this is a substring of
-
-
Method Detail
-
getValue
public String getValue()
-
getSuperstring
public String getSuperstring()
Returns the entire string this is a substring of. The start and end offsets are into this string.
-
charAfter
public char charAfter(int n)
Returns the character n places (0 base) after the end of the value substring into the superstring. For example charAfter(0) returns the first character after the end of the substring- Returns:
- the char n planes after the end of the substring
- Throws:
IndexOutOfBoundsException
- if the string is not long enough to have a character at this position
-
charBefore
public char charBefore(int n)
Returns the character n places (0 base) before the start of the value substring into the superstring. For example charBefore(0) returns the first character before the start of the substring- Returns:
- the char n planes before the start of the substring
- Throws:
IndexOutOfBoundsException
- if the string does not have a character at this position
-
-