public final class SemanticValue extends Result
| Modifier and Type | Field and Description |
|---|---|
ParseError |
error
The embedded parse error.
|
java.lang.Object |
value
The actual value.
|
| Constructor and Description |
|---|
SemanticValue(java.lang.Object value,
int index)
Create a new semantic value.
|
SemanticValue(java.lang.Object value,
int index,
ParseError error)
Create a new semantic value.
|
| Modifier and Type | Method and Description |
|---|---|
SemanticValue |
createValue(java.lang.Object value,
ParseError error)
Create a semantic value based on this result.
|
boolean |
hasValue()
Determine whether this result has a value.
|
boolean |
hasValue(java.lang.String s)
Determine whether this result has the specified string value.
|
boolean |
hasValueIgnoreCase(java.lang.String s)
Determine whether this result has the specified string value,
ignoring case.
|
ParseError |
parseError()
Get the parse error for this result.
|
ParseError |
select(ParseError error)
Select the more specific parse error.
|
ParseError |
select(ParseError error,
int index)
Select the more specific parse error.
|
<T> T |
semanticValue()
Get the semantic value for this result.
|
public final java.lang.Object value
public final ParseError error
null; instead, a dummy parse error should be used.public SemanticValue(java.lang.Object value,
int index)
value - The value.index - The index into the rest of the input.public SemanticValue(java.lang.Object value,
int index,
ParseError error)
value - The value.index - The index into the rest of the input.error - The embedded parse error.public boolean hasValue()
Resultpublic boolean hasValue(java.lang.String s)
Resultnull.public boolean hasValueIgnoreCase(java.lang.String s)
Resultnull.hasValueIgnoreCase in class Results - The string value.true if this result has the specified string
value, ignoring case.public <T> T semanticValue()
ResultsemanticValue in class Resultpublic ParseError parseError()
Resultdummy parse
error.parseError in class Resultpublic ParseError select(ParseError error)
Resultpublic ParseError select(ParseError error, int index)
Resultpublic SemanticValue createValue(java.lang.Object value, ParseError error)
Result
public SemanticValue value(Object value, ParseError error) {
return new SemanticValue(value, index, error);
}
However, for a result that already is a semantic value, a
more sophisticated implementation can avoid creating a new
semantic value if the specified actual value and parse error are
identical to those for this result.createValue in class Resultvalue - The actual value.error - The embedded parse error.Copyright © 2012. All Rights Reserved.