Package org.matheclipse.core.interfaces
Interface ISymbol
-
- All Superinterfaces:
edu.jas.structure.AbelianGroupElem<IExpr>
,org.hipparchus.CalculusFieldElement<IExpr>
,Comparable<IExpr>
,edu.jas.structure.Element<IExpr>
,org.hipparchus.FieldElement<IExpr>
,edu.jas.structure.GcdRingElem<IExpr>
,IExpr
,edu.jas.structure.MonoidElem<IExpr>
,edu.jas.structure.RingElem<IExpr>
,Serializable
- All Known Subinterfaces:
IBuiltInSymbol
- All Known Implementing Classes:
BuiltInDummy
,BuiltInRubi
,BuiltInSymbol
,Symbol
public interface ISymbol extends IExpr
An expression representing a symbol (i.e. variable- constant- or function-name)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.matheclipse.core.interfaces.IExpr
IExpr.COMPARE_TERNARY
-
-
Field Summary
Fields Modifier and Type Field Description static int
CONSTANT
ISymbol attribute to indicate that a symbol has a constant valuestatic int
DIRTY_FLAG_ASSIGNED_VALUE
ISymbol flag to indicate that the symbols value is used by a methodstatic int
FLAT
ISymbol attribute for an associative function transformation.static int
FLATORDERLESS
ISymbol attribute combination (ISymbol.FLAT and ISymbol.ORDERLESS)static int
HOLDALL
ISymbol attribute for a function, where no argument should be evaluatedstatic int
HOLDALLCOMPLETE
ISymbol attribute for a function, where no argument should be evaluatedstatic int
HOLDCOMPLETE
ISymbol attribute for a function, where no argument should be evaluatedstatic int
HOLDFIRST
ISymbol attribute for a function, where the first argument should not be evaluatedstatic int
HOLDREST
ISymbol attribute for a function, where only the first argument should be evaluatedstatic int
LISTABLE
ISymbol attribute for a function with lists as argumentsstatic int
LOCKED
ISymbol attribute for a locked symbol.static int
NHOLDALL
ISymbol attribute for a function, which should not be evaluated numericallystatic int
NHOLDFIRST
ISymbol attribute for a function, where the first argument should not be evaluated numericallystatic int
NHOLDREST
ISymbol attribute for a function, where the rest of the arguments should not be evaluated numerically.static int
NO_EVAL_ENGINE_ATTRIBUTE
A mask which tests if any evaluation engine attribute is setsstatic int
NOATTRIBUTE
ISymbol attribute which means that no attribute is set.static int
NUMERICFUNCTION
ISymbol attribute for a numeric functionstatic int
ONEIDENTITY
ISymbol attribute for a function transformation: f(x) ==> xstatic int
ORDERLESS
ISymbol attribute for a commutative function transformation.static int
PACKAGE_LOADED
ISymbol flag for a symbol which has already loaded it's package definitionstatic int
PROTECTED
ISymbol attribute for a symbol where no rule definition should be possiblestatic int
READPROTECTED
ISymbol attribute for a symbol where the definition shouldn't be displayedstatic int
SEQUENCEHOLD
ISymbol attribute for a function, where noSequence()
argument should be flattend outstatic int
SETDELAYED_FLAG_ASSIGNED_VALUE
ISymbol flag to indicate that the symbols value is defined by SetDelayed-
Fields inherited from interface org.matheclipse.core.interfaces.IExpr
ASTID, BDDEXPRID, BIOSEQUENCEID, BLANKID, BYTEARRAYID, COMPILEFUNCTONID, COMPLEXID, DATAID, DATASETID, DATEOBJECTEXPRID, DISPATCHID, DOUBLECOMPLEXID, DOUBLEID, FILEEXPRID, FITTEDMODELID, FRACTIONID, GEOPOSITIONID, GRAPHEXPRID, IMAGEID, INPUTSTREAMEXPRID, INTEGERID, INTERPOLATEDFUNCTONID, JAVACLASSEXPRID, JAVAOBJECTEXPRID, LINEARSOLVEUNCTONID, METHODSYMBOLID, NUMERICARRAYID, OUTPUTSTREAMEXPRID, PATTERNID, QUANTITYID, SERIESID, SPARSEARRAYID, STRINGID, SYMBOLID, TESTREPORTOBJECT, TESTRESULTOBJECT, TIMEOBJECTEXPRID
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
addAttributes(int attributes)
Add the attributes to the existing attributes bit-set.IExpr
assignedValue()
Get theOwnValues
value which is assigned to the symbol ornull
, if no value is assigned.default void
assignValue(IExpr value)
Set theOwnValues
value of this variable.void
assignValue(IExpr value, boolean setDelayed)
Set theOwnValues
value of this variablevoid
clear(EvalEngine engine)
Clear the associated rules (OwnValues
,DownValues
andUpValues
) for this symbol but don't clear the attribute flags.void
clearAll(EvalEngine engine)
Clear all associated rules (OwnValues
,DownValues
andUpValues
) and attribute flags for this symbol.void
clearAttributes(int attributes)
Remove the attribute flags from the existing attributes bit-set.void
clearEvalFlags(int flags)
Remove the evaluation flags from the existing flags bit-set.void
clearValue()
Clear theOwnValues
value which is assigned to this symbol.boolean
containsRules()
Check if ths symbol contains a "DownRule" or "UpRule"RulesData
createRulesData(int[] sizes)
Create internal rules data structure with precalculated sizes index 0 - number of equal rules inRULES
IAST
definition()
Return a list of the rules associated to this symbolString
definitionToString()
Return the rules associated to this symbol inString
representationdefault IExpr
evalAsLeadingTerm(ISymbol x, IExpr logx, int cdir)
IExpr
evalDownRule(EvalEngine engine, IExpr expression)
Evaluate the given expression for the "down value" rules associated with this symbolIExpr
evalMessage(String messageName)
IExpr
evalUpRules(IExpr expression, EvalEngine engine)
Evaluate the given expression for the "up value" rules (i.e.default IAST
f(IExpr arg1)
default IAST
f(IExpr arg1, IExpr arg2)
default IAST
f(IExpr arg1, IExpr arg2, IExpr arg3)
default IExpr
get()
Deprecated.useassignedValue()
insteadint
getAttributes()
Get the Attributes of this symbol (i.e.Context
getContext()
Get the context this symbol is assigned to.default String
getContextSymbolName()
Get the full symbol name string with the context prefix included.IExpr
getDefaultValue()
Get the general default value for this symbol (i.e.IExpr
getDefaultValue(int position)
Get the default value at the arguments position for this symbol (i.e.RulesData
getRulesData()
Get the pattern matching rules associated with a symbol.String
getSymbolName()
Get the pure symbol name string without the context prefix.boolean
hasAssignedSymbolValue()
Is a (local or global) value assigned for this symbol?boolean
hasFlatAttribute()
Does this symbols attribute set contains theFlat
attribute?static boolean
hasFlatAttribute(int attributes)
Does the attributes flag set contains theFLAT
bit set?boolean
hasHoldAllCompleteAttribute()
Does this symbols attribute set contains theHOLDALLCOMPLETE
attribute?static boolean
hasHoldAllCompleteAttribute(int attributes)
Does the attributes flag set contains theHOLDALLCOMPLETE
bit set?boolean
hasListableAttribute()
Does this symbols attribute set contains theListable
attribute?static boolean
hasListableAttribute(int attributes)
Does the attributes flag set contains theLISTABLE
bit set?boolean
hasOneIdentityAttribute()
Does this symbols attribute set contains theOneIdentity
attribute?boolean
hasOrderlessAttribute()
Does this symbols attribute set contains theOrderless
attribute?static boolean
hasOrderlessAttribute(int attributes)
Does this symbols attribute set contains theOrderless
attribute?boolean
hasOrderlessFlatAttribute()
Does this symbols attribute set contains theFlat
andOrderless
attribute?static boolean
hasOrderlessFlatAttribute(int attributes)
Does the attributes flag set contains theISymbol.Flat
andISymbol.Orderless
bits set?default boolean
isBooleanFormula()
Test if this expression is a boolean formula (i.e.default boolean
isConstantAttribute()
Test if this expression is a symbol with attributeConstant
.default boolean
isContext(Context context)
Givestrue
if this symbol is in thecontext
.default boolean
isDollarSymbol()
boolean
isLocked()
Givestrue
if the system is in server mode and cannot be modifiedboolean
isLocked(boolean packageMode)
Givestrue
if the system is in server mode and cannot be modifieddefault boolean
isNumericFunction(boolean allowList)
Test if this expression is a numeric function (i.e.default boolean
isNumericFunctionAttribute()
default boolean
isOneIdentityAttribute()
default boolean
isProtected()
boolean
isString(String symbolName)
Tests if this symbols name equals the given stringdefault boolean
isSymbolID(int... ids)
Returnstrue
, if this symbol is in the set of definedids
.boolean
isSymbolName(String name)
Returnstrue
, if this symbol has the given name.default IExpr[]
linear(IExpr variable)
If this is a linear expressiona + b * x
return the addenda
at index0
and the multiplicantb
at index1
default IExpr[]
linearPower(IExpr variable)
If this is an expression of the forma + b * x^n
withn
integer, return the addend at index0
and the multiplicant at index1
and the exponentn
at index2
.default IExpr
mapConstantDouble(DoubleFunction<IExpr> function)
If this symbol has attributeISymbol.CONSTANT
and the symbol's evaluator is of instanceINumericConstant
, then apply the constants double value to the given function and return the result, otherwise returnF.NIL
.default IExpr
of(boolean... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
default IExpr
of(int... args)
Evaluate this symbol for the arguments as functionsymbol(F.ZZ(arg1), F.ZZ(arg2), ....
default IExpr
of(String... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
IExpr
of(EvalEngine engine, Object... args)
Evaluate this symbol for the arguments converted toIExpr
functionsymbol(expr1, expr2, ....
IExpr
of(EvalEngine engine, IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
default IExpr
of(IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
IExpr
of1(EvalEngine engine, IExpr arg, IExpr... parts)
Evaluate this symbol for the arguments as functionsymbol(arg, part1, part2, ....
default double
ofN(double... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
IExpr
ofNIL(EvalEngine engine, IExpr... args)
This method returnsF.NIL
if no evaluation was possible.default IExpr
ofObject(Object... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
boolean
ofQ(EvalEngine engine, IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
boolean
ofQ(IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, ....
default int
ordinal()
Get the ordinal number of this built-in symbol in the enumeration of built-in symbols.default IPatternMatcher
putDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, boolean packageMode)
Associate a new "down value" rule with default priority to this symbol.IPatternMatcher
putDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)
Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.default IPatternMatcher
putDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, boolean packageMode)
Associate a new "down value" rule with default priority to this symbol.IPatternMatcher
putDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)
Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.void
putDownRule(PatternMatcherAndInvoker pmEvaluator)
Deprecated.void
putMessage(int setSymbol, String messageName, IStringX message)
IPatternMatcher
putUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide)
Associate a new "up value" rule with default priority to this symbol.IPatternMatcher
putUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority)
Associate a new "up value" rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.void
readRules(ObjectInputStream stream)
Deserialize the rules associated to this objectIExpr[]
reassignSymbolValue(Function<IExpr,IExpr> function, ISymbol functionSymbol, EvalEngine engine)
Apply the function to the currently assigned value of the symbol and reassign the result value to the symbol.IExpr[]
reassignSymbolValue(IASTMutable ast, ISymbol functionSymbol, EvalEngine engine)
Apply the ast to the currently assigned value of the symbol and reassign the result value to the symbol.boolean
removeRule(int setSymbol, boolean equalRule, IExpr leftHandSide, boolean packageMode)
Remove the rules associate with this symbol, which equals the givenleftHandSide
expression.void
setAttributes(int attributes)
Set the Attributes of this symbol (i.e.void
setDefaultValue(int position, IExpr expr)
Set the default value at the arguments position for this symbol (i.e.void
setDefaultValue(IExpr expr)
Set the general default value for this symbol (i.e.void
setRulesData(RulesData rd)
boolean
writeRules(ObjectOutputStream stream)
Serialize the rule definitions associated to this symbol-
Methods inherited from interface org.hipparchus.CalculusFieldElement
getExponent, isFinite, isInfinite, isNaN, norm, round
-
Methods inherited from interface org.matheclipse.core.interfaces.IExpr
$div, $minus, $plus, $times, $up, abs, accept, accept, accept, accept, acos, acosh, add, add, addEvalFlags, and, apply, apply, argSize, asBaseExp, asCoeffAdd, asCoeffAdd, asCoeffAdd, asCoeffExponent, asCoeffmul, asCoeffmul, asCoeffmul, asCoeffmul, asCoeffMul, asCoeffMul, asin, asinh, asLeadingTerm, asLeadingTerm, asLeadingTerm, asLeadingTerm, asNumerDenom, asPowersDict, asType, atan, atan2, atanh, base, cancel, cbrt, ceil, compareTo, compareToNumerical, complexArg, conjugate, constantArray, copySign, copySign, copySign, cos, cosh, dec, depth, determinePrecision, divide, divide, egcd, equalsArgs, equalsArgs, equalsAt, equalTernary, equalTo, erf, erfc, eval, eval, evalBinary64, evalComplex, evalDouble, evalf, evalf, evalfc, evalfc, evalNIL, evalNumber, evalReal, evaluate, evaluateHead, evaluateOrElse, exists, exp, expm1, exponent, factory, first, floor, forAll, fresnelC, fresnelS, fullFormString, gaussianIntegers, gcd, getArg, getAt, getField, getOptionalValue, getPi, getReal, greater, greaterEqual, greaterEqualThan, greaterEqualThan, greaterThan, greaterThan, has, has, has, has, hasComplexNumber, hasFree, head, headID, hierarchy, hypergeometric0F1, hypergeometric1F1, hypergeometric2F1, hypot, ifPresent, im, inc, indexOf, indexOf, indexOf, internalFormString, internalJavaString, internalScalaString, intSlot, inverse, isAbs, isAllExpanded, isAlternatives, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAssociation, isAST, isAST, isAST, isAST, isAST, isAST, isAST, isAST0, isAST1, isAST2, isAST3, isASTOrAssociation, isASTSizeGE, isAtom, isBlank, isBooleanFormulaSymbol, isBooleanFunction, isBooleanResult, isBuiltInSymbol, isBuiltInSymbolID, isComparatorFunction, isComparatorFunctionSymbol, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isConditionalExpression, isConjugate, isContinuousDistribution, isCoreFunctionSymbol, isCos, isCosh, isDataset, isDefer, isDerivative, isDerivativeAST1, isDirectedInfinity, isDirectedInfinity, isDiscreteDistribution, isDistribution, isE, isEdge, isEmpty, isEmptyIntervalData, isEmptyList, isEqual, isEvalFlagOff, isEvalFlagOn, isEvenResult, isExactNumber, isExcept, isExp, isExpanded, isFactorSqrtExpr, isFalse, isFlatAST, isFraction, isFree, isFree, isFree, isFree, isFreeAST, isFreeAST, isFreeOfPatterns, isFunction, isFunctionID, isGEOrdered, isGTOrdered, isHoldAllCompleteAST, isHoldOrHoldFormOrDefer, isHoldPatternOrLiteral, isHyperbolicFunction, isImaginaryUnit, isIndeterminate, isInexactNumber, isInexactVector, isInfinity, isInteger, isIntegerResult, isInterval, isInterval1, isIntervalData, isInvalid, isLEOrdered, isList, isList, isList, isList1, isList2, isList3, isList4, isListableAST, isListOfEdges, isListOfLists, isListOfMatrices, isListOfPoints, isListOfRules, isListOfRules, isListOfRulesOrAssociation, isListOfStrings, isListOrAssociation, isLog, isLTOrdered, isMachineNumber, isMathematicalIntegerNegative, isMathematicalIntegerNonNegative, isMatrix, isMatrix, isMatrixIgnore, isMember, isMember, isMinusOne, isModule, isModuleOrWithCondition, isNegative, isNegativeImaginaryUnit, isNegativeInfinity, isNegativeResult, isNegativeSigned, isNIL, isNonEmptyList, isNonNegativeResult, isNonZeroComplexResult, isNonZeroRealResult, isNot, isNotDefined, isNotEmpty, isNumber, isNumberOrInfinity, isNumEqualInteger, isNumEqualRational, isNumeric, isNumericArgument, isNumericArgument, isNumericArray, isNumericAST, isNumericFunction, isNumericFunction, isNumericFunction, isNumericFunction, isNumericMode, isNumIntValue, isOne, isONE, isOneIdentityAST1, isOptional, isOptionsPattern, isOr, isOrderlessAST, isPattern, isPatternDefault, isPatternExpr, isPatternMatchingFunction, isPatternOptional, isPatternSequence, isPatternTest, isPi, isPiecewise, isPlus, isPlus2, isPlus3, isPlusTimesPower, isPolynomial, isPolynomial, isPolynomialOfMaxDegree, isPolynomialStruct, isPositive, isPositiveResult, isPossibleZero, isPower, isPowerReciprocal, isPredicateFunctionSymbol, isPresent, isPureFunction, isQuantity, isRational, isRationalResult, isRationalValue, isReal, isRealConstant, isRealMatrix, isRealNumber, isRealResult, isRealVector, isReNegativeResult, isRepeated, isRePositiveResult, isRGBColor, isRule, isRuleAST, isRuleDelayed, isSame, isSame, isSameHeadSizeGE, isSequence, isSin, isSinh, isSlot, isSlotSequence, isSpan, isSparseArray, isSqrt, isSqrtExpr, isString, isStringIgnoreCase, isSubscript, isSymbol, isSymbolOrPattern, isTan, isTanh, isTimes, isTimes2, isTimes3, isTrigFunction, isTrue, isUndefined, isUnequalResult, isUnevaluated, isUnit, isValue, isVariable, isVariable, isVector, isWith, isZero, isZERO, isZeroResult, last, leadTerm, leadTerm, leafCount, leafCountSimplify, less, lessEqual, lessEqualThan, lessEqualThan, lessThan, lessThan, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, log, log10, log1p, lower, makeAST, makeList, mapExpr, mapMatrixColumns, mapThread, minus, mod, most, multiply, multiply, multiply, multiplyDistributed, negate, negative, newInstance, normal, one, opposite, optional, or, orElse, orElseGet, orElseThrow, partition, partitionPlus, partitionTimes, plus, pow, pow, pow, power, power, re, reciprocal, remainder, remainder, replaceAll, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceRepeated, rest, rewrite, rint, rootN, roundExpr, scalb, second, sign, signum, sin, sinCos, sinh, sinhCosh, size, sqr, sqrt, subs, subtract, subtract, sum, tan, tanh, times, timesDistributed, toBooleanMatrix, toBooleanVector, toBooleValueVector, toByteMatrix, toComplexMatrix, toComplexVector, toDegrees, toDoubleDefault, toDoubleDefault, toDoubleMatrix, toDoubleMatrixIgnore, toDoubleVector, toDoubleVectorIgnore, together, toIntDefault, toIntDefault, toIntMatrix, toIntVector, toLongDefault, toLongDefault, toMMA, toNumber, toNumber, topHead, toRadians, toRealMatrix, toRealMatrixIgnore, toRealVector, toScript, toScriptFactory, toWolframString, trigsimp, ulp, unequalTo, unitStep, upper, variables2Slots, zero
-
-
-
-
Field Detail
-
CONSTANT
static final int CONSTANT
ISymbol attribute to indicate that a symbol has a constant value- See Also:
- Constant Field Values
-
FLAT
static final int FLAT
ISymbol attribute for an associative function transformation. The evaluation of the function will flatten the arguments list- See Also:
- Constant Field Values
-
HOLDFIRST
static final int HOLDFIRST
ISymbol attribute for a function, where the first argument should not be evaluated- See Also:
- Constant Field Values
-
HOLDREST
static final int HOLDREST
ISymbol attribute for a function, where only the first argument should be evaluated- See Also:
- Constant Field Values
-
HOLDALL
static final int HOLDALL
ISymbol attribute for a function, where no argument should be evaluated- See Also:
- Constant Field Values
-
HOLDCOMPLETE
static final int HOLDCOMPLETE
ISymbol attribute for a function, where no argument should be evaluated- See Also:
- Constant Field Values
-
SEQUENCEHOLD
static final int SEQUENCEHOLD
ISymbol attribute for a function, where noSequence()
argument should be flattend out- See Also:
- Constant Field Values
-
HOLDALLCOMPLETE
static final int HOLDALLCOMPLETE
ISymbol attribute for a function, where no argument should be evaluated- See Also:
- Constant Field Values
-
LISTABLE
static final int LISTABLE
ISymbol attribute for a function with lists as arguments- See Also:
- Constant Field Values
-
NHOLDFIRST
static final int NHOLDFIRST
ISymbol attribute for a function, where the first argument should not be evaluated numerically- See Also:
- Constant Field Values
-
NHOLDREST
static final int NHOLDREST
ISymbol attribute for a function, where the rest of the arguments should not be evaluated numerically.- See Also:
- Constant Field Values
-
NHOLDALL
static final int NHOLDALL
ISymbol attribute for a function, which should not be evaluated numerically- See Also:
- Constant Field Values
-
NOATTRIBUTE
static final int NOATTRIBUTE
ISymbol attribute which means that no attribute is set.- See Also:
- Constant Field Values
-
NUMERICFUNCTION
static final int NUMERICFUNCTION
ISymbol attribute for a numeric function- See Also:
- Constant Field Values
-
PACKAGE_LOADED
static final int PACKAGE_LOADED
ISymbol flag for a symbol which has already loaded it's package definition- See Also:
- Constant Field Values
-
ONEIDENTITY
static final int ONEIDENTITY
ISymbol attribute for a function transformation: f(x) ==> x- See Also:
- Constant Field Values
-
ORDERLESS
static final int ORDERLESS
ISymbol attribute for a commutative function transformation. The evaluation of the function will sort the arguments.- See Also:
- Constant Field Values
-
FLATORDERLESS
static final int FLATORDERLESS
ISymbol attribute combination (ISymbol.FLAT and ISymbol.ORDERLESS)- See Also:
- Constant Field Values
-
PROTECTED
static final int PROTECTED
ISymbol attribute for a symbol where no rule definition should be possible- See Also:
- Constant Field Values
-
READPROTECTED
static final int READPROTECTED
ISymbol attribute for a symbol where the definition shouldn't be displayed- See Also:
- Constant Field Values
-
LOCKED
static final int LOCKED
ISymbol attribute for a locked symbol. If a symbol is once locked, you cannot reset the lock.- See Also:
- Constant Field Values
-
NO_EVAL_ENGINE_ATTRIBUTE
static final int NO_EVAL_ENGINE_ATTRIBUTE
A mask which tests if any evaluation engine attribute is sets- See Also:
- Constant Field Values
-
DIRTY_FLAG_ASSIGNED_VALUE
static final int DIRTY_FLAG_ASSIGNED_VALUE
ISymbol flag to indicate that the symbols value is used by a method- See Also:
- Constant Field Values
-
SETDELAYED_FLAG_ASSIGNED_VALUE
static final int SETDELAYED_FLAG_ASSIGNED_VALUE
ISymbol flag to indicate that the symbols value is defined by SetDelayed- See Also:
- Constant Field Values
-
-
Method Detail
-
addAttributes
void addAttributes(int attributes)
Add the attributes to the existing attributes bit-set.- Parameters:
attributes
-
-
assignValue
default void assignValue(IExpr value)
Set theOwnValues
value of this variable. The value is assigned with the '=' operator.- Parameters:
value
- the assigned 'right-hand-side' expression
-
assignValue
void assignValue(IExpr value, boolean setDelayed)
Set theOwnValues
value of this variable- Parameters:
value
- the assigned 'right-hand-side' expressionsetDelayed
- iftrue
, the value is assigned with the ':=' SetDelayed operator otherwise with the '=' operator.
-
assignedValue
IExpr assignedValue()
Get theOwnValues
value which is assigned to the symbol ornull
, if no value is assigned.- Returns:
null
, if no value is assigned.
-
clear
void clear(EvalEngine engine)
Clear the associated rules (OwnValues
,DownValues
andUpValues
) for this symbol but don't clear the attribute flags.- Parameters:
engine
- the evaluation engine
-
clearValue
void clearValue()
Clear theOwnValues
value which is assigned to this symbol.
-
clearAll
void clearAll(EvalEngine engine)
Clear all associated rules (OwnValues
,DownValues
andUpValues
) and attribute flags for this symbol.- Parameters:
engine
- the evaluation engine
-
clearAttributes
void clearAttributes(int attributes)
Remove the attribute flags from the existing attributes bit-set.- Parameters:
attributes
-
-
clearEvalFlags
void clearEvalFlags(int flags)
Remove the evaluation flags from the existing flags bit-set.- Parameters:
flags
-
-
containsRules
boolean containsRules()
Check if ths symbol contains a "DownRule" or "UpRule"- Returns:
true
if this symbol contains a "DownRule" or "UpRule"
-
createRulesData
RulesData createRulesData(int[] sizes)
Create internal rules data structure with precalculated sizes- index 0 - number of equal rules in
RULES
- Parameters:
sizes
-
- index 0 - number of equal rules in
-
definition
IAST definition()
Return a list of the rules associated to this symbol- Returns:
-
definitionToString
String definitionToString() throws IOException
Return the rules associated to this symbol inString
representation- Returns:
- the
String
representation of the symbol definition - Throws:
IOException
-
evalDownRule
IExpr evalDownRule(EvalEngine engine, IExpr expression)
Evaluate the given expression for the "down value" rules associated with this symbol- Parameters:
engine
-expression
-- Returns:
F.NIL
if no evaluation was possible
-
evalUpRules
IExpr evalUpRules(IExpr expression, EvalEngine engine)
Evaluate the given expression for the "up value" rules (i.e. defined with UpSet and UpsetDelayed) associated with this symbol.- Parameters:
expression
-engine
-- Returns:
F.NIL
if no evaluation was possible
-
get
@Deprecated default IExpr get()
Deprecated.useassignedValue()
insteadGet the value which is assigned to the symbol ornull
, if no value is assigned.- Returns:
null
, if no value is assigned.
-
getAttributes
int getAttributes()
Get the Attributes of this symbol (i.e. LISTABLE, FLAT, ORDERLESS,...)- Returns:
- See Also:
FLAT
-
getContext
Context getContext()
Get the context this symbol is assigned to.- Returns:
-
getDefaultValue
IExpr getDefaultValue()
Get the general default value for this symbol (i.e.1
is the default value forTimes
,0
is the default value forPlus
). The general default value is used in pattern-matching for expressions likea_. * b_. + c_
- Returns:
- the default value or
F.NIL
if undefined.
-
getDefaultValue
IExpr getDefaultValue(int position)
Get the default value at the arguments position for this symbol (i.e.1
is the default value forPower
atposition
2
). The default value is used in pattern-matching for expressions likea ^ b_.
- Parameters:
position
- the position for the default value- Returns:
- the default value or
F.NIL
if undefined.
-
getRulesData
RulesData getRulesData()
Get the pattern matching rules associated with a symbol.RulesData
containsDownValues
andUpValues
rules for pattern matching. Note:OwnValues
are directly stored in a symbol.- Returns:
null
if no rules are defined
-
getSymbolName
String getSymbolName()
Get the pure symbol name string without the context prefix.- Returns:
-
getContextSymbolName
default String getContextSymbolName()
Get the full symbol name string with the context prefix included.- Returns:
-
hasAssignedSymbolValue
boolean hasAssignedSymbolValue()
Is a (local or global) value assigned for this symbol?- Returns:
true
if this symbol has an assigned value.
-
hasFlatAttribute
boolean hasFlatAttribute()
Does this symbols attribute set contains theFlat
attribute?- Returns:
true
if this symbols attribute set contains theFlat
attribute.
-
hasHoldAllCompleteAttribute
boolean hasHoldAllCompleteAttribute()
Does this symbols attribute set contains theHOLDALLCOMPLETE
attribute?- Returns:
-
hasListableAttribute
boolean hasListableAttribute()
Does this symbols attribute set contains theListable
attribute?- Returns:
true
if this symbols attribute set containsTheta
Listable
attribute.
-
hasFlatAttribute
static boolean hasFlatAttribute(int attributes)
Does the attributes flag set contains theFLAT
bit set?- Returns:
true
if this attribute set contains theISymbol.Flat
attribute.
-
hasHoldAllCompleteAttribute
static boolean hasHoldAllCompleteAttribute(int attributes)
Does the attributes flag set contains theHOLDALLCOMPLETE
bit set?- Parameters:
attributes
-- Returns:
-
hasListableAttribute
static boolean hasListableAttribute(int attributes)
Does the attributes flag set contains theLISTABLE
bit set?- Parameters:
attributes
-- Returns:
-
hasOrderlessAttribute
static boolean hasOrderlessAttribute(int attributes)
Does this symbols attribute set contains theOrderless
attribute?- Returns:
true
if this symbols attribute set contains theOrderless
attribute.
-
hasOrderlessFlatAttribute
static boolean hasOrderlessFlatAttribute(int attributes)
Does the attributes flag set contains theISymbol.Flat
andISymbol.Orderless
bits set?- Returns:
true
if this attribute set contains theISymbol.Flat
andISymbol.Orderless
attribute.
-
hasOneIdentityAttribute
boolean hasOneIdentityAttribute()
Does this symbols attribute set contains theOneIdentity
attribute?- Returns:
true
if this symbols attribute set contains theOneIdentity
attribute.
-
hasOrderlessAttribute
boolean hasOrderlessAttribute()
Does this symbols attribute set contains theOrderless
attribute?- Returns:
true
if this symbols attribute set contains theOrderless
attribute.
-
hasOrderlessFlatAttribute
boolean hasOrderlessFlatAttribute()
Does this symbols attribute set contains theFlat
andOrderless
attribute?- Returns:
true
if this symbols attribute set contains theFlat
and theOrderless
attribute.
-
isBooleanFormula
default boolean isBooleanFormula()
Test if this expression is a boolean formula (i.e. a symbol or a boolean functionAnd, Equivalent, Nand, Nor, Not, Or, Xor
where all arguments are also "boolean formulas")- Specified by:
isBooleanFormula
in interfaceIExpr
- Returns:
true
, if the given expression is a boolean formula or a symbol.- See Also:
IExpr.isRealResult()
-
isConstantAttribute
default boolean isConstantAttribute()
Description copied from interface:IExpr
Test if this expression is a symbol with attributeConstant
. Therefore numbers returnfalse
for this method!- Specified by:
isConstantAttribute
in interfaceIExpr
- Returns:
- See Also:
IExpr.isRealResult()
,IExpr.isNumericFunction(boolean)
-
isContext
default boolean isContext(Context context)
Givestrue
if this symbol is in thecontext
.- Returns:
-
isDollarSymbol
default boolean isDollarSymbol()
- Returns:
true
if this is of typeIBuiltInSymbol
and the symbol name starts with a '$';false
otherwise.
-
isLocked
boolean isLocked()
Givestrue
if the system is in server mode and cannot be modified- Returns:
-
isLocked
boolean isLocked(boolean packageMode)
Givestrue
if the system is in server mode and cannot be modified- Returns:
-
isNumericFunction
default boolean isNumericFunction(boolean allowList)
Description copied from interface:IExpr
Test if this expression is a numeric function (i.e. a number, a symbolic constant or a function (with attribute NumericFunction) where all arguments are also "numeric functions")- Specified by:
isNumericFunction
in interfaceIExpr
- Parameters:
allowList
- iftrue
aList(...)
AST is seen, as if it has attributeNUMERICFUNCTION
- Returns:
true
, if the given expression is a numeric function or value.- See Also:
IExpr.isRealResult()
-
isNumericFunctionAttribute
default boolean isNumericFunctionAttribute()
-
isOneIdentityAttribute
default boolean isOneIdentityAttribute()
-
isProtected
default boolean isProtected()
-
isString
boolean isString(String symbolName)
Tests if this symbols name equals the given string
-
isSymbolName
boolean isSymbolName(String name)
Returnstrue
, if this symbol has the given name. The comparison of the symbols name with the given name is done according to theConfig.PARSER_USE_LOWERCASE_SYMBOLS
setting.- Parameters:
name
- the symbol name- Returns:
-
isSymbolID
default boolean isSymbolID(int... ids)
Returnstrue
, if this symbol is in the set of definedids
.- Parameters:
ids
- the symbol ordinal number- Returns:
- See Also:
ID
-
linear
default IExpr[] linear(IExpr variable)
Description copied from interface:IExpr
If this is a linear expressiona + b * x
return the addenda
at index0
and the multiplicantb
at index1
-
linearPower
default IExpr[] linearPower(IExpr variable)
Description copied from interface:IExpr
If this is an expression of the forma + b * x^n
withn
integer, return the addend at index0
and the multiplicant at index1
and the exponentn
at index2
.- Specified by:
linearPower
in interfaceIExpr
- Parameters:
variable
- the variablex
in the formula- Returns:
null
if this is not an expression of the forma+b*x^n
-
mapConstantDouble
default IExpr mapConstantDouble(DoubleFunction<IExpr> function)
If this symbol has attributeISymbol.CONSTANT
and the symbol's evaluator is of instanceINumericConstant
, then apply the constants double value to the given function and return the result, otherwise returnF.NIL
.- Parameters:
function
- applys the function to adouble
value, resulting in an object of typeIExpr
.- Returns:
- the resulting expression from the function or
F.NIL
. - See Also:
org.matheclipse.core.reflection.system.Abs
,org.matheclipse.core.reflection.system.Ceiling
,org.matheclipse.core.reflection.system.Floor
-
of
IExpr of(EvalEngine engine, IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
.- Parameters:
engine
- the current evaluation engineargs
- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
of
IExpr of(EvalEngine engine, Object... args)
Evaluate this symbol for the arguments converted toIExpr
functionsymbol(expr1, expr2, .... ,exprN)
.- Parameters:
engine
- the current evaluation engineargs
- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression
-
of1
IExpr of1(EvalEngine engine, IExpr arg, IExpr... parts)
Evaluate this symbol for the arguments as functionsymbol(arg, part1, part2, .... , partN)
.- Parameters:
engine
- the current evaluation enginearg
- the main argumentparts
- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
of
default IExpr of(IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
.- Parameters:
args
- the arguments for which this function symbol should be evaluated- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
of
default IExpr of(int... args)
Evaluate this symbol for the arguments as functionsymbol(F.ZZ(arg1), F.ZZ(arg2), .... ,F.ZZ(argN))
by converting the args toIInteger
objects.- Parameters:
args
-- Returns:
- the evaluated expression; if no evaluation was possible return the created input expression.
-
ofN
default double ofN(double... args) throws ArgumentTypeException
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
, Theargs
are converted from Java double toINum
values.- Parameters:
args
-- Returns:
- Throws:
ArgumentTypeException
-
of
default IExpr of(String... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
, Theargs
are converted from JavaString
toIStringX
values.- Parameters:
args
- the string arguments of the function- Returns:
-
of
default IExpr of(boolean... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
, Theargs
are converted from Java boolean toS.True
orS.False
values.- Parameters:
args
-- Returns:
-
ofNIL
IExpr ofNIL(EvalEngine engine, IExpr... args)
This method returnsF.NIL
if no evaluation was possible. Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
.- Parameters:
engine
- the current evaluation engineargs
- the arguments for which this function symbol should be evaluated- Returns:
F.NIL
if no evaluation was possible.
-
ofQ
boolean ofQ(EvalEngine engine, IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
to a boolean value. If the result isn't a boolean value returnfalse
.- Parameters:
engine
- the current evaluation engineargs
- the arguments for which this function symbol should be evaluated- Returns:
- if the result isn't a boolean value return
false
.
-
ofQ
boolean ofQ(IExpr... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
to a boolean value. If the result isn't a boolean value returnfalse
.- Parameters:
args
- the arguments for which this function symbol should be evaluated- Returns:
- if the result isn't a boolean value return
false
.
-
ofObject
default IExpr ofObject(Object... args)
Evaluate this symbol for the arguments as functionsymbol(arg1, arg2, .... ,argN)
, The objects are converted from Java form to IExpr for according to methodObject2Expr.convert(Object, boolean, boolean)
.- Parameters:
args
- the objects which should be used as arguments- Returns:
-
ordinal
default int ordinal()
Get the ordinal number of this built-in symbol in the enumeration of built-in symbols. If this is no built-in symbol return-1
(ID.UNKNOWN)- Returns:
-
putDownRule
default IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, boolean packageMode)
Associate a new "down value" rule with default priority to this symbol.- Parameters:
setSymbol
- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayed
was used for defining this ruleequalRule
-true
if the leftHandSide could be matched with equalityleftHandSide
-rightHandSide
-packageMode
-true
if we are on "package mode"- Returns:
null
if no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)
Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.- Parameters:
setSymbol
- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayed
was used for defining this ruleequalRule
-true
if the leftHandSide could be matched with equalityleftHandSide
-rightHandSide
-priority
- the priority of the rulepackageMode
-true
if we are on "package mode"- Returns:
null
if no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
default IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, boolean packageMode)
Associate a new "down value" rule with default priority to this symbol.- Parameters:
setSymbol
- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayed
was used for defining this ruleequalRule
-true
if the leftHandSide could be matched with equalityleftHandSide
-rightHandSide
-packageMode
-true
if we are on "package mode"- Returns:
null
if no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
IPatternMatcher putDownRule(int setSymbol, boolean equalRule, IPatternObject leftHandSide, IExpr rightHandSide, int priority, boolean packageMode)
Associate a new rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.- Parameters:
setSymbol
- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayed
was used for defining this ruleequalRule
-true
if the leftHandSide could be matched with equalityleftHandSide
-rightHandSide
-priority
- the priority of the rulepackageMode
-true
if we are on "package mode"- Returns:
null
if no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putDownRule
@Deprecated void putDownRule(PatternMatcherAndInvoker pmEvaluator)
Deprecated.Associate a new rule, which invokes a method, to this symbol.
Deprecated: don't use dynamically called methods.
- Parameters:
pmEvaluator
-
-
putUpRule
IPatternMatcher putUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide)
Associate a new "up value" rule with default priority to this symbol.- Parameters:
setSymbol
- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayed
was used for defining this ruleequalRule
-true
if the leftHandSide could be matched with equalityleftHandSide
-rightHandSide
-- Returns:
null
if no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
putUpRule
IPatternMatcher putUpRule(int setSymbol, boolean equalRule, IAST leftHandSide, IExpr rightHandSide, int priority)
Associate a new "up value" rule with the given priority to this symbol.
Rules with lower numbers have higher priorities.- Parameters:
setSymbol
- which of the symbolsSet, SetDelayed, UpSet, UpSetDelayed
was used for defining this ruleequalRule
-true
if the leftHandSide could be matched with equalityleftHandSide
-rightHandSide
-priority
- the priority of the rule- Returns:
null
if no pattern matcher was generated- See Also:
IPatternMap.DEFAULT_RULE_PRIORITY
-
readRules
void readRules(ObjectInputStream stream) throws IOException, ClassNotFoundException
Deserialize the rules associated to this object- Parameters:
stream
-- Throws:
IOException
ClassNotFoundException
-
reassignSymbolValue
IExpr[] reassignSymbolValue(Function<IExpr,IExpr> function, ISymbol functionSymbol, EvalEngine engine)
Apply the function to the currently assigned value of the symbol and reassign the result value to the symbol. Used for functions likeAppendTo, AssociateTo, Decrement, Increment, PrependTo,...
- Parameters:
function
- the function which should be appliedfunctionSymbol
- if this method throws an exception the symbol will be displayed in the exceptions messageengine
- the evaluation engine- Returns:
- an array with the currently assigned value of the symbol and the new calculated value
of the symbol or
null
if the reassignment isn't possible.
-
reassignSymbolValue
IExpr[] reassignSymbolValue(IASTMutable ast, ISymbol functionSymbol, EvalEngine engine)
Apply the ast to the currently assigned value of the symbol and reassign the result value to the symbol. Used for functions like AppendTo, Decrement, Increment,...- Parameters:
ast
-ast
- the ast which should be evaluated by replacing the first argument with the current value of the symbolfunctionSymbol
- if this method throws an exception the symbol will be displayed in the exceptions messageengine
- the evaluation engine- Returns:
- an array with the currently assigned value of the symbol and the new calculated value
of the symbol or
null
if the reassignment isn't possible.
-
removeRule
boolean removeRule(int setSymbol, boolean equalRule, IExpr leftHandSide, boolean packageMode)
Remove the rules associate with this symbol, which equals the givenleftHandSide
expression.- Parameters:
setSymbol
-equalRule
-leftHandSide
-packageMode
-- Returns:
true
if a rule could be removed,false
otherwise
-
setAttributes
void setAttributes(int attributes)
Set the Attributes of this symbol (i.e. LISTABLE, FLAT, ORDERLESS,...)- Parameters:
attributes
- the Attributes of this symbol
-
setDefaultValue
void setDefaultValue(IExpr expr)
Set the general default value for this symbol (i.e.1
is the default value forTimes
,0
is the default value forPlus
). The general default value is used in pattern-matching for expressions likea_. * b_. + c_
- Parameters:
expr
- the general default value- See Also:
getDefaultValue()
-
setDefaultValue
void setDefaultValue(int position, IExpr expr)
Set the default value at the arguments position for this symbol (i.e.1
is the default value forPower
atposition
2
). The default value is used in pattern-matching for expressions likea ^ b_.
- Parameters:
position
- the position for the default valueexpr
- the default value for the given position- See Also:
getDefaultValue(int)
-
setRulesData
void setRulesData(RulesData rd)
-
writeRules
boolean writeRules(ObjectOutputStream stream) throws IOException
Serialize the rule definitions associated to this symbol- Parameters:
stream
-- Returns:
false
if the symbol contains no rule definion.- Throws:
IOException
-
evalAsLeadingTerm
default IExpr evalAsLeadingTerm(ISymbol x, IExpr logx, int cdir)
- Specified by:
evalAsLeadingTerm
in interfaceIExpr
-
-