Class Rewards
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.Rewards
-
-
Constructor Summary
Constructors Constructor Description Rewards()
Creates a empty Rewards (list)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Rewards
deserialize(org.json.JSONArray data)
deserializes a reward list from a json objectReward
get(int i)
Gets the Reward by index.boolean
isEmpty()
If no reward is available.java.util.Iterator<Reward>
iterator()
int
size()
Amount of collectable rewards.java.lang.String
toString()
-
-
-
Field Detail
-
rewards
public java.util.List<Reward> rewards
list of all rewards
-
-
Method Detail
-
deserialize
public static Rewards deserialize(org.json.JSONArray data)
deserializes a reward list from a json object- Parameters:
data
- json data- Returns:
- deserialized rewards
-
get
public Reward get(int i) throws java.lang.IndexOutOfBoundsException
Gets the Reward by index.- Parameters:
i
- index in a list- Returns:
- collectable reward
- Throws:
java.lang.IndexOutOfBoundsException
- if the reward does not exists
-
size
public int size()
Amount of collectable rewards.- Returns:
- amount of rewards
-
isEmpty
public boolean isEmpty()
If no reward is available.- Returns:
- if no reward is available
-
iterator
public java.util.Iterator<Reward> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<Reward>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-