public abstract class ExprImpl extends java.lang.Object implements IExpr, java.io.Serializable
ASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID
Constructor and Description |
---|
ExprImpl() |
Modifier and Type | Method and Description |
---|---|
IExpr |
$div(IExpr that)
Operator overloading for Scala operator
/ . |
IExpr |
$minus(IExpr that)
Operator overloading for Scala operator
/ . |
IExpr |
$plus(IExpr that)
Operator overloading for Scala operator
+ . |
IExpr |
$times(IExpr that)
Operator overloading for Scala operator
* . |
IExpr |
$up(IExpr that)
Operator overloading for Scala operator
^ . |
IExpr |
abs()
Absolute value of this.
|
IExpr |
and(IExpr that) |
IExpr |
apply(IExpr... leaves) |
IExpr |
apply(java.util.List<? extends IExpr> leaves) |
java.lang.Object |
asType(java.lang.Class<?> clazz) |
int |
compareTo(IExpr expr)
Compares this expression with the specified expression for order.
|
INumber |
conjugate() |
IExpr |
copy()
Clone this Element.
|
IExpr |
dec()
Returns an
IExpr whose value is (this - 1) . |
IExpr |
divide(IExpr that)
Returns an
IExpr whose value is (this / that) . |
IExpr[] |
egcd(IExpr b)
Extended greatest common divisor.
|
org.apache.commons.math4.complex.Complex |
evalComplex()
Evaluate the expression to a
INumber value. |
double |
evalDouble()
Evaluate the expression to a Java
double value. |
INumber |
evalNumber()
Evaluate the expression to a
INumber value. |
ISignedNumber |
evalSignedNumber()
Evaluate the expression to a
ISignedNumber value. |
edu.jas.structure.ElemFactory<IExpr> |
factory()
Get the corresponding element factory.
|
java.lang.String |
fullFormString()
Return the
FullForm() of this expression |
IExpr |
gcd(IExpr that)
Greatest common divisor.
|
IExpr |
getAt(int index)
Get the element at the specified
index if this object is of
type IAST . |
abstract ISymbol |
head()
If this object is an instance of
IAST get the first element
(offset 0) of the IAST list (i.e. get(0) ). |
IExpr |
inc()
Returns an
IExpr whose value is (this + 1) . |
java.lang.String |
internalFormString(boolean symbolsAsFactoryMethod,
int depth)
Return the internal Java form of this expression.
|
java.lang.String |
internalJavaString(boolean symbolsAsFactoryMethod,
int depth,
boolean useOperators)
Return the internal Java form of this expression.
|
java.lang.String |
internalScalaString(boolean symbolsAsFactoryMethod,
int depth)
Return the internal Scala form of this expression.
|
IExpr |
inverse()
Returns the multiplicative inverse of this object.
|
long |
leafCount()
Count the number of leaves of this expression.
|
java.util.List<IExpr> |
leaves()
Get a list of the leaf expressions.
|
IExpr |
minus(IExpr that)
Returns an
IExpr whose value is (this - that) . |
IExpr |
mod(IExpr that) |
IExpr |
multiply(IExpr that)
Additional multiply method which works like
times() to
fulfill groovy's method signature |
IExpr |
negate()
Negate this.
|
IExpr |
negative()
Additional negative method, which works like opposite to fulfill groovy's
method signature
|
IExpr |
opposite()
Returns an
IExpr whose value is (-1) * this . |
IExpr |
optional(IExpr that)
The
ExprNull.NIL#optional() method always returns
that . |
IExpr |
or(IExpr that) |
IExpr |
plus(IExpr that)
Returns an
IExpr whose value is (this + that) . |
IExpr |
power(IExpr that)
Returns an
IExpr whose value is (this ^ that) . |
IExpr |
power(long n)
Returns an
IExpr whose value is (this ^ n) . |
IExpr |
remainder(IExpr that)
Remainder after division of this by S.
|
IExpr |
replaceAll(java.util.function.Function<IExpr,IExpr> function)
Replace all (sub-) expressions with the given unary function.
|
IExpr |
replaceAll(IAST astRules)
Replace all (sub-) expressions with the given rule set.
|
IExpr |
replacePart(IAST astRules)
Replace all subexpressions with the given rule set.
|
IExpr |
replaceRepeated(java.util.function.Function<IExpr,IExpr> function)
Repeatedly replace all (sub-) expressions with the given unary function.
|
IExpr |
replaceRepeated(IAST astRules)
Repeatedly replace all (sub-) expressions with the given rule set.
|
static IExpr |
replaceRepeated(IExpr expr,
VisitorReplaceAll visitor) |
IExpr |
replaceSlots(IAST astSlots)
Replace all occurrences of Slot[<index>] expressions with the
expression at the appropriate
index in the given
slotsList . |
int |
signum()
Deprecated.
|
IExpr |
subtract(IExpr that)
Subtract S from this.
|
IExpr |
sum(IExpr that)
Sum of this and S.
|
IExpr |
times(IExpr that)
Returns an
IExpr whose value is (this * that) . |
ISymbol |
topHead()
The 'highest level' head of the expression, before Symbol, Integer, Real
or String. for example while the head of a[b][c] is a[b], the top head is
a.
|
java.lang.String |
toScript()
Get a scripting compatible string representation.
|
java.lang.String |
toScriptFactory()
Get a scripting compatible string representation of the factory.
|
IExpr |
variables2Slots(java.util.Map<IExpr,IExpr> map,
java.util.Collection<IExpr> variableCollector)
Convert the variables (i.e. expressions of type
ISymbol
which aren't constants) in this expression into Slot[] s. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, accept, accept, accept, evaluate, evaluateHead, getField, hierarchy, ifPresent, isAllExpanded, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAST, isAST, isAST, isAST, isAST, isAST, isAST, isASTSizeGE, isAtom, isBlank, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isConstant, isCos, isCosh, isDerivative, isDirectedInfinity, isE, isExpanded, isFalse, isFlatAST, isFraction, isFree, isFree, isFree, isFreeAST, isFreeAST, isFreeOfPatterns, 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, isPattern, isPatternDefault, isPatternExpr, 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, multiply, ofNullable, orElse, orElseGet, orElseThrow, reciprocal, timesDistributed
public static IExpr replaceRepeated(IExpr expr, VisitorReplaceAll visitor)
public IExpr abs()
edu.jas.structure.AbelianGroupElem
abs
in interface edu.jas.structure.AbelianGroupElem<IExpr>
public java.lang.Object asType(java.lang.Class<?> clazz)
public int compareTo(IExpr expr)
IExpr
public IExpr copy()
edu.jas.structure.Element
copy
in interface edu.jas.structure.Element<IExpr>
public INumber conjugate()
public IExpr divide(IExpr that)
IExpr
whose value is (this / that)
.
Calculates F.eval(F.Times(this, F.Power(that, F.CN1)))
in
the common case and uses a specialized implementation for derived number
classes.public IExpr[] egcd(IExpr b)
edu.jas.structure.RingElem
egcd
in interface edu.jas.structure.RingElem<IExpr>
b
- other element.public double evalDouble()
double
value. If the
conversion to a double value is not possible, the method throws a
WrongArgumentType
exception.evalDouble
in interface IExpr
double
value.public org.apache.commons.math4.complex.Complex evalComplex()
INumber
value.evalComplex
in interface IExpr
null
if the conversion is not possible.public INumber evalNumber()
INumber
value.evalNumber
in interface IExpr
null
if the conversion is not possible.public ISignedNumber evalSignedNumber()
ISignedNumber
value.evalSignedNumber
in interface IExpr
null
if the conversion is not possible.public edu.jas.structure.ElemFactory<IExpr> factory()
edu.jas.structure.Element
factory
in interface edu.jas.structure.Element<IExpr>
public java.lang.String fullFormString()
IExpr
FullForm()
of this expressionfullFormString
in interface IExpr
public IExpr gcd(IExpr that)
edu.jas.structure.RingElem
gcd
in interface edu.jas.structure.RingElem<IExpr>
that
- other element.public IExpr getAt(int index)
index
if this object is of
type IAST
.public abstract ISymbol head()
IAST
get the first element
(offset 0) of the IAST
list (i.e. get(0) ).public java.lang.String internalFormString(boolean symbolsAsFactoryMethod, int depth)
internalFormString
in interface IExpr
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".public java.lang.String internalScalaString(boolean symbolsAsFactoryMethod, int depth)
internalScalaString
in interface IExpr
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".public java.lang.String internalJavaString(boolean symbolsAsFactoryMethod, int depth, boolean useOperators)
internalJavaString
in interface IExpr
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".useOperators
- use operators instead of function names for representation of
Plus, Times, Power,...public IExpr inverse()
this.times(this.inverse()) == ONE
, with ONE
being the multiplicative identity. Calculates
F.eval(F.Power(this, F.CN1))
in the common case and uses a
specialized implmentation for derived number classes.public final long leafCount()
public final java.util.List<IExpr> leaves()
public final IExpr minus(IExpr that)
IExpr
whose value is (this - that)
.
Calculates F.eval(F.Plus(this, F.Times(F.CN1, that)))
in the
common case and uses a specialized implementation for derived number
classes.public final IExpr multiply(IExpr that)
times()
to
fulfill groovy's method signaturemultiply
in interface edu.jas.structure.MonoidElem<IExpr>
multiply
in interface org.apache.commons.math4.FieldElement<IExpr>
multiply
in interface IExpr
that
- element to multiplyIExpr.times(IExpr)
public IExpr negate()
public final IExpr negative()
negative
in interface IExpr
IExpr.opposite()
public IExpr opposite()
IExpr
whose value is (-1) * this
.
Calculates F.eval(F.Times(F.CN1, this))
in the common case
and uses a specialized implementation for derived number classes.opposite
in interface IExpr
IExpr.negative()
public final IExpr optional(IExpr that)
ExprNull.NIL#optional()
method always returns
that
. All other objects which implement this method returns
that
if that!=null
or this
if
that==null
optional
in interface IExpr
that
if that!=null
or this
in all other cases.AbstractAST.optional(IExpr)
public IExpr plus(IExpr that)
IExpr
whose value is (this + that)
.
Calculates F.eval(F.Plus(this, that))
in the common case and
uses a specialized implementation for derived number classes.public final IExpr inc()
IExpr
whose value is (this + 1)
.
Calculates F.eval(F.Plus(this, C1))
in the common case and
uses a specialized implementation for derived number classes.public final IExpr dec()
IExpr
whose value is (this - 1)
.
Calculates F.eval(F.Subtract(this, C1))
in the common case
and uses a specialized implementation for derived number classes.public final IExpr power(IExpr that)
IExpr
whose value is (this ^ that)
.
Calculates F.eval(F.Power(this, that))
in the common case
and uses a specialized implementation for derived number classes.public IExpr power(long n)
IExpr
whose value is (this ^ n)
.
Calculates F.eval(F.Power(this, that))
in the common case
and uses a specialized implementation for derived number classes.public IExpr remainder(IExpr that)
edu.jas.structure.MonoidElem
remainder
in interface edu.jas.structure.MonoidElem<IExpr>
public final IExpr replaceAll(java.util.function.Function<IExpr,IExpr> function)
null
.replaceAll
in interface IExpr
function
- if the unary functions apply()
method returns
F.NIL
the expression isn't substituted.F.NIL
if no substitution of a (sub-)expression was
possible.public final IExpr replaceAll(IAST astRules)
null
.replaceAll
in interface IExpr
astRules
- rules of the form x->y
or
{a->b, c->d}
; the left-hand-side of the
rule can contain pattern objects.F.NIL
if no substitution of a (sub-)expression was
possible.public final IExpr replacePart(IAST astRules)
F.NIL
.replacePart
in interface IExpr
astRules
- rules of the form position->y
or
{position1->b, position2->d}
F.NIL
if no substitution of a subexpression was
possible.public final IExpr replaceRepeated(java.util.function.Function<IExpr,IExpr> function)
this
.replaceRepeated
in interface IExpr
function
- if the unary functions apply()
method returns
null
the expression isn't substituted.this
if no substitution of a (sub-)expression was
possible.public final IExpr replaceRepeated(IAST astRules)
this
.replaceRepeated
in interface IExpr
astRules
- rules of the form x->y
or
{a->b, c->d}
; the left-hand-side of the
rule can contain pattern objects.this
if no substitution of a (sub-)expression was
possible.public final IExpr replaceSlots(IAST astSlots)
Replace all occurrences of Slot[<index>] expressions with the
expression at the appropriate index
in the given
slotsList
.
Note: If a slot value is null
the Slot will not be
substituted.
replaceSlots
in interface IExpr
astSlots
- the values for the slots.null
if no substitution occurred.@Deprecated public int signum()
public final IExpr subtract(IExpr that)
edu.jas.structure.AbelianGroupElem
public final IExpr sum(IExpr that)
edu.jas.structure.AbelianGroupElem
public IExpr times(IExpr that)
IExpr
whose value is (this * that)
.
Calculates F.eval(F.Times(this, that))
in the common case
and uses a specialized implementation for derived number classes.public final ISymbol topHead()
IExpr
public final java.lang.String toScript()
edu.jas.structure.Element
toScript
in interface edu.jas.structure.Element<IExpr>
public final java.lang.String toScriptFactory()
edu.jas.structure.Element
toScriptFactory
in interface edu.jas.structure.Element<IExpr>
public IExpr variables2Slots(java.util.Map<IExpr,IExpr> map, java.util.Collection<IExpr> variableCollector)
ISymbol
which aren't constants) in this expression into Slot[] s.variables2Slots
in interface IExpr
map
- for every given symbol argument return the associated unique
slot from this mapvariableCollector
- collects the variables which are used in the replacement
processF.NIL
if no variable symbol was found.public final IExpr $div(IExpr that)
IExpr
/
. Calls
divide(that)
.public final IExpr $minus(IExpr that)
IExpr
/
. Calls
divide(that)
.public final IExpr $plus(IExpr that)
IExpr
+
. Calls
plus(that)
.public final IExpr $times(IExpr that)
IExpr
*
. Calls
times(that)
.