Class IPatternMap.PatternMap0
- java.lang.Object
-
- org.matheclipse.core.patternmatching.IPatternMap.PatternMap0
-
- All Implemented Interfaces:
IPatternMap
- Enclosing interface:
- IPatternMap
public static final class IPatternMap.PatternMap0 extends Object implements IPatternMap
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.matheclipse.core.patternmatching.IPatternMap
IPatternMap.PatternMap, IPatternMap.PatternMap0, IPatternMap.PatternMap1, IPatternMap.PatternMap2, IPatternMap.PatternMap3
-
-
Field Summary
-
Fields inherited from interface org.matheclipse.core.patternmatching.IPatternMap
DEFAULT_RULE_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description PatternMap0()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IPatternMap
copy()
IExpr[]
copyPattern()
Copy the current values into a new array.void
copyPatternValuesFromPatternMatcher(IPatternMap patternMap)
Copy the found pattern matches from the givenpatternMap
back to this maps pattern values.int
get(IExpr patternOrSymbol)
Get theint
value mapped to the given pattern or symbol.IExpr
getKey(int index)
boolean
getRHSEvaluated()
IExpr
getValue(int index)
Return the matched value for the givenindex
if possisble.IExpr
getValue(IPatternObject pattern)
Return the matched value for the given pattern objectList<IExpr>
getValuesAsList()
void
initPattern()
Set all pattern values tonull
;void
initSlotValues()
boolean
isAllPatternsAssigned()
Check if all symbols in the symbols array have corresponding values assigned.boolean
isFreeOfPatternSymbols(IExpr substitutedExpr)
Check if the substituted expression still contains a symbol of a pattern expression.boolean
isRuleWithoutPatterns()
Returns true if the pattern matcher contains no patternsboolean
isValueAssigned()
Returns true if the pattern matcher contains at least one value assigned.void
resetPattern(IExpr[] patternValuesArray)
Reset the values to the values in the given arrayboolean
setOptionsPattern(EvalEngine engine, ISymbol lhsHead)
void
setRHSEvaluated(boolean evaluated)
boolean
setValue(IPatternObject pattern, IExpr expr)
Assign the value to the pattern.boolean
setValue(IPatternSequence pattern, IAST sequence)
Assign the sequence to the pattern sequence.int
size()
Gives the number of symbols used in this map.IExpr
substitute(IExpr symbolOrPatternObject)
IExpr
substitutePatternOrSymbols(IExpr lhsPatternExpr, boolean onlyNamedPatterns)
Substitute all patterns and symbols in the given expression with the current value of the corresponding internal pattern values arraysIExpr
substituteSymbols(IExpr rhsExpr, IExpr nilOrEmptySequence)
Substitute all symbols in the given expression with the current value of the corresponding internal pattern values arrays and substitute allOptionValue(...)
expressions with the corresponding option value from the current pattern-matching process.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.matheclipse.core.patternmatching.IPatternMap
initPatternBlank, isPatternTest, substituteASTPatternOrSymbols, substituteSymbolPatterns
-
-
-
-
Method Detail
-
copy
public IPatternMap copy()
- Specified by:
copy
in interfaceIPatternMap
-
copyPattern
public IExpr[] copyPattern()
Description copied from interface:IPatternMap
Copy the current values into a new array.- Specified by:
copyPattern
in interfaceIPatternMap
- Returns:
- See Also:
IPatternMap.PatternMap.resetPattern(IExpr[])
-
copyPatternValuesFromPatternMatcher
public void copyPatternValuesFromPatternMatcher(IPatternMap patternMap)
Description copied from interface:IPatternMap
Copy the found pattern matches from the givenpatternMap
back to this maps pattern values.- Specified by:
copyPatternValuesFromPatternMatcher
in interfaceIPatternMap
-
get
public int get(IExpr patternOrSymbol)
Description copied from interface:IPatternMap
Get theint
value mapped to the given pattern or symbol.- Specified by:
get
in interfaceIPatternMap
- Parameters:
patternOrSymbol
- the given pattern or symbol- Returns:
-1
if the symbol isn't available in this map.
-
getRHSEvaluated
public boolean getRHSEvaluated()
- Specified by:
getRHSEvaluated
in interfaceIPatternMap
-
getKey
public IExpr getKey(int index)
- Specified by:
getKey
in interfaceIPatternMap
-
getValue
public IExpr getValue(int index)
Description copied from interface:IPatternMap
Return the matched value for the givenindex
if possisble.- Specified by:
getValue
in interfaceIPatternMap
- Returns:
null
if no matched expression exists
-
getValue
public IExpr getValue(IPatternObject pattern)
Description copied from interface:IPatternMap
Return the matched value for the given pattern object- Specified by:
getValue
in interfaceIPatternMap
- Parameters:
pattern
- the pattern object- Returns:
null
if no matched expression exists
-
getValuesAsList
public List<IExpr> getValuesAsList()
- Specified by:
getValuesAsList
in interfaceIPatternMap
-
initPattern
public void initPattern()
Description copied from interface:IPatternMap
Set all pattern values tonull
;- Specified by:
initPattern
in interfaceIPatternMap
-
initSlotValues
public final void initSlotValues()
- Specified by:
initSlotValues
in interfaceIPatternMap
-
isAllPatternsAssigned
public boolean isAllPatternsAssigned()
Description copied from interface:IPatternMap
Check if all symbols in the symbols array have corresponding values assigned.- Specified by:
isAllPatternsAssigned
in interfaceIPatternMap
- Returns:
-
isValueAssigned
public boolean isValueAssigned()
Description copied from interface:IPatternMap
Returns true if the pattern matcher contains at least one value assigned.- Specified by:
isValueAssigned
in interfaceIPatternMap
- Returns:
-
isFreeOfPatternSymbols
public boolean isFreeOfPatternSymbols(IExpr substitutedExpr)
Description copied from interface:IPatternMap
Check if the substituted expression still contains a symbol of a pattern expression.- Specified by:
isFreeOfPatternSymbols
in interfaceIPatternMap
- Returns:
-
isRuleWithoutPatterns
public boolean isRuleWithoutPatterns()
Description copied from interface:IPatternMap
Returns true if the pattern matcher contains no patterns- Specified by:
isRuleWithoutPatterns
in interfaceIPatternMap
- Returns:
-
resetPattern
public void resetPattern(IExpr[] patternValuesArray)
Description copied from interface:IPatternMap
Reset the values to the values in the given array- Specified by:
resetPattern
in interfaceIPatternMap
- See Also:
IPatternMap.PatternMap.copyPattern()
-
setRHSEvaluated
public void setRHSEvaluated(boolean evaluated)
- Specified by:
setRHSEvaluated
in interfaceIPatternMap
-
setValue
public boolean setValue(IPatternObject pattern, IExpr expr)
Description copied from interface:IPatternMap
Assign the value to the pattern.- Specified by:
setValue
in interfaceIPatternMap
- Parameters:
pattern
- the pattern expression- Returns:
true
if assignment was successful,false
otherwise.
-
setValue
public boolean setValue(IPatternSequence pattern, IAST sequence)
Description copied from interface:IPatternMap
Assign the sequence to the pattern sequence.- Specified by:
setValue
in interfaceIPatternMap
- Parameters:
pattern
- the pattern sequence expression- Returns:
true
if assignment was successful,false
otherwise.
-
size
public int size()
Description copied from interface:IPatternMap
Gives the number of symbols used in this map.- Specified by:
size
in interfaceIPatternMap
- Returns:
- the number of symbols used in this map.
-
substitute
public IExpr substitute(IExpr symbolOrPatternObject)
- Specified by:
substitute
in interfaceIPatternMap
-
substitutePatternOrSymbols
public IExpr substitutePatternOrSymbols(IExpr lhsPatternExpr, boolean onlyNamedPatterns)
Description copied from interface:IPatternMap
Substitute all patterns and symbols in the given expression with the current value of the corresponding internal pattern values arrays- Specified by:
substitutePatternOrSymbols
in interfaceIPatternMap
- Parameters:
lhsPatternExpr
- left-hand-side expression which may contain pattern objectsonlyNamedPatterns
- TODO- Returns:
F.NIL
if substitutions isn't possible
-
substituteSymbols
public IExpr substituteSymbols(IExpr rhsExpr, IExpr nilOrEmptySequence)
Description copied from interface:IPatternMap
Substitute all symbols in the given expression with the current value of the corresponding internal pattern values arrays and substitute allOptionValue(...)
expressions with the corresponding option value from the current pattern-matching process.- Specified by:
substituteSymbols
in interfaceIPatternMap
- Parameters:
rhsExpr
- right-hand-side expression, substitute all symbols from the pattern-matching valuesnilOrEmptySequence
- default valueF.NIL
orF.Sequence()
- Returns:
-
setOptionsPattern
public boolean setOptionsPattern(EvalEngine engine, ISymbol lhsHead)
- Specified by:
setOptionsPattern
in interfaceIPatternMap
-
-