edu.stanford.multiagent.gamer
Class Global

java.lang.Object
  |
  +--edu.stanford.multiagent.gamer.Global

public class Global
extends java.lang.Object

A Class to hold global parameters, utilities, etc.


Field Summary
static int FUNC
           
static int GAME
           
static java.lang.String[] gArgs
           
static int GRAPH
           
static int OUTPUT
           
static edu.stanford.multiagent.gamer.Parameters params
           
static java.util.Random rand
           
static long randSeed
           
static java.lang.String VERSION_STRING
           
 
Constructor Summary
Global()
           
 
Method Summary
static long factorial(long x)
           
static java.lang.String getClassList(int type)
          Return a help string listing all known ground/non-ground classes
static Parameters.ParamInfo[] getClassParamInfo(java.lang.Class cl)
          Returns the parameter info array for a given class name
static Parameters.ParamInfo[] getClassParamInfo(java.lang.String name)
           
static void getGroundClasses(int type, java.util.Set v)
           
static void getGroundClasses(int type, java.lang.String name, java.util.Set v)
          Construct a list of ground classes that are subsets of a given typ Puts them into v
static java.lang.String getHelp()
           
static java.lang.Object getObjectOrDie(java.lang.String name, int type)
           
static java.lang.String getRandomClass(int type)
           
static java.lang.String getRandomClass(int type, java.lang.String ancestor)
          Return a random ground subclass
static java.lang.String getRandomClassInt(int type, java.util.Vector ancestors)
          Return a random ground subclass from an intersection
static void handleError(java.lang.Exception e, java.lang.String s)
           
static void handleError(java.lang.String s)
           
static boolean isGround(int type, java.lang.String name)
          Check whether name corresponds to a ground classs
static boolean isKnown(int type, java.lang.String name)
          Check whether it's known
static boolean isPartOf(int type, java.lang.String a, java.lang.String b)
          Check whether one class of objects is a subtype of another (i.e.
static double max(double x, double y)
           
static int max(int x, int y)
           
static long max(long x, long y)
           
static double min(double x, double y)
           
static int min(int x, int y)
           
static long min(long x, long y)
           
static long NChooseM(long n, long m)
           
static double[] parseDoubleArray(java.util.Vector v)
           
static int[] parseIntArray(java.util.Vector v)
          Convert array of strings into array of ints
static boolean randomBoolean()
           
static double randomDouble()
           
static double randomDouble(double low, double high)
           
static int randomInt(int low, int high)
           
static long randomLong(long low, long high)
           
static void registerParams(java.lang.Class cl, Parameters.ParamInfo[] pi)
          Function must be called by every class to register its parameters
static java.lang.String wrap(java.lang.String s, int width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_STRING

public static java.lang.String VERSION_STRING

rand

public static java.util.Random rand

randSeed

public static long randSeed

GAME

public static final int GAME
See Also:
Constant Field Values

GRAPH

public static final int GRAPH
See Also:
Constant Field Values

FUNC

public static final int FUNC
See Also:
Constant Field Values

OUTPUT

public static final int OUTPUT
See Also:
Constant Field Values

params

public static edu.stanford.multiagent.gamer.Parameters params

gArgs

public static java.lang.String[] gArgs
Constructor Detail

Global

public Global()
Method Detail

parseIntArray

public static int[] parseIntArray(java.util.Vector v)
                           throws java.lang.NumberFormatException
Convert array of strings into array of ints

java.lang.NumberFormatException

parseDoubleArray

public static double[] parseDoubleArray(java.util.Vector v)
                                 throws java.lang.NumberFormatException
java.lang.NumberFormatException

randomLong

public static long randomLong(long low,
                              long high)

randomInt

public static int randomInt(int low,
                            int high)

randomDouble

public static double randomDouble(double low,
                                  double high)

randomDouble

public static double randomDouble()

randomBoolean

public static boolean randomBoolean()

factorial

public static long factorial(long x)

NChooseM

public static long NChooseM(long n,
                            long m)
                     throws java.lang.Exception
java.lang.Exception

max

public static double max(double x,
                         double y)

max

public static int max(int x,
                      int y)

max

public static long max(long x,
                       long y)

min

public static double min(double x,
                         double y)

min

public static int min(int x,
                      int y)

min

public static long min(long x,
                       long y)

handleError

public static void handleError(java.lang.Exception e,
                               java.lang.String s)

handleError

public static void handleError(java.lang.String s)

getObjectOrDie

public static java.lang.Object getObjectOrDie(java.lang.String name,
                                              int type)

getHelp

public static java.lang.String getHelp()

wrap

public static java.lang.String wrap(java.lang.String s,
                                    int width)

registerParams

public static final void registerParams(java.lang.Class cl,
                                        Parameters.ParamInfo[] pi)
Function must be called by every class to register its parameters


getClassParamInfo

public static final Parameters.ParamInfo[] getClassParamInfo(java.lang.Class cl)
                                                      throws java.lang.Exception
Returns the parameter info array for a given class name

java.lang.Exception

getClassParamInfo

public static final Parameters.ParamInfo[] getClassParamInfo(java.lang.String name)
                                                      throws java.lang.Exception
java.lang.Exception

isGround

public static boolean isGround(int type,
                               java.lang.String name)
Check whether name corresponds to a ground classs


isKnown

public static boolean isKnown(int type,
                              java.lang.String name)
Check whether it's known


getGroundClasses

public static void getGroundClasses(int type,
                                    java.lang.String name,
                                    java.util.Set v)
Construct a list of ground classes that are subsets of a given typ Puts them into v


getGroundClasses

public static void getGroundClasses(int type,
                                    java.util.Set v)

getClassList

public static java.lang.String getClassList(int type)
Return a help string listing all known ground/non-ground classes


isPartOf

public static boolean isPartOf(int type,
                               java.lang.String a,
                               java.lang.String b)
Check whether one class of objects is a subtype of another (i.e. a is in b)


getRandomClass

public static java.lang.String getRandomClass(int type,
                                              java.lang.String ancestor)
Return a random ground subclass


getRandomClassInt

public static java.lang.String getRandomClassInt(int type,
                                                 java.util.Vector ancestors)
Return a random ground subclass from an intersection


getRandomClass

public static java.lang.String getRandomClass(int type)