public class CurrencyHolder extends java.lang.Object implements ResourceHolder
Modifier and Type | Field and Description |
---|---|
protected int |
amount |
static java.lang.String |
RESOURCE_NAME
Unique ENUM name of the currency resource.
|
Constructor and Description |
---|
CurrencyHolder(int amount) |
Modifier and Type | Method and Description |
---|---|
ResourceHolder |
add(ResourceHolder other)
Adds the amount in this and the given resource holder together, returning a new holder
with the result.
|
boolean |
equals(java.lang.Object obj) |
int |
getAmount()
The given amount of this resource.
|
java.lang.String |
getName()
A unique ENUM name representing this resource.
|
int |
hashCode() |
java.lang.String |
toString() |
public static final java.lang.String RESOURCE_NAME
protected int amount
public int getAmount()
ResourceHolder
Implementations that use a different data structure should attempt to convert to the integer value.
getAmount
in interface ResourceHolder
public java.lang.String getName()
ResourceHolder
getName
in interface ResourceHolder
public ResourceHolder add(ResourceHolder other)
ResourceHolder
add
in interface ResourceHolder
other
- - resource holder to add.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object