Package functions.unitary.piecewise
Class DomainRestrictor
Object
GeneralFunction
UnitaryFunction
PiecewiseFunction
DomainRestrictor
- All Implemented Interfaces:
- Differentiable,- Evaluable,- Outputable,- Simplifiable,- Comparable<GeneralFunction>,- Iterable<GeneralFunction>
public class DomainRestrictor extends PiecewiseFunction
The 
DomainRestrictor class allows for the restriction of domains of ranges of functions.
 When domainTester returns true, this class functions as the identity,
 but when domainTester returns false, evaluate returns Double.NaN.- 
Field SummaryFields Modifier and Type Field Description BiPredicate<Double,Map<String,Double>>domainTesterThisBiPredicatedescribes the domain of this function given an argument and list of variable values
- 
Constructor SummaryConstructors Constructor Description DomainRestrictor(GeneralFunction operand, BiPredicate<Double,Map<String,Double>> domainTester)Constructs a newDomainRestrictorDomainRestrictor(GeneralFunction operand, DoublePredicate domainTester)Constructs a newDomainRestrictor
- 
Method SummaryModifier and Type Method Description doubleevaluate(Map<String,Double> variableValues)Evaluates aGeneralFunctionat a point denoted by aMapGeneralFunctiongetDerivative(String varID)Returns the derivative of aGeneralFunctionwith respect to a variable.UnitaryFunctiongetInstance(GeneralFunction operand)Returns a new instance of thisUnitaryFunctionStringtoString()Returns a String representation of thisGeneralFunctionMethods inherited from class UnitaryFunctionclone, compareSelf, equalsFunction, hashCode, iterator, newInstanceOf, simplify, simplifyFOC, simplifyInternal, simplifyInverse, substituteAll, toOutputFunctionMethods inherited from class GeneralFunctioncompareTo, derivativeAt, equals, equalsSimplified, getNthDerivative, getSimplifiedDerivative, substituteVariables
- 
Field Details- 
domainTesterpublic final BiPredicate<Double,Map<String,Double>> domainTesterThisBiPredicatedescribes the domain of this function given an argument and list of variable values
 
- 
- 
Constructor Details- 
DomainRestrictorpublic DomainRestrictor(GeneralFunction operand, BiPredicate<Double,Map<String,Double>> domainTester)Constructs a newDomainRestrictor- Parameters:
- operand- The function whose output will be restricted
- domainTester- the- BiPredicate<Double, Map<String, Double>>describing the domain of the function
 
- 
DomainRestrictorConstructs a newDomainRestrictor- Parameters:
- operand- The function whose output will be restricted
- domainTester- the- DoublePredicatedescribing the domain of the function
 
 
- 
- 
Method Details- 
getInstanceDescription copied from class:UnitaryFunctionReturns a new instance of thisUnitaryFunction- Specified by:
- getInstancein class- UnitaryFunction
- Parameters:
- operand- the- GeneralFunctionto be operated on
- Returns:
- a new instance of this UnitaryFunction
 
- 
getDerivativeDescription copied from interface:DifferentiableReturns the derivative of aGeneralFunctionwith respect to a variable. Should not be used in general;GeneralFunction.getSimplifiedDerivative(java.lang.String)is strongly preferred.- Parameters:
- varID- the ID of the variable that is differentiated against
- Returns:
- the derivative of the function with respect to varID
 
- 
evaluatepublic double evaluate(Map<String,Double> variableValues)Description copied from interface:EvaluableEvaluates aGeneralFunctionat a point denoted by aMap- Parameters:
- variableValues- the values of the variables in the- GeneralFunctionat the point
- Returns:
- the value of the GeneralFunctionat the point
 
- 
toStringpublic String toString()Description copied from class:GeneralFunctionReturns a String representation of thisGeneralFunction- Overrides:
- toStringin class- UnitaryFunction
- Returns:
- String representation of this function
 
 
-