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 IPatternMapcopy()IExpr[]copyPattern()Copy the current values into a new array.voidcopyPatternValuesFromPatternMatcher(IPatternMap patternMap)Copy the found pattern matches from the givenpatternMapback to this maps pattern values.intget(IExpr patternOrSymbol)Get theintvalue mapped to the given pattern or symbol.IExprgetKey(int index)booleangetRHSEvaluated()IExprgetValue(int index)Return the matched value for the givenindexif possisble.IExprgetValue(IPatternObject pattern)Return the matched value for the given pattern objectList<IExpr>getValuesAsList()voidinitPattern()Set all pattern values tonull;voidinitSlotValues()booleanisAllPatternsAssigned()Check if all symbols in the symbols array have corresponding values assigned.booleanisFreeOfPatternSymbols(IExpr substitutedExpr)Check if the substituted expression still contains a symbol of a pattern expression.booleanisRuleWithoutPatterns()Returns true if the pattern matcher contains no patternsbooleanisValueAssigned()Returns true if the pattern matcher contains at least one value assigned.voidresetPattern(IExpr[] patternValuesArray)Reset the values to the values in the given arraybooleansetOptionsPattern(EvalEngine engine, ISymbol lhsHead)voidsetRHSEvaluated(boolean evaluated)booleansetValue(IPatternObject pattern, IExpr expr)Assign the value to the pattern.booleansetValue(IPatternSequence pattern, IAST sequence)Assign the sequence to the pattern sequence.intsize()Gives the number of symbols used in this map.IExprsubstitute(IExpr symbolOrPatternObject)IExprsubstitutePatternOrSymbols(IExpr lhsPatternExpr, boolean onlyNamedPatterns)Substitute all patterns and symbols in the given expression with the current value of the corresponding internal pattern values arraysIExprsubstituteSymbols(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.StringtoString()-
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:
copyin interfaceIPatternMap
-
copyPattern
public IExpr[] copyPattern()
Description copied from interface:IPatternMapCopy the current values into a new array.- Specified by:
copyPatternin interfaceIPatternMap- Returns:
- See Also:
IPatternMap.PatternMap.resetPattern(IExpr[])
-
copyPatternValuesFromPatternMatcher
public void copyPatternValuesFromPatternMatcher(IPatternMap patternMap)
Description copied from interface:IPatternMapCopy the found pattern matches from the givenpatternMapback to this maps pattern values.- Specified by:
copyPatternValuesFromPatternMatcherin interfaceIPatternMap
-
get
public int get(IExpr patternOrSymbol)
Description copied from interface:IPatternMapGet theintvalue mapped to the given pattern or symbol.- Specified by:
getin interfaceIPatternMap- Parameters:
patternOrSymbol- the given pattern or symbol- Returns:
-1if the symbol isn't available in this map.
-
getRHSEvaluated
public boolean getRHSEvaluated()
- Specified by:
getRHSEvaluatedin interfaceIPatternMap
-
getKey
public IExpr getKey(int index)
- Specified by:
getKeyin interfaceIPatternMap
-
getValue
public IExpr getValue(int index)
Description copied from interface:IPatternMapReturn the matched value for the givenindexif possisble.- Specified by:
getValuein interfaceIPatternMap- Returns:
nullif no matched expression exists
-
getValue
public IExpr getValue(IPatternObject pattern)
Description copied from interface:IPatternMapReturn the matched value for the given pattern object- Specified by:
getValuein interfaceIPatternMap- Parameters:
pattern- the pattern object- Returns:
nullif no matched expression exists
-
getValuesAsList
public List<IExpr> getValuesAsList()
- Specified by:
getValuesAsListin interfaceIPatternMap
-
initPattern
public void initPattern()
Description copied from interface:IPatternMapSet all pattern values tonull;- Specified by:
initPatternin interfaceIPatternMap
-
initSlotValues
public final void initSlotValues()
- Specified by:
initSlotValuesin interfaceIPatternMap
-
isAllPatternsAssigned
public boolean isAllPatternsAssigned()
Description copied from interface:IPatternMapCheck if all symbols in the symbols array have corresponding values assigned.- Specified by:
isAllPatternsAssignedin interfaceIPatternMap- Returns:
-
isValueAssigned
public boolean isValueAssigned()
Description copied from interface:IPatternMapReturns true if the pattern matcher contains at least one value assigned.- Specified by:
isValueAssignedin interfaceIPatternMap- Returns:
-
isFreeOfPatternSymbols
public boolean isFreeOfPatternSymbols(IExpr substitutedExpr)
Description copied from interface:IPatternMapCheck if the substituted expression still contains a symbol of a pattern expression.- Specified by:
isFreeOfPatternSymbolsin interfaceIPatternMap- Returns:
-
isRuleWithoutPatterns
public boolean isRuleWithoutPatterns()
Description copied from interface:IPatternMapReturns true if the pattern matcher contains no patterns- Specified by:
isRuleWithoutPatternsin interfaceIPatternMap- Returns:
-
resetPattern
public void resetPattern(IExpr[] patternValuesArray)
Description copied from interface:IPatternMapReset the values to the values in the given array- Specified by:
resetPatternin interfaceIPatternMap- See Also:
IPatternMap.PatternMap.copyPattern()
-
setRHSEvaluated
public void setRHSEvaluated(boolean evaluated)
- Specified by:
setRHSEvaluatedin interfaceIPatternMap
-
setValue
public boolean setValue(IPatternObject pattern, IExpr expr)
Description copied from interface:IPatternMapAssign the value to the pattern.- Specified by:
setValuein interfaceIPatternMap- Parameters:
pattern- the pattern expression- Returns:
trueif assignment was successful,falseotherwise.
-
setValue
public boolean setValue(IPatternSequence pattern, IAST sequence)
Description copied from interface:IPatternMapAssign the sequence to the pattern sequence.- Specified by:
setValuein interfaceIPatternMap- Parameters:
pattern- the pattern sequence expression- Returns:
trueif assignment was successful,falseotherwise.
-
size
public int size()
Description copied from interface:IPatternMapGives the number of symbols used in this map.- Specified by:
sizein interfaceIPatternMap- Returns:
- the number of symbols used in this map.
-
substitute
public IExpr substitute(IExpr symbolOrPatternObject)
- Specified by:
substitutein interfaceIPatternMap
-
substitutePatternOrSymbols
public IExpr substitutePatternOrSymbols(IExpr lhsPatternExpr, boolean onlyNamedPatterns)
Description copied from interface:IPatternMapSubstitute all patterns and symbols in the given expression with the current value of the corresponding internal pattern values arrays- Specified by:
substitutePatternOrSymbolsin interfaceIPatternMap- Parameters:
lhsPatternExpr- left-hand-side expression which may contain pattern objectsonlyNamedPatterns- TODO- Returns:
F.NILif substitutions isn't possible
-
substituteSymbols
public IExpr substituteSymbols(IExpr rhsExpr, IExpr nilOrEmptySequence)
Description copied from interface:IPatternMapSubstitute 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:
substituteSymbolsin interfaceIPatternMap- Parameters:
rhsExpr- right-hand-side expression, substitute all symbols from the pattern-matching valuesnilOrEmptySequence- default valueF.NILorF.Sequence()- Returns:
-
setOptionsPattern
public boolean setOptionsPattern(EvalEngine engine, ISymbol lhsHead)
- Specified by:
setOptionsPatternin interfaceIPatternMap
-
-