edu.princeton.toy
Class TExampleManager

java.lang.Object
  extended by edu.princeton.toy.TExampleManager
All Implemented Interfaces:
Runnable

public class TExampleManager
extends Object
implements Runnable

TExampleManager is a class that reads the example manifest and loads all of the examples into memory, parsing their titles as well.


Field Summary
static String EXAMPLE_MANIFEST_FILE
          The filename of the example manifest.
 
Method Summary
static int getExampleCount()
          Returns the number of examples which have been sucessfully loaded.
static String getExampleText(int index)
          Returns the program text of the requested example.
static String getExampleTitle(int index)
          Returns the title of the requested example.
static boolean isReady()
          Indicates wheter or not each example in the manifest either does not exist or has been loaded and processed.
 void run()
          Implement the Runnable interface to load the example files in a separate thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXAMPLE_MANIFEST_FILE

public static final String EXAMPLE_MANIFEST_FILE
The filename of the example manifest.

See Also:
Constant Field Values
Method Detail

isReady

public static boolean isReady()
Indicates wheter or not each example in the manifest either does not exist or has been loaded and processed.

Returns:
true iff all the example programs have either been accounted for.

getExampleCount

public static int getExampleCount()
Returns the number of examples which have been sucessfully loaded.

Returns:
The number of examples available.

getExampleTitle

public static String getExampleTitle(int index)
Returns the title of the requested example.

Parameters:
index - The index of the requested title. An ArrayIndexOutOfBounds exception will be thrown if the index is invalid.
Returns:
The title of the requested example.

getExampleText

public static String getExampleText(int index)
Returns the program text of the requested example.

Parameters:
index - The index of the requested title. An ArrayIndexOutOfBounds exception will be thrown if the index is invalid.
Returns:
The text of the requested example.

run

public void run()
Implement the Runnable interface to load the example files in a separate thread.

Specified by:
run in interface Runnable