Package worldBuilder

Class MapIndex


  • public class MapIndex
    extends java.lang.Object
    methods to read, digest and write an RPGMaker "MapInfos.json" file
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.util.LinkedList<RpgmMap> maps
      list of the maps in this index
    • Constructor Summary

      Constructors 
      Constructor Description
      MapIndex​(java.lang.String directory)
      Digest an existing MapInfos.json
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RpgmMap addMap​(java.lang.String parent)
      create a new map and add it to the index
      void flush()
      write out the (newly accumulated) index
      void flushChildren​(int parent, java.io.FileWriter output)
      write out all of the children of a specified node (pre-order)
      void flushMap​(RpgmMap m, java.io.FileWriter output)
      write out a single map description
      static MapIndex getInstance()
      return (Singleton) instance
      boolean hasChildren​(int id)
      look up the Map ID associated with a name
      RpgmMap lookup​(java.lang.String name)
      look up the Map ID associated with a name
      static int nextID()
      return next ID for a new map
      • Methods inherited from class java.lang.Object

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

      • maps

        public java.util.LinkedList<RpgmMap> maps
        list of the maps in this index
    • Constructor Detail

      • MapIndex

        public MapIndex​(java.lang.String directory)
        Digest an existing MapInfos.json
        Parameters:
        directory - - name of directory containing maps
    • Method Detail

      • nextID

        public static int nextID()
        return next ID for a new map
      • getInstance

        public static MapIndex getInstance()
        return (Singleton) instance
      • flush

        public void flush()
        write out the (newly accumulated) index
      • flushChildren

        public void flushChildren​(int parent,
                                  java.io.FileWriter output)
                           throws java.io.IOException
        write out all of the children of a specified node (pre-order)
        Parameters:
        parent -
        output -
        Throws:
        java.io.IOException
      • flushMap

        public void flushMap​(RpgmMap m,
                             java.io.FileWriter output)
                      throws java.io.IOException
        write out a single map description
        Parameters:
        m - - the RpgmMap to be written
        Throws:
        java.io.IOException
      • addMap

        public RpgmMap addMap​(java.lang.String parent)
        create a new map and add it to the index
        Parameters:
        parent - name of parent map
      • lookup

        public RpgmMap lookup​(java.lang.String name)
        look up the Map ID associated with a name
        Parameters:
        name - to look up
      • hasChildren

        public boolean hasChildren​(int id)
        look up the Map ID associated with a name
        Parameters:
        id - - name to look up