Package net.sf.tweety.math.term
Class AbsoluteValue
- java.lang.Object
-
- net.sf.tweety.math.term.Term
-
- net.sf.tweety.math.term.FunctionalTerm
-
- net.sf.tweety.math.term.AbsoluteValue
-
public class AbsoluteValue extends FunctionalTerm
This class models the absolute value of the inner term.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description AbsoluteValue(Term term)
Creates a new absolute value term with the given inner term.
-
Method Summary
Modifier and Type Method Description Term
derive(Variable v)
Differentiates the term with respect to the given variable.java.util.Set<AbsoluteValue>
getAbsoluteValues()
Returns all absolute values of this term.boolean
isContinuous(Variable v)
Checks whether this term is continuous in v.Term
replaceTerm(Term toSubstitute, Term substitution)
Replaces each occurrence of "toSubstitute" by "substitution" and return the new term.Term
simplify()
Simplifies this term in an equivalent way:
- Replaces products that contain a zero by the constant zero
- Removes a term one from products
- Removes a term zero from sums
- Aggregates constants in sums, products, and minimums
- Evaluates functional terms on constants
- Simplifies fractions where possible.java.lang.String
toString()
Constant
value()
Computes the actual value of this term if it contains no variables.-
Methods inherited from class net.sf.tweety.math.term.FunctionalTerm
collapseAssociativeOperations, expandAssociativeOperations, getMaximums, getMinimums, getProducts, getTerm, getVariables, isInteger, toLinearForm
-
Methods inherited from class net.sf.tweety.math.term.Term
add, doubleValue, evaluateMatrix, evaluateVector, evaluateVector, isContinuous, isLinear, min, minus, mult, replaceAllTerms, replaceAllTerms
-
-
-
-
Constructor Detail
-
AbsoluteValue
public AbsoluteValue(Term term)
Creates a new absolute value term with the given inner term.- Parameters:
term
- a term
-
-
Method Detail
-
getAbsoluteValues
public java.util.Set<AbsoluteValue> getAbsoluteValues()
Description copied from class:Term
Returns all absolute values of this term.- Overrides:
getAbsoluteValues
in classFunctionalTerm
- Returns:
- all absolute values of this term.
-
replaceTerm
public Term replaceTerm(Term toSubstitute, Term substitution)
Description copied from class:Term
Replaces each occurrence of "toSubstitute" by "substitution" and return the new term.- Specified by:
replaceTerm
in classFunctionalTerm
- Parameters:
toSubstitute
- the term to be substitutedsubstitution
- the new term- Returns:
- this term where "toSubstitute" is replaced by "substitution"
-
derive
public Term derive(Variable v) throws NonDifferentiableException
Description copied from class:Term
Differentiates the term with respect to the given variable.- Specified by:
derive
in classTerm
- Parameters:
v
- a variable.- Returns:
- the derivation of this term wrt. the given variable.
- Throws:
NonDifferentiableException
- if the term cannot be differentiated.
-
simplify
public Term simplify()
Description copied from class:Term
Simplifies this term in an equivalent way:
- Replaces products that contain a zero by the constant zero
- Removes a term one from products
- Removes a term zero from sums
- Aggregates constants in sums, products, and minimums
- Evaluates functional terms on constants
- Simplifies fractions where possible.
-
toString
public java.lang.String toString()
- Specified by:
toString
in classFunctionalTerm
-
isContinuous
public boolean isContinuous(Variable v)
Description copied from class:Term
Checks whether this term is continuous in v.- Specified by:
isContinuous
in classTerm
- Parameters:
v
- a variable- Returns:
- "true" iff this term is continuous in v.
-
value
public Constant value() throws java.lang.IllegalArgumentException
Description copied from class:Term
Computes the actual value of this term if it contains no variables.- Specified by:
value
in classFunctionalTerm
- Returns:
- the value of this term, either a float or an integer.
- Throws:
java.lang.IllegalArgumentException
- if this term contains at least on variable.
-
-