Class ConfigConverter

java.lang.Object
  extended byConfigConverter

public class ConfigConverter
extends Object

A utility to convert the old config file formatted slot information into the new SlotDataMgr format.

Author:
Kevin Thompson

Field Summary
private static Hashtable config
           
private static int numslots
           
 
Constructor Summary
ConfigConverter()
           
 
Method Summary
static int drinksDropped(int slot)
          Returns the number of drinks dropped by the given slot.
static int drinksLeft(int slot)
          Returns the number of drinks left in the given slot.
static int getPrice(int slot)
          Returns the price of the slot.
private static Slot getSlot(int slot)
          Returns the Slot object associated with the given slot index.
private static boolean isEnabled(int slot)
          Determines if the given slot is enabled.
static void main(String[] args)
          Converts the named hashmap-style config file to the new SlotDataMgr format for the slots data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numslots

private static int numslots

config

private static Hashtable config
Constructor Detail

ConfigConverter

public ConfigConverter()
Method Detail

main

public static void main(String[] args)
Converts the named hashmap-style config file to the new SlotDataMgr format for the slots data.

Parameters:
args - The command line arguments. The first argument is the filename of the old config file to generate the new SlotDataMgr formatted data from. The second argument is the name of the output file for the SlotDataMgr formatted data.

getSlot

private static Slot getSlot(int slot)
Returns the Slot object associated with the given slot index.

Parameters:
slot - The slot index to retrieve the Slot object for.
Returns:
The Slot object.

isEnabled

private static boolean isEnabled(int slot)
Determines if the given slot is enabled.

Parameters:
slot - The slot to check.
Returns:
True if the slot is enabled, false otherwise.

drinksLeft

public static int drinksLeft(int slot)
Returns the number of drinks left in the given slot.

Parameters:
slot - The index of the slot to return the number of drinks left.

drinksDropped

public static int drinksDropped(int slot)
Returns the number of drinks dropped by the given slot.

Parameters:
slot - The index of the slot to return the number of drinks dropped.

getPrice

public static int getPrice(int slot)
Returns the price of the slot. Prices are given in credits (cents). If the slot cannot be found in the configfile, then the price returned is 50.

Parameters:
slot - The slot to retrieve the price for.
Returns:
The price of the slot.