|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.tile.tools.MapFileTileSetIDBroker
public class MapFileTileSetIDBroker
Stores a set of tileset name to id mappings in a map file.
| Field Summary | |
|---|---|
protected HashMap<String,Integer> |
_map
Our mapping from tileset names to ids. |
protected File |
_mapfile
Our persistent map file. |
protected int |
_nextTileSetID
The next tileset id that we'll assign. |
protected int |
_storedTileSetID
The last tileset id assigned when we were unserialized. |
protected static String |
SEP_STR
The character we use to separate tileset name from code in the map file. |
| Constructor Summary | |
|---|---|
MapFileTileSetIDBroker(File mapfile)
Creates a broker that will use the specified file as its persistent store. |
|
| Method Summary | |
|---|---|
void |
commit()
When the user of a tilset id broker is done obtaining tileset ids, it must call this method to give the tileset id broker an opportunity to flush any newly created tileset ids back to its persistent store. |
protected Iterator<String> |
enumerateMappings()
Used by DumpTileSetMap to enumerate our tileset ID
mappings. |
int |
getTileSetID(String tileSetName)
Returns the unique identifier for the named tileset. |
protected int |
readInt(BufferedReader bin)
|
static void |
readMapFile(BufferedReader bin,
HashMap<String,Integer> map)
Reads in a mapping from strings to integers, which should have been written via writeMapFile(java.io.BufferedWriter, java.util.HashMap. |
protected boolean |
renameTileSet(String oldName,
String newName)
Copies the ID from the old tileset to the new tileset which is useful when a tileset is renamed. |
boolean |
tileSetMapped(String tileSetName)
Returns true if the specified tileset name is currently mapped to some value by this broker. |
static void |
writeMapFile(BufferedWriter bout,
HashMap<String,Integer> map)
Writes out a mapping from strings to integers in a manner that can be read back in via readMapFile(java.io.BufferedReader, java.util.HashMap. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected File _mapfile
protected int _nextTileSetID
protected int _storedTileSetID
protected HashMap<String,Integer> _map
protected static final String SEP_STR
| Constructor Detail |
|---|
public MapFileTileSetIDBroker(File mapfile)
throws PersistenceException
PersistenceException| Method Detail |
|---|
protected int readInt(BufferedReader bin)
throws IOException
IOException
public int getTileSetID(String tileSetName)
throws PersistenceException
TileSetIDBroker
getTileSetID in interface TileSetIDBrokerPersistenceException - thrown if an error occurs
communicating with the underlying persistence mechanism used to
store the name to id mappings.
public boolean tileSetMapped(String tileSetName)
throws PersistenceException
TileSetIDBroker
tileSetMapped in interface TileSetIDBrokerPersistenceException - thrown if an error occurs
communicating with the underlying persistence mechanism used to
store the name to id mappings.
public void commit()
throws PersistenceException
TileSetIDBroker
commit in interface TileSetIDBrokerPersistenceException
public static void readMapFile(BufferedReader bin,
HashMap<String,Integer> map)
throws IOException
writeMapFile(java.io.BufferedWriter, java.util.HashMap) .
IOException
public static void writeMapFile(BufferedWriter bout,
HashMap<String,Integer> map)
throws IOException
readMapFile(java.io.BufferedReader, java.util.HashMap) .
IOException
protected boolean renameTileSet(String oldName,
String newName)
RenameTileSet utility.
protected Iterator<String> enumerateMappings()
DumpTileSetMap to enumerate our tileset ID
mappings.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||