Package worldBuilder
Class MapIndex
- java.lang.Object
-
- worldBuilder.MapIndex
-
public class MapIndex extends java.lang.Object
methods to read, digest and write an RPGMaker "MapInfos.json" file
-
-
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 indexvoid
flush()
write out the (newly accumulated) indexvoid
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 descriptionstatic MapIndex
getInstance()
return (Singleton) instanceboolean
hasChildren(int id)
look up the Map ID associated with a nameRpgmMap
lookup(java.lang.String name)
look up the Map ID associated with a namestatic int
nextID()
return next ID for a new map
-
-
-
Field Detail
-
maps
public java.util.LinkedList<RpgmMap> maps
list of the maps in this index
-
-
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
-
-