Class JSONReader


  • public class JSONReader
    extends java.lang.Object
    The JSONReader reads the content of an json file.
    Author:
    dmlux, modified by I.Schumacher
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Long lifecount
      The counter with the number of trials that are allowed to break out the stones of the level
      private java.lang.String path
      The project path to the JSON file
      private java.util.List<java.util.List<java.lang.Long>> rects
      The stones stored as List<List<Long>>
      private int[][] stones
      The stones stored as 2D-int-array
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONReader​(java.lang.String path)
      The constructor needs an path to create the JSONReader
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLifeCounter()
      Getter for the lifeCounter of the JSON file
      int[][] getStones2DArray()
      Getter for the stones of the JSON file
      java.util.List<java.util.List<java.lang.Long>> getStonesListOfLists()
      Getter for the stones of the JSON file
      private void loadJsonValues()
      Loader for the both values "fields" and "maxDrops" of the JSON file
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • path

        private java.lang.String path
        The project path to the JSON file
      • rects

        private java.util.List<java.util.List<java.lang.Long>> rects
        The stones stored as List<List<Long>>
      • stones

        private int[][] stones
        The stones stored as 2D-int-array
      • lifecount

        private java.lang.Long lifecount
        The counter with the number of trials that are allowed to break out the stones of the level
    • Constructor Detail

      • JSONReader

        public JSONReader​(java.lang.String path)
        The constructor needs an path to create the JSONReader
        Parameters:
        path - The absolute path to the JSON file
    • Method Detail

      • getStonesListOfLists

        public java.util.List<java.util.List<java.lang.Long>> getStonesListOfLists()
        Getter for the stones of the JSON file
        Returns:
        The List<List<Long>> of stones
      • getStones2DArray

        public int[][] getStones2DArray()
        Getter for the stones of the JSON file
        Returns:
        The stones as 2D-Array
      • getLifeCounter

        public int getLifeCounter()
        Getter for the lifeCounter of the JSON file
        Returns:
        The lifeCounter
      • loadJsonValues

        private void loadJsonValues()
        Loader for the both values "fields" and "maxDrops" of the JSON file