public class Main
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
studentDirectory
Student directory
|
| Constructor and Description |
|---|
Main() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
addQuotes(java.lang.String s)
Return s with quotes added around it.
|
static java.lang.Object |
createUserManager(java.lang.String userManagerClass)
Create and return an instance of the user-defined manager class
|
static int |
fib(int i)
Return fibonachi number i (0 indexed), starting with 0,1,1,2 ...
|
static void |
main(java.lang.String[] args)
Read args for a string of a ClassName of the Manager to create, then create
an instance of that manager class, create the game and the threads, and start the game.
|
static <T> T |
randomElement(java.util.Collection<T> elms)
Return a random element of elms (null if elms is empty).
|
static int |
sumTo(int i)
Return the sum of the natural numbers in 0..i, recursively!
(mathematicially, that's 0 if i < 0)
|
public static final java.lang.String studentDirectory
public static void main(java.lang.String[] args)
throws java.lang.IllegalArgumentException
args - - a 1x... array containing the name of the class of the user wants as the Manager
first argument is manager name, other args are flags.
If null or empty, uses {"MyManager"} as a 1x1 array of args.java.lang.IllegalArgumentException - if args is null or has length 0.public static java.lang.Object createUserManager(java.lang.String userManagerClass)
throws java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException
userManagerClass - - the String Name of the class to definejava.lang.ClassNotFoundException - - If the string class is not foundjava.lang.InstantiationException - - If there is an error in creating the instancejava.lang.IllegalAccessException - - If the constructor for the class is not visiblejava.lang.IllegalArgumentException - - If the given class is not a subclass of Manager.public static int sumTo(int i)
public static int fib(int i)
public static java.lang.String addQuotes(java.lang.String s)
public static <T> T randomElement(java.util.Collection<T> elms)
elms to prevent concurrent modification.