public class Pattern extends Blank
x_
)fCondition
ASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID
Constructor and Description |
---|
Pattern(ISymbol symbol,
IExpr condition,
boolean def)
package private
|
Modifier and Type | Method and Description |
---|---|
int[] |
addPattern(PatternMap patternMap,
java.util.Map<IExpr,java.lang.Integer> patternIndexMap)
Add this pattern to the given
patternMap and patternIndexMap . |
int |
compareTo(IExpr expr)
Compares this expression with the specified expression for order.
|
boolean |
equals(java.lang.Object obj)
Test if this is equal to b.
|
boolean |
equivalent(IPatternObject patternObject,
PatternMap pm1,
PatternMap pm2)
Check if the two left-hand-side pattern expressions are equivalent.
|
java.lang.String |
fullFormString()
Return the
FullForm() of this expression |
int |
getIndex(PatternMap pm)
Get the pattern-matchers index in the
PatternMap |
ISymbol |
getSymbol()
Get the associated symbol for this pattern-object
|
int |
hashCode()
Hashcode of this Element.
|
ISymbol |
head()
If this object is an instance of
IAST get the first element
(offset 0) of the IAST list (i.e. get(0) ). |
int |
hierarchy()
A unique integer ID for the implementation of this expression
|
java.lang.String |
internalJavaString(boolean symbolsAsFactoryMethod,
int depth,
boolean useOperaators)
Return the internal Java form of this expression.
|
boolean |
isBlank()
Test if this expression is a
Blank[] object |
boolean |
isConditionMatched(IExpr expr,
PatternMap patternMap)
Return
true , if the expression fullfills the patterns
additional condition |
boolean |
isPattern()
Test if this expression is a
Pattern[symbol] object |
boolean |
matchPattern(IExpr expr,
PatternMap patternMap)
Check if this pattern object matches the given
expr . |
java.lang.String |
toString() |
static IPattern |
valueOf(ISymbol symbol) |
static IPattern |
valueOf(ISymbol symbol,
IExpr check) |
static IPattern |
valueOf(ISymbol symbol,
IExpr check,
boolean def) |
accept, accept, accept, accept, getCondition, getEvalFlags, isCase, isFreeOfPatterns, isPatternDefault, isPatternExpr, valueOf, valueOf, variables2Slots
$div, $minus, $plus, $times, $up, abs, and, apply, apply, asType, conjugate, copy, dec, divide, egcd, evalComplex, evalDouble, evalNumber, evalSignedNumber, factory, gcd, getAt, inc, internalFormString, internalScalaString, inverse, leafCount, leaves, minus, mod, multiply, negate, negative, opposite, optional, or, plus, power, power, remainder, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceRepeated, replaceSlots, signum, subtract, sum, times, topHead, toScript, toScriptFactory
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
$div, $minus, $plus, $times, $up, and, apply, apply, asType, dec, divide, evalComplex, evalDouble, evalNumber, evalSignedNumber, evaluate, evaluateHead, getAt, getField, ifPresent, inc, internalFormString, internalScalaString, inverse, isAllExpanded, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAST, isAST, isAST, isAST, isAST, isAST, isAST, isASTSizeGE, isAtom, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isConstant, isCos, isCosh, isDerivative, isDirectedInfinity, isE, isExpanded, isFalse, isFlatAST, isFraction, isFree, isFree, isFree, isFreeAST, isFreeAST, isFunction, isGEOrdered, isGTOrdered, isIndeterminate, isInfinity, isInteger, isIntegerResult, isLEOrdered, isList, isListOfLists, isLog, isLTOrdered, isMatrix, isMember, isMember, isMinusOne, isModule, isNegative, isNegativeInfinity, isNegativeResult, isNonNegativeResult, isNot, isNumber, isNumEqualInteger, isNumEqualRational, isNumeric, isNumericFunction, isNumericMode, isNumIntValue, isOne, isONE, isOr, isOrderlessAST, isPatternSequence, isPi, isPlus, isPlusTimesPower, isPolynomial, isPolynomial, isPolynomialOfMaxDegree, isPositive, isPositiveResult, isPower, isPresent, isRational, isRationalResult, isRationalValue, isRealResult, isRuleAST, isSame, isSame, isSequence, isSignedNumber, isSin, isSinh, isSlot, isSlotSequence, isSpan, isSymbol, isTan, isTanh, isTimes, isTrue, isUnit, isValue, isVariable, isVector, isZero, isZERO, leafCount, leaves, minus, mod, multiply, multiply, negative, ofNullable, opposite, optional, or, orElse, orElseGet, orElseThrow, plus, power, power, reciprocal, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceSlots, signum, subtract, sum, times, timesDistributed, topHead
public static IPattern valueOf(ISymbol symbol, IExpr check)
numerator
- public int[] addPattern(PatternMap patternMap, java.util.Map<IExpr,java.lang.Integer> patternIndexMap)
IPatternObject
patternMap
and patternIndexMap
.addPattern
in interface IPatternObject
addPattern
in class Blank
patternMap
- a map from a pattern to a possibly found value during pattern-matching.patternIndexMap
- a map from the pattern symbol to the intern array indexpublic int compareTo(IExpr expr)
public boolean equals(java.lang.Object obj)
edu.jas.structure.Element
public boolean equivalent(IPatternObject patternObject, PatternMap pm1, PatternMap pm2)
f[x_,y_]
is equivalent to f[a_,b_]
)equivalent
in interface IPatternObject
equivalent
in class Blank
patternObject
- pm1
- pm2
- public boolean matchPattern(IExpr expr, PatternMap patternMap)
expr
.matchPattern
in interface IPatternObject
matchPattern
in class Blank
expr
- the expression which should be matched.patternMap
- a map from a pattern to a possibly found value during pattern-matching.public java.lang.String fullFormString()
IExpr
FullForm()
of this expressionfullFormString
in interface IExpr
fullFormString
in class Blank
public int getIndex(PatternMap pm)
IPatternObject
PatternMap
getIndex
in interface IPatternObject
getIndex
in class Blank
pm
- the PatternMap from which we determine the index.public ISymbol getSymbol()
IPatternObject
getSymbol
in interface IPatternObject
getSymbol
in class Blank
public int hashCode()
edu.jas.structure.Element
public ISymbol head()
ExprImpl
IAST
get the first element
(offset 0) of the IAST
list (i.e. get(0) ).public int hierarchy()
IExpr
public boolean isConditionMatched(IExpr expr, PatternMap patternMap)
IPattern
true
, if the expression fullfills the patterns
additional conditionisConditionMatched
in interface IPattern
isConditionMatched
in class Blank
public java.lang.String internalJavaString(boolean symbolsAsFactoryMethod, int depth, boolean useOperaators)
ExprImpl
internalJavaString
in interface IExpr
internalJavaString
in class Blank
symbolsAsFactoryMethod
- if true
use the F.symbol()
method,
otherwise print the symbol name.depth
- the recursion depth of this call. 0
indicates
"recurse without a limit".useOperaators
- use operators instead of function names for representation of
Plus, Times, Power,...public boolean isBlank()
Blank[]
objectpublic final boolean isPattern()
Pattern[symbol]
object