Package com.helger.css.propertyvalue
Class CSSSimpleValueWithUnit
- java.lang.Object
-
- com.helger.css.propertyvalue.CSSSimpleValueWithUnit
-
-
Constructor Summary
Constructors Constructor Description CSSSimpleValueWithUnit(double dValue, ECSSUnit eUnit)ConstructorCSSSimpleValueWithUnit(BigDecimal aValue, ECSSUnit eUnit)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CSSSimpleValueWithUnitadd(double dDelta)Get a new object with the same unit but an added value.CSSSimpleValueWithUnitadd(BigDecimal aDelta)Get a new object with the same unit but an added value.CSSSimpleValueWithUnitdivide(double dDivisor)Get a new object with the same unit but an divided value.CSSSimpleValueWithUnitdivide(BigDecimal aDivisor)Get a new object with the same unit but an divided value.CSSSimpleValueWithUnitdivide(BigDecimal aDivisor, int nScale, RoundingMode eRoundingMode)Get a new object with the same unit but an divided value.booleanequals(Object o)BigDecimalgetAsBigDecimalValue()intgetAsIntValue()longgetAsLongValue()StringgetFormatted()ECSSUnitgetUnit()doublegetValue()inthashCode()CSSSimpleValueWithUnitmultiply(double dValue)Get a new object with the same unit but a multiplied value.CSSSimpleValueWithUnitmultiply(BigDecimal aValue)Get a new object with the same unit but a multiplied value.CSSSimpleValueWithUnitsetUnit(ECSSUnit eUnit)Set the unit type.CSSSimpleValueWithUnitsetValue(double dValue)Set the numerical value.CSSSimpleValueWithUnitsetValue(BigDecimal aValue)Set the numerical value.CSSSimpleValueWithUnitsubstract(double dDelta)Get a new object with the same unit but a subtracted value.CSSSimpleValueWithUnitsubstract(BigDecimal aDelta)Get a new object with the same unit but a subtracted value.StringtoString()
-
-
-
Constructor Detail
-
CSSSimpleValueWithUnit
public CSSSimpleValueWithUnit(@Nonnull BigDecimal aValue, @Nonnull ECSSUnit eUnit)
Constructor- Parameters:
aValue- Numeric value. May not benull.eUnit- CSS unit to use. May not benull.
-
-
Method Detail
-
setValue
@Nonnull public CSSSimpleValueWithUnit setValue(@Nonnull BigDecimal aValue)
Set the numerical value.- Parameters:
aValue- The new value to set. May not benull.- Returns:
- this
- Since:
- 3.7.3
-
setValue
@Nonnull public CSSSimpleValueWithUnit setValue(double dValue)
Set the numerical value.- Parameters:
dValue- The new value to set.- Returns:
- this
- Since:
- 3.7.3
-
getAsBigDecimalValue
@Nonnull public BigDecimal getAsBigDecimalValue()
- Returns:
- The numeric value as a decimal value (as passed in the constructor)
- Since:
- 3.7.3
-
getValue
public double getValue()
- Returns:
- The numeric value as a decimal value (as passed in the constructor)
-
getAsIntValue
public int getAsIntValue()
- Returns:
- The numeric value as an int value - no check for validity is performed
-
getAsLongValue
public long getAsLongValue()
- Returns:
- The numeric value as a long value - no check for validity is performed
-
setUnit
@Nonnull public CSSSimpleValueWithUnit setUnit(@Nonnull ECSSUnit eUnit)
Set the unit type.- Parameters:
eUnit- The new unit to set. May not benull.- Returns:
- this
- Since:
- 3.7.3
-
getFormatted
@Nonnull @Nonempty public String getFormatted()
- Returns:
- The formatted string value of this item. Neither
nullnor empty. - Since:
- 3.7.3
-
add
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit add(@Nonnull BigDecimal aDelta)
Get a new object with the same unit but an added value.- Parameters:
aDelta- The delta to be added. May not benull.- Returns:
- A new object. Never
null. - Since:
- 3.7.3
-
add
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit add(double dDelta)
Get a new object with the same unit but an added value.- Parameters:
dDelta- The delta to be added.- Returns:
- A new object. Never
null.
-
substract
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit substract(@Nonnull BigDecimal aDelta)
Get a new object with the same unit but a subtracted value.- Parameters:
aDelta- The delta to be subtracted. May not benull.- Returns:
- A new object. Never
null. - Since:
- 3.7.3
-
substract
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit substract(double dDelta)
Get a new object with the same unit but a subtracted value.- Parameters:
dDelta- The delta to be subtracted.- Returns:
- A new object. Never
null.
-
multiply
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit multiply(@Nonnull BigDecimal aValue)
Get a new object with the same unit but a multiplied value.- Parameters:
aValue- The value to be multiply with this value. May not benull.- Returns:
- A new object. Never
null. - Since:
- 3.7.3
-
multiply
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit multiply(double dValue)
Get a new object with the same unit but a multiplied value.- Parameters:
dValue- The value to be multiply with this value.- Returns:
- A new object. Never
null.
-
divide
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit divide(@Nonnull BigDecimal aDivisor, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode)
Get a new object with the same unit but an divided value.- Parameters:
aDivisor- The divisor to use. May not benull.nScale- The maximum fraction digits to use.eRoundingMode- The rounding mode to use. May not benull.- Returns:
- A new object. Never
null. - Since:
- 3.7.3
-
divide
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit divide(@Nonnull BigDecimal aDivisor)
Get a new object with the same unit but an divided value. By defaultCCSS.CSS_MAXIMUM_FRACTION_DIGITSis used as scale andRoundingMode.HALF_UPis used as rounding mode.- Parameters:
aDivisor- The divisor to use. May not benull.- Returns:
- A new object. Never
null. - Since:
- 3.7.3
-
divide
@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit divide(double dDivisor)
Get a new object with the same unit but an divided value.- Parameters:
dDivisor- The divisor to use.- Returns:
- A new object. Never
null.
-
-