Package org.antlr.analysis
Class SemanticContext.CommutativePredicate
- java.lang.Object
-
- org.antlr.analysis.SemanticContext
-
- org.antlr.analysis.SemanticContext.CommutativePredicate
-
- Direct Known Subclasses:
SemanticContext.AND
,SemanticContext.OR
- Enclosing class:
- SemanticContext
public abstract static class SemanticContext.CommutativePredicate extends SemanticContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.antlr.analysis.SemanticContext
SemanticContext.AND, SemanticContext.CommutativePredicate, SemanticContext.FalsePredicate, SemanticContext.NOT, SemanticContext.OR, SemanticContext.Predicate, SemanticContext.TruePredicate
-
-
Field Summary
Fields Modifier and Type Field Description protected int
hashcode
protected java.util.Set<SemanticContext>
operands
-
Fields inherited from class org.antlr.analysis.SemanticContext
EMPTY_SEMANTIC_CONTEXT
-
-
Constructor Summary
Constructors Constructor Description CommutativePredicate(java.util.HashSet<SemanticContext> contexts)
CommutativePredicate(SemanticContext a, SemanticContext b)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
calculateHashCode()
abstract SemanticContext
combinePredicates(SemanticContext left, SemanticContext right)
boolean
equals(java.lang.Object obj)
SemanticContext
getGatedPredicateContext()
Given a semantic context expression tree, return a tree with all nongated predicates set to true and then reduced.abstract java.lang.String
getOperandString()
int
hashCode()
boolean
hasUserSemanticPredicate()
boolean
isSyntacticPredicate()
java.lang.String
toString()
void
trackUseOfSyntacticPredicates(Grammar g)
Notify the indicated grammar of any syn preds used within this context-
Methods inherited from class org.antlr.analysis.SemanticContext
and, factorAnd, factorOr, genExpr, getAndOperands, getOrOperands, not, or
-
-
-
-
Field Detail
-
operands
protected final java.util.Set<SemanticContext> operands
-
hashcode
protected int hashcode
-
-
Constructor Detail
-
CommutativePredicate
public CommutativePredicate(SemanticContext a, SemanticContext b)
-
CommutativePredicate
public CommutativePredicate(java.util.HashSet<SemanticContext> contexts)
-
-
Method Detail
-
getGatedPredicateContext
public SemanticContext getGatedPredicateContext()
Description copied from class:SemanticContext
Given a semantic context expression tree, return a tree with all nongated predicates set to true and then reduced. So p&&(q||r) would return p&&r if q is nongated but p and r are gated.- Specified by:
getGatedPredicateContext
in classSemanticContext
-
hasUserSemanticPredicate
public boolean hasUserSemanticPredicate()
- Specified by:
hasUserSemanticPredicate
in classSemanticContext
-
isSyntacticPredicate
public boolean isSyntacticPredicate()
- Specified by:
isSyntacticPredicate
in classSemanticContext
-
trackUseOfSyntacticPredicates
public void trackUseOfSyntacticPredicates(Grammar g)
Description copied from class:SemanticContext
Notify the indicated grammar of any syn preds used within this context- Overrides:
trackUseOfSyntacticPredicates
in classSemanticContext
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getOperandString
public abstract java.lang.String getOperandString()
-
combinePredicates
public abstract SemanticContext combinePredicates(SemanticContext left, SemanticContext right)
-
calculateHashCode
public abstract int calculateHashCode()
-
-