@NotThreadSafe public class CSSSimpleValueWithUnit extends Object
ECSSUnit).| Constructor and Description |
|---|
CSSSimpleValueWithUnit(BigDecimal aValue,
ECSSUnit eUnit)
Constructor
|
CSSSimpleValueWithUnit(double dValue,
ECSSUnit eUnit)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
CSSSimpleValueWithUnit |
add(BigDecimal aDelta)
Get a new object with the same unit but an added value.
|
CSSSimpleValueWithUnit |
add(double dDelta)
Get a new object with the same unit but an added value.
|
CSSSimpleValueWithUnit |
divide(BigDecimal aDivisor)
Get a new object with the same unit but an divided value.
|
CSSSimpleValueWithUnit |
divide(BigDecimal aDivisor,
int nScale,
RoundingMode eRoundingMode)
Get a new object with the same unit but an divided value.
|
CSSSimpleValueWithUnit |
divide(double dDivisor)
Get a new object with the same unit but an divided value.
|
boolean |
equals(Object o) |
BigDecimal |
getAsBigDecimalValue() |
int |
getAsIntValue() |
long |
getAsLongValue() |
String |
getFormatted() |
ECSSUnit |
getUnit() |
double |
getValue() |
int |
hashCode() |
CSSSimpleValueWithUnit |
multiply(BigDecimal aValue)
Get a new object with the same unit but a multiplied value.
|
CSSSimpleValueWithUnit |
multiply(double dValue)
Get a new object with the same unit but a multiplied value.
|
CSSSimpleValueWithUnit |
setUnit(ECSSUnit eUnit)
Set the unit type.
|
CSSSimpleValueWithUnit |
setValue(BigDecimal aValue)
Set the numerical value.
|
CSSSimpleValueWithUnit |
setValue(double dValue)
Set the numerical value.
|
CSSSimpleValueWithUnit |
substract(BigDecimal aDelta)
Get a new object with the same unit but a subtracted value.
|
CSSSimpleValueWithUnit |
substract(double dDelta)
Get a new object with the same unit but a subtracted value.
|
String |
toString() |
public CSSSimpleValueWithUnit(@Nonnull BigDecimal aValue, @Nonnull ECSSUnit eUnit)
aValue - Numeric value. May not be null.eUnit - CSS unit to use. May not be null.@Nonnull public CSSSimpleValueWithUnit setValue(@Nonnull BigDecimal aValue)
aValue - The new value to set. May not be null.@Nonnull public CSSSimpleValueWithUnit setValue(double dValue)
dValue - The new value to set.@Nonnull public BigDecimal getAsBigDecimalValue()
public double getValue()
public int getAsIntValue()
public long getAsLongValue()
@Nonnull public CSSSimpleValueWithUnit setUnit(@Nonnull ECSSUnit eUnit)
eUnit - The new unit to set. May not be null.@Nonnull @Nonempty public String getFormatted()
null
nor empty.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit add(@Nonnull BigDecimal aDelta)
aDelta - The delta to be added. May not be null.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit add(double dDelta)
dDelta - The delta to be added.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit substract(@Nonnull BigDecimal aDelta)
aDelta - The delta to be subtracted. May not be null.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit substract(double dDelta)
dDelta - The delta to be subtracted.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit multiply(@Nonnull BigDecimal aValue)
aValue - The value to be multiply with this value. May not be
null.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit multiply(double dValue)
dValue - The value to be multiply with this value.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit divide(@Nonnull BigDecimal aDivisor, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode)
aDivisor - The divisor to use. May not be null.nScale - The maximum fraction digits to use.eRoundingMode - The rounding mode to use. May not be null.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit divide(@Nonnull BigDecimal aDivisor)
CCSS.CSS_MAXIMUM_FRACTION_DIGITS is used as scale and
RoundingMode.HALF_UP is used as rounding mode.aDivisor - The divisor to use. May not be null.null.@Nonnull @CheckReturnValue public CSSSimpleValueWithUnit divide(double dDivisor)
dDivisor - The divisor to use.null.Copyright © 2014–2022 Philip Helger. All rights reserved.