p1&&p2, or a sum of products p1||p2.
I have scoped the AND, OR, and Predicate subclasses of
SemanticContext within the scope of this outer class.
| Modifier and Type | Class and Description |
|---|---|
| public static class | SemanticContext.AND
A semantic context which is true whenever none of the contained contexts is false. |
| public static class | |
| public abstract static class | SemanticContext.Operator
This is the base class for semantic context "operators", which operate on a collection of semantic context "operands". |
| public static class | SemanticContext.OR
A semantic context which is true whenever at least one of the contained contexts is true. |
| public static class | |
| public static class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static SemanticContext | |
| public abstract boolean | eval(Recognizer<?, ?> parser, RuleContext parserCallStack)
For context independent predicates, we evaluate them without a local context (i.e., null context). |
| public SemanticContext | Returns: The simplified semantic context after precedence predicates are evaluated, which will be one of the following values.
The parser instance. parser, RuleContext parserCallStack)Evaluate the precedence predicates for the context and reduce the result. |
| private static List | |
| public static SemanticContext |
| SemanticContext | back to summary |
|---|---|
| public SemanticContext() | |
| and | back to summary |
|---|---|
| public static SemanticContext and(SemanticContext a, SemanticContext b) | |
| eval | back to summary |
|---|---|
| public abstract boolean eval(Recognizer<?, ?> parser, RuleContext parserCallStack) For context independent predicates, we evaluate them without a local context (i.e., null context). That way, we can evaluate them without having to create proper rule-specific context during prediction (as opposed to the parser, which creates them naturally). In a practical sense, this avoids a cast exception from RuleContext to myruleContext. For context dependent predicates, we must pass in a local context so that references such as $arg evaluate properly as _localctx.arg. We only capture context dependent predicates in the context in which we begin prediction, so we passed in the outer context here in case of context dependent predicate evaluation. | |
| evalPrecedence | back to summary |
|---|---|
| public SemanticContext evalPrecedence(Recognizer<?, ?> parser, RuleContext parserCallStack) Evaluate the precedence predicates for the context and reduce the result.
| |
| filterPrecedencePredicates | back to summary |
|---|---|
| private static List | |
| or | back to summary |
|---|---|
| public static SemanticContext or(SemanticContext a, SemanticContext b) | |
| Modifier and Type | Field and Description |
|---|---|
| public final SemanticContext[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public boolean | eval(Recognizer<?, ?> parser, RuleContext parserCallStack)
Implements abstract org. |
| public SemanticContext | evalPrecedence(Recognizer<?, ?>
The parser instance. parser, RuleContext parserCallStack)Overrides org. |
| public Collection | getOperands()
Implements abstract org. |
| public int | |
| public String |
| opnds | back to summary |
|---|---|
| public final SemanticContext[] opnds | |
| AND | back to summary |
|---|---|
| public AND(SemanticContext a, SemanticContext b) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| eval | back to summary |
|---|---|
| public boolean eval(Recognizer<?, ?> parser, RuleContext parserCallStack) Implements abstract org. Doc from org. For context independent predicates, we evaluate them without a local context (i.e., null context). That way, we can evaluate them without having to create proper rule-specific context during prediction (as opposed to the parser, which creates them naturally). In a practical sense, this avoids a cast exception from RuleContext to myruleContext. For context dependent predicates, we must pass in a local context so that references such as $arg evaluate properly as _localctx.arg. We only capture context dependent predicates in the context in which we begin prediction, so we passed in the outer context here in case of context dependent predicate evaluation. The evaluation of predicates by this context is short-circuiting, but unordered.
| |
| evalPrecedence | back to summary |
|---|---|
| public SemanticContext evalPrecedence(Recognizer<?, ?> parser, RuleContext parserCallStack) Overrides org. Doc from org. Evaluate the precedence predicates for the context and reduce the result.
| |
| getOperands | back to summary |
|---|---|
| public Collection Implements abstract org. Doc from org. Gets the operands for the semantic context operator.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final SemanticContext. | Instance
The default |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | eval(Recognizer<?, ?> parser, RuleContext parserCallStack)
Implements abstract org. |
| Instance | back to summary |
|---|---|
| public static final SemanticContext. The default | |
| Empty | back to summary |
|---|---|
| public Empty() | |
| eval | back to summary |
|---|---|
| public boolean eval(Recognizer<?, ?> parser, RuleContext parserCallStack) Implements abstract org. Doc from org. For context independent predicates, we evaluate them without a local context (i.e., null context). That way, we can evaluate them without having to create proper rule-specific context during prediction (as opposed to the parser, which creates them naturally). In a practical sense, this avoids a cast exception from RuleContext to myruleContext. For context dependent predicates, we must pass in a local context so that references such as $arg evaluate properly as _localctx.arg. We only capture context dependent predicates in the context in which we begin prediction, so we passed in the outer context here in case of context dependent predicate evaluation.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract Collection | Returns: a collection ofSemanticContext operands for the
operator.Gets the operands for the semantic context operator. |
| Operator | back to summary |
|---|---|
| public Operator() | |
| getOperands | back to summary |
|---|---|
| public abstract Collection Gets the operands for the semantic context operator.
| |
| Modifier and Type | Field and Description |
|---|---|
| public final SemanticContext[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public boolean | eval(Recognizer<?, ?> parser, RuleContext parserCallStack)
Implements abstract org. |
| public SemanticContext | evalPrecedence(Recognizer<?, ?>
The parser instance. parser, RuleContext parserCallStack)Overrides org. |
| public Collection | getOperands()
Implements abstract org. |
| public int | |
| public String |
| opnds | back to summary |
|---|---|
| public final SemanticContext[] opnds | |
| OR | back to summary |
|---|---|
| public OR(SemanticContext a, SemanticContext b) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| eval | back to summary |
|---|---|
| public boolean eval(Recognizer<?, ?> parser, RuleContext parserCallStack) Implements abstract org. Doc from org. For context independent predicates, we evaluate them without a local context (i.e., null context). That way, we can evaluate them without having to create proper rule-specific context during prediction (as opposed to the parser, which creates them naturally). In a practical sense, this avoids a cast exception from RuleContext to myruleContext. For context dependent predicates, we must pass in a local context so that references such as $arg evaluate properly as _localctx.arg. We only capture context dependent predicates in the context in which we begin prediction, so we passed in the outer context here in case of context dependent predicate evaluation. The evaluation of predicates by this context is short-circuiting, but unordered.
| |
| evalPrecedence | back to summary |
|---|---|
| public SemanticContext evalPrecedence(Recognizer<?, ?> parser, RuleContext parserCallStack) Overrides org. Doc from org. Evaluate the precedence predicates for the context and reduce the result.
| |
| getOperands | back to summary |
|---|---|
| public Collection Implements abstract org. Doc from org. Gets the operands for the semantic context operator.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| public final int |
| Access | Constructor and Description |
|---|---|
| protected | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(SemanticContext.
the object to be compared. oImplements java. |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public boolean | eval(Recognizer<?, ?> parser, RuleContext parserCallStack)
Implements abstract org. |
| public SemanticContext | evalPrecedence(Recognizer<?, ?>
The parser instance. parser, RuleContext parserCallStack)Overrides org. |
| public int | |
| public String |
| precedence | back to summary |
|---|---|
| public final int precedence | |
| PrecedencePredicate | back to summary |
|---|---|
| protected PrecedencePredicate() | |
| PrecedencePredicate | back to summary |
|---|---|
| public PrecedencePredicate(int precedence) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(SemanticContext. Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| eval | back to summary |
|---|---|
| public boolean eval(Recognizer<?, ?> parser, RuleContext parserCallStack) Implements abstract org. Doc from org. For context independent predicates, we evaluate them without a local context (i.e., null context). That way, we can evaluate them without having to create proper rule-specific context during prediction (as opposed to the parser, which creates them naturally). In a practical sense, this avoids a cast exception from RuleContext to myruleContext. For context dependent predicates, we must pass in a local context so that references such as $arg evaluate properly as _localctx.arg. We only capture context dependent predicates in the context in which we begin prediction, so we passed in the outer context here in case of context dependent predicate evaluation.
| |
| evalPrecedence | back to summary |
|---|---|
| public SemanticContext evalPrecedence(Recognizer<?, ?> parser, RuleContext parserCallStack) Overrides org. Doc from org. Evaluate the precedence predicates for the context and reduce the result.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| public final boolean | |
| public final int | |
| public final int |
| Access | Constructor and Description |
|---|---|
| protected | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public boolean | eval(Recognizer<?, ?> parser, RuleContext parserCallStack)
Implements abstract org. |
| public int | |
| public String |
| isCtxDependent | back to summary |
|---|---|
| public final boolean isCtxDependent | |
| predIndex | back to summary |
|---|---|
| public final int predIndex | |
| ruleIndex | back to summary |
|---|---|
| public final int ruleIndex | |
| Predicate | back to summary |
|---|---|
| protected Predicate() | |
| Predicate | back to summary |
|---|---|
| public Predicate(int ruleIndex, int predIndex, boolean isCtxDependent) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| eval | back to summary |
|---|---|
| public boolean eval(Recognizer<?, ?> parser, RuleContext parserCallStack) Implements abstract org. Doc from org. For context independent predicates, we evaluate them without a local context (i.e., null context). That way, we can evaluate them without having to create proper rule-specific context during prediction (as opposed to the parser, which creates them naturally). In a practical sense, this avoids a cast exception from RuleContext to myruleContext. For context dependent predicates, we must pass in a local context so that references such as $arg evaluate properly as _localctx.arg. We only capture context dependent predicates in the context in which we begin prediction, so we passed in the outer context here in case of context dependent predicate evaluation.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |