Class Rewards

  • All Implemented Interfaces:
    java.lang.Iterable<Reward>

    public class Rewards
    extends java.lang.Object
    implements java.lang.Iterable<Reward>
    List of Rewards. Stores all rewards available on the map.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.util.List<Reward> rewards
      list of all 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 object
      Reward 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • rewards

        public java.util.List<Reward> rewards
        list of all rewards
    • Constructor Detail

      • Rewards

        public Rewards()
        Creates a empty Rewards (list)
    • 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 interface java.lang.Iterable<Reward>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object