@Test public void restrict(){ FloatValue floatValue = new FloatValue(0f); DoubleValue doubleValue = new DoubleValue(0d); assertTrue(Double.NEGATIVE_INFINITY < -Double.MAX_VALUE); assertTrue(Double.POSITIVE_INFINITY > Double.MAX_VALUE); floatValue.restrict(2d, Double.POSITIVE_INFINITY); doubleValue.restrict(2d, Double.POSITIVE_INFINITY); assertEquals((Float)2f, floatValue.getValue()); assertEquals((Double)2d, doubleValue.getValue()); floatValue.restrict(Double.NEGATIVE_INFINITY, -2d); doubleValue.restrict(Double.NEGATIVE_INFINITY, -2d); assertEquals((Float)(-2f), floatValue.getValue()); assertEquals((Double)(-2d), doubleValue.getValue()); }
@Operation ( value = "<apply><max/>${0}<apply><min/>${1}${this}</apply></apply>" ) abstract public Value<V> restrict(Number lowValue, Number highValue);
Value implements Comparable<Value<V>> { @Operation ( value = "<apply><max/>${0}<apply><min/>${1}${this}</apply></apply>" ) abstract public Value<V> restrict(Number lowValue, Number highValue); }
Value implements Comparable<Value<V>> { @Operation ( value = "<apply><max/>${0}<apply><min/>${1}${this}</apply></apply>" ) abstract public Value<V> restrict(Number lowValue, Number highValue);  }
Value implements Comparable<Value<V>> { @Operation ( value = "<apply><max/>${0}<apply><min/>${1}${this}</apply></apply>" ) abstract public Value<V> restrict(Number lowValue, Number highValue);  abstract Value<V> copy(); @Operation ( value = "<apply><plus/>${this}${0}</apply>", initialValue = "${0}" ) abstract Value<V> add(Number value); @Operation ( value = "<apply><plus/>${this}${0}</apply>", initialValue = "${0}" ) abstract Value<V> add(Value<? extends Number> value); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}${1}</apply></apply>", initialValue = "<apply><times/>${0}${1}</apply>" ) abstract Value<V> add(Number coefficient, Number factor); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}${1}${2}</apply></apply>", initialValue = "<apply><times/>${0}${1}${2}</apply>" ) abstract Value<V> add(Number coefficient, Number firstFactor, Number secondFactor); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}${1}</apply></apply>", initialValue = "<apply><times/>${0}${1}</apply>" ) abstract Value<V> add(Number coefficient, Number... factors); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}<apply><power/>${1}${2}</apply></apply></apply>", initialValue = "<apply><times/>${0}<apply><power/>${1}${2}</apply></apply>" ) abstract Value<V> add(Number coefficient, Number factor, int exponent); @Operation ( value = "<apply><minus/>${this}${0}</apply>", initialValue = "<apply><minus/>${0}</apply>" ) abstract Value<V> subtract(Number value); @Operation ( value = "<apply><minus/>${this}${0}</apply>", initialValue = "<apply><minus/>${0}</apply>" ) abstract Value<V> subtract(Value<? extends Number> value); @Operation ( value = "<apply><times/>${this}${0}</apply>" ) abstract Value<V> multiply(Number value); @Operation ( value = "<apply><times/>${this}${0}</apply>" ) abstract Value<V> multiply(Value<? extends Number> value); @Operation ( value = "<apply><times/>${this}<apply><power/>${0}${1}</apply></apply>" ) abstract Value<V> multiply(Number factor, Number exponent); @Operation ( value = "<apply><divide/>${this}${0}</apply>" ) abstract Value<V> divide(Number value); @Operation ( value = "<apply><divide/>${this}${0}</apply>" ) abstract Value<V> divide(Value<? extends Number> value); @Operation ( value = "<apply><minus/><cn>1</cn>${0}</apply>" ) abstract Value<V> residual(Value<? extends Number> value); @Operation ( value = "<apply><power/>${this}<cn>2</cn></apply>" ) abstract Value<V> square(); @Operation ( value = "<apply><power/>${this}{0}</apply>" ) abstract Value<V> power(Number value); @Operation ( value = "<apply><divide/><cn>1</cn>${this}</apply>" ) abstract Value<V> reciprocal(); @Operation ( value = "<apply><ci>elliott</ci>${this}</apply>" ) abstract Value<V> elliott(); @Operation ( value = "<apply><exp/>${this}</apply>" ) abstract Value<V> exp(); @Operation ( value = "<apply><ln/>${this}</apply>" ) abstract Value<V> ln(); @Operation ( value = "<apply><ci>gauss</ci>${this}</apply>" ) abstract Value<V> gauss(); @Operation ( value = "<apply><apply><inverse/><ci>logit</ci></apply>${this}</apply>" ) abstract Value<V> inverseLogit(); @Operation ( value = "<apply><apply><inverse/><ci>cloglog</ci></apply>${this}</apply>" ) abstract Value<V> inverseCloglog(); @Operation ( value = "<apply><apply><inverse/><ci>loglog</ci></apply>${this}</apply>" ) abstract Value<V> inverseLoglog(); @Operation ( value = "<apply><apply><inverse/><ci>logc</ci></apply>${this}</apply>" ) abstract Value<V> inverseLogc(); @Operation ( value = "<apply><apply><inverse/><ci>negbin</ci></apply>${this}${0}</apply>" ) abstract Value<V> inverseNegbin(Number value); @Operation ( value = "<apply><apply><inverse/><ci>oddspower</ci></apply>${this}${0}</apply>" ) abstract Value<V> inverseOddspower(Number value); @Operation ( value = "<apply><power/>${this}<apply><divide/><cn>1</cn>${0}</apply></apply>" ) abstract Value<V> inversePower(Number value); @Operation ( value = "<apply><apply><inverse/><ci>cauchit</ci></apply>${this}</apply>" ) abstract Value<V> inverseCauchit(); @Operation ( value = "<apply><apply><inverse/><ci>probit</ci></apply>${this}</apply>" ) abstract Value<V> inverseProbit(); @Operation ( value = "<apply><sin/>${this}</apply>" ) abstract Value<V> sin(); @Operation ( value = "<apply><cos/>${this}</apply>" ) abstract Value<V> cos(); @Operation ( value = "<apply><divide/><apply><times/><cn>2</cn><apply><arctan/>${this}</apply></apply><pi/></apply>" ) abstract Value<V> arctan(); @Operation ( value = "<apply><tanh/>${this}</apply>" ) abstract Value<V> tanh(); @Operation ( value = "<apply><ci>threshold</ci>${this}${0}</apply>" ) abstract Value<V> threshold(Number value); @Operation ( value = "<apply><max/><cn>0</cn>${this}</apply>" ) abstract Value<V> relu(); @Operation ( value = "<apply><abs/>${this}</apply>" ) abstract Value<V> abs(); @Operation ( value = "<apply><ci>gaussSim</ci>${this}${0}</apply>" ) abstract Value<V> gaussSim(Number value); @Operation ( value = "<apply><max/>${0}<apply><min/>${1}${this}</apply></apply>" ) abstract Value<V> restrict(Number lowValue, Number highValue); @Operation ( value = "<apply><ci>round</ci>${this}</apply>" ) abstract Value<V> round(); @Operation ( value = "<apply><ceiling/>${this}</apply>" ) abstract Value<V> ceiling(); @Operation ( value = "<apply><floor/>${this}</apply>" ) abstract Value<V> floor(); @Operation ( value = "<apply><ci>normalize</ci>${this}${0}${1}${2}${3}</apply>" ) abstract Value<V> normalize(Number leftOrig, Number leftNorm, Number rightOrig, Number rightNorm); @Operation ( value = "<apply><ci>denormalize</ci>${this}${0}${1}${2}${3}</apply>" ) abstract Value<V> denormalize(Number leftOrig, Number leftNorm, Number rightOrig, Number rightNorm); abstract boolean isZero(); abstract boolean isOne(); abstract boolean equals(Number value); abstract int compareTo(Number value); abstract float floatValue(); abstract double doubleValue(); abstract V getValue(); }
Value implements Comparable<Value<V>> { @Operation ( value = "<apply><max/>${0}<apply><min/>${1}${this}</apply></apply>" ) abstract public Value<V> restrict(Number lowValue, Number highValue);  abstract Value<V> copy(); @Operation ( value = "<apply><plus/>${this}${0}</apply>", initialValue = "${0}" ) abstract Value<V> add(Number value); @Operation ( value = "<apply><plus/>${this}${0}</apply>", initialValue = "${0}" ) abstract Value<V> add(Value<? extends Number> value); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}${1}</apply></apply>", initialValue = "<apply><times/>${0}${1}</apply>" ) abstract Value<V> add(Number coefficient, Number factor); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}${1}${2}</apply></apply>", initialValue = "<apply><times/>${0}${1}${2}</apply>" ) abstract Value<V> add(Number coefficient, Number firstFactor, Number secondFactor); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}${1}</apply></apply>", initialValue = "<apply><times/>${0}${1}</apply>" ) abstract Value<V> add(Number coefficient, Number... factors); @Operation ( value = "<apply><plus/>${this}<apply><times/>${0}<apply><power/>${1}${2}</apply></apply></apply>", initialValue = "<apply><times/>${0}<apply><power/>${1}${2}</apply></apply>" ) abstract Value<V> add(Number coefficient, Number factor, int exponent); @Operation ( value = "<apply><minus/>${this}${0}</apply>", initialValue = "<apply><minus/>${0}</apply>" ) abstract Value<V> subtract(Number value); @Operation ( value = "<apply><minus/>${this}${0}</apply>", initialValue = "<apply><minus/>${0}</apply>" ) abstract Value<V> subtract(Value<? extends Number> value); @Operation ( value = "<apply><times/>${this}${0}</apply>" ) abstract Value<V> multiply(Number value); @Operation ( value = "<apply><times/>${this}${0}</apply>" ) abstract Value<V> multiply(Value<? extends Number> value); @Operation ( value = "<apply><times/>${this}<apply><power/>${0}${1}</apply></apply>" ) abstract Value<V> multiply(Number factor, Number exponent); @Operation ( value = "<apply><divide/>${this}${0}</apply>" ) abstract Value<V> divide(Number value); @Operation ( value = "<apply><divide/>${this}${0}</apply>" ) abstract Value<V> divide(Value<? extends Number> value); @Operation ( value = "<apply><minus/><cn>1</cn>${0}</apply>" ) abstract Value<V> residual(Value<? extends Number> value); @Operation ( value = "<apply><power/>${this}<cn>2</cn></apply>" ) abstract Value<V> square(); @Operation ( value = "<apply><power/>${this}{0}</apply>" ) abstract Value<V> power(Number value); @Operation ( value = "<apply><divide/><cn>1</cn>${this}</apply>" ) abstract Value<V> reciprocal(); @Operation ( value = "<apply><ci>elliott</ci>${this}</apply>" ) abstract Value<V> elliott(); @Operation ( value = "<apply><exp/>${this}</apply>" ) abstract Value<V> exp(); @Operation ( value = "<apply><ln/>${this}</apply>" ) abstract Value<V> ln(); @Operation ( value = "<apply><ci>gauss</ci>${this}</apply>" ) abstract Value<V> gauss(); @Operation ( value = "<apply><apply><inverse/><ci>logit</ci></apply>${this}</apply>" ) abstract Value<V> inverseLogit(); @Operation ( value = "<apply><apply><inverse/><ci>cloglog</ci></apply>${this}</apply>" ) abstract Value<V> inverseCloglog(); @Operation ( value = "<apply><apply><inverse/><ci>loglog</ci></apply>${this}</apply>" ) abstract Value<V> inverseLoglog(); @Operation ( value = "<apply><apply><inverse/><ci>logc</ci></apply>${this}</apply>" ) abstract Value<V> inverseLogc(); @Operation ( value = "<apply><apply><inverse/><ci>negbin</ci></apply>${this}${0}</apply>" ) abstract Value<V> inverseNegbin(Number value); @Operation ( value = "<apply><apply><inverse/><ci>oddspower</ci></apply>${this}${0}</apply>" ) abstract Value<V> inverseOddspower(Number value); @Operation ( value = "<apply><power/>${this}<apply><divide/><cn>1</cn>${0}</apply></apply>" ) abstract Value<V> inversePower(Number value); @Operation ( value = "<apply><apply><inverse/><ci>cauchit</ci></apply>${this}</apply>" ) abstract Value<V> inverseCauchit(); @Operation ( value = "<apply><apply><inverse/><ci>probit</ci></apply>${this}</apply>" ) abstract Value<V> inverseProbit(); @Operation ( value = "<apply><sin/>${this}</apply>" ) abstract Value<V> sin(); @Operation ( value = "<apply><cos/>${this}</apply>" ) abstract Value<V> cos(); @Operation ( value = "<apply><divide/><apply><times/><cn>2</cn><apply><arctan/>${this}</apply></apply><pi/></apply>" ) abstract Value<V> arctan(); @Operation ( value = "<apply><tanh/>${this}</apply>" ) abstract Value<V> tanh(); @Operation ( value = "<apply><ci>threshold</ci>${this}${0}</apply>" ) abstract Value<V> threshold(Number value); @Operation ( value = "<apply><max/><cn>0</cn>${this}</apply>" ) abstract Value<V> relu(); @Operation ( value = "<apply><abs/>${this}</apply>" ) abstract Value<V> abs(); @Operation ( value = "<apply><ci>gaussSim</ci>${this}${0}</apply>" ) abstract Value<V> gaussSim(Number value); @Operation ( value = "<apply><max/>${0}<apply><min/>${1}${this}</apply></apply>" ) abstract Value<V> restrict(Number lowValue, Number highValue); @Operation ( value = "<apply><ci>round</ci>${this}</apply>" ) abstract Value<V> round(); @Operation ( value = "<apply><ceiling/>${this}</apply>" ) abstract Value<V> ceiling(); @Operation ( value = "<apply><floor/>${this}</apply>" ) abstract Value<V> floor(); @Operation ( value = "<apply><ci>normalize</ci>${this}${0}${1}${2}${3}</apply>" ) abstract Value<V> normalize(Number leftOrig, Number leftNorm, Number rightOrig, Number rightNorm); @Operation ( value = "<apply><ci>denormalize</ci>${this}${0}${1}${2}${3}</apply>" ) abstract Value<V> denormalize(Number leftOrig, Number leftNorm, Number rightOrig, Number rightNorm); abstract boolean isZero(); abstract boolean isOne(); abstract boolean equals(Number value); abstract int compareTo(Number value); abstract float floatValue(); abstract double doubleValue(); abstract V getValue();  }