@Internal public abstract class Resource<T extends Resource<T>> extends Object implements Serializable, Comparable<Resource>
MAX_VALUE_SCALE
and all the trailing zeros will be stripped for readability.Modifier | Constructor and Description |
---|---|
protected |
Resource(String name,
BigDecimal value) |
protected |
Resource(String name,
double value) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Resource other) |
protected abstract T |
create(BigDecimal value)
Create a new instance of the sub resource.
|
T |
divide(BigDecimal by) |
T |
divide(int by) |
boolean |
equals(Object o) |
String |
getName() |
BigDecimal |
getValue() |
int |
hashCode() |
boolean |
isZero() |
T |
merge(T other) |
T |
multiply(BigDecimal multiplier) |
T |
multiply(int multiplier) |
T |
subtract(T other) |
String |
toString() |
protected Resource(String name, double value)
protected Resource(String name, BigDecimal value)
public T multiply(BigDecimal multiplier)
public T multiply(int multiplier)
public T divide(BigDecimal by)
public T divide(int by)
public int compareTo(Resource other)
compareTo
in interface Comparable<Resource>
public String getName()
public BigDecimal getValue()
public boolean isZero()
protected abstract T create(BigDecimal value)
value
- The value of the resourceCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.