org.matheclipse.core.patternmatching
Class PatternMatcherEquals
- java.lang.Object
-
- org.matheclipse.core.patternmatching.IPatternMatcher
-
- org.matheclipse.core.patternmatching.PatternMatcherEquals
-
public class PatternMatcherEquals extends IPatternMatcher implements java.io.Serializable
Matches a given expression by simply comparing the left-hand-side expression of this pattern matcher with theequals()method.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description PatternMatcherEquals(ISymbol setSymbol, IExpr leftHandSide, IExpr rightHandSide)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanapply(IExpr lhsEvalExpr)Start pattern matching.java.lang.Objectclone()booleanequals(java.lang.Object obj)Indicates whether another object is equal to this predicate.IExpreval(IExpr lhsEvalExpr)Match the given left-hand-side and return an evaluated expressionvoidgetPatterns(java.util.List<IExpr> resultList, IExpr patternExpr)Returns the matched pattern in the order they appear in the pattern expression.IExprgetRHS()Get the "right-hand-side" of a pattern-matching rule.ISymbolgetSetSymbol()inthashCode()booleanisRuleWithoutPatterns()Check if the pattern-matchings left-hand-side expression contains no patterns.voidsetRHS(IExpr rightHandSide)-
Methods inherited from class org.matheclipse.core.patternmatching.IPatternMatcher
getLHS
-
-
-
-
Constructor Detail
-
PatternMatcherEquals
public PatternMatcherEquals(ISymbol setSymbol, IExpr leftHandSide, IExpr rightHandSide)
- Parameters:
setSymbol- the symbol which defines this pattern-matching rule (i.e. Set, SetDelayed,...)leftHandSide- could contain pattern expressions for "pattern-matching"rightHandSide- the result which should be evaluated if the "pattern-matching" succeeds
-
-
Method Detail
-
apply
public boolean apply(IExpr lhsEvalExpr)
Description copied from class:IPatternMatcherStart pattern matching.- Specified by:
applyin interfacePredicate<IExpr>- Specified by:
applyin classIPatternMatcher- Returns:
trueif theexprmatches the pattern-matchings left-hand-side expression.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classIPatternMatcher- Throws:
java.lang.CloneNotSupportedException
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:PredicateIndicates whether another object is equal to this predicate.Most implementations will have no reason to override the behavior of
Object.equals(java.lang.Object). However, an implementation may also choose to returntruewheneverobjectis aPredicatethat it considers interchangeable with this one. "Interchangeable" typically means thatthis.apply(t) == that.apply(t)for alltof typeT). Note that afalseresult from this method does not imply that the predicates are known not to be interchangeable.
-
eval
public IExpr eval(IExpr lhsEvalExpr)
Description copied from class:IPatternMatcherMatch the given left-hand-side and return an evaluated expression- Specified by:
evalin classIPatternMatcher- Returns:
nullif the match wasn't successful, the evaluated expression otherwise.
-
getPatterns
public void getPatterns(java.util.List<IExpr> resultList, IExpr patternExpr)
Description copied from class:IPatternMatcherReturns the matched pattern in the order they appear in the pattern expression.- Specified by:
getPatternsin classIPatternMatcher- Parameters:
resultList- a list instancepatternExpr- the expression which contains the pattern objects
-
getRHS
public IExpr getRHS()
Get the "right-hand-side" of a pattern-matching rule.- Overrides:
getRHSin classIPatternMatcher- Returns:
nullif no right-hand-side is defined for the pattern matcher
-
getSetSymbol
public ISymbol getSetSymbol()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isRuleWithoutPatterns
public boolean isRuleWithoutPatterns()
Description copied from class:IPatternMatcherCheck if the pattern-matchings left-hand-side expression contains no patterns.- Specified by:
isRuleWithoutPatternsin classIPatternMatcher- Returns:
true, if the given expression contains no patterns
-
setRHS
public void setRHS(IExpr rightHandSide)
-
-
DMelt 3.0 © DataMelt by jWork.ORG