public class Operable<T extends Comparable<T>> extends Object implements IOperable<T>
IOperable. it wraps the Comparable interface to become
readable/usable. in other words: wraps any java-bean to be a comparable number.
if null-converter was given , only a constraint selection of operations are available.| Constructor and Description |
|---|
Operable(T value,
IConverter<T,Number> converter)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
T |
add(T operand)
returns the addition of current value and given operand
|
protected void |
checkConverter()
throws an exception, if converter is null.
|
T |
divide(T operand)
returns the division of current value and given operand
|
Number |
getConversion() |
protected double |
getDelta(T operand) |
T |
getDiff(T operand)
returns the difference between current value and given operand
|
protected double |
getDivision(T operand) |
protected double |
getMultiplication(T operand) |
protected double |
getSum(T operand) |
T |
getValue()
returns the current operand
|
boolean |
isGreater(T operand)
returns true, if the current value is greater than the given operand value
|
boolean |
isLower(T operand)
returns true, if the current value is lower than the given operand value
|
T |
max(T operand)
returns the maximum of current value and given operand
|
T |
min(T operand)
returns the mimimum of current value and given operand
|
T |
multiply(T operand)
returns the multiplication of current value and given operand
|
T |
subtract(T operand)
returns the subtraction of current value and given operand
|
public Operable(T value, IConverter<T,Number> converter)
value - operands valueconverter - (optional) converter to provide operations like substract() and add()public boolean isLower(T operand)
isLower in interface IOperable<T extends Comparable<T>>public boolean isGreater(T operand)
isGreater in interface IOperable<T extends Comparable<T>>public T min(T operand)
min in interface IOperable<T extends Comparable<T>>public T max(T operand)
max in interface IOperable<T extends Comparable<T>>public T getDiff(T operand)
getDiff in interface IOperable<T extends Comparable<T>>protected double getDelta(T operand)
protected double getSum(T operand)
protected double getMultiplication(T operand)
protected double getDivision(T operand)
public T subtract(T operand)
subtract in interface IOperable<T extends Comparable<T>>public T add(T operand)
add in interface IOperable<T extends Comparable<T>>public T multiply(T operand)
multiply in interface IOperable<T extends Comparable<T>>public T divide(T operand)
divide in interface IOperable<T extends Comparable<T>>public T getValue()
getValue in interface IOperable<T extends Comparable<T>>public Number getConversion()
protected void checkConverter()
Copyright © 2012–2022. All rights reserved.