All Packages Class Hierarchy This Package Previous Next Index
This code is (c) 1996 Leemon Baird
<leemon@cs.cmu.edu>,
http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely.
If the code is modified, please state so in the comments.
public static final String symbol
public abstract String BNF(int lang)
public abstract Object parse(Parser p, int lang) throws ParserException
public abstract void unparse(Unparser u, int lang)
public abstract Object[][] getParameters(int lang)
The array is of type Object[][], and should be of the form: {{String}, //a short comment, period, then longer comment for BNF documentation for this Class {String, var, String, //the name of a parameter in the BNF, and the Pointer to hold the parsed value String, var, String, //another parameter String, var, String}, //another parameter, etc. (zero or more pairs in all) {var, //a Pointer holding a value to parse and unparse only during "save-all" experiment saves var, //another such parameter var}} //another such parameter (zero or more in all)In the above description, a Pointer such as a PInt means that an integer expression will be parsed and placed into the existing PInt. The PInt itself should already exist before returning this array. At any point in the array where a Pointer is legal, it is also legal to put a single-element Parsable[] array. So, if Foo implements Parsable, then it is legal to put a variable there that contains a Foo[1] array. So, for example:
IntExp numCopies=new IntExp(0); PictureDrawer[] pic={null}; Object[][] parameters= {{"Draw N copies of a picture. The PictureDrawer must be given."}, {"N",numCopies,"", "picture",pic,""}, {}};This works if IntExp is a Pointer and PictureDrawer is a Parsable. After parsing, the number of copies will be an integer stored in numCopies.val and the PictureDrawer will be stored in pic[0]. The kind of parsing that is done depends on how the variable is defined. Assuming that MyClass extends Pointer, and MyType implements Parsable, the four types of parameters can be declared this way: MyClass a=new MyPointer(); //will parse the parameters for class MyClass MyType[] b={null}; //will parse the name of a class of type MyType, then its parameters Parsable[][] c={new MyType[0]}; //will parse a list of objects of type MyParsable, parsing the class name and parameters for each one Parsable[][] d={new MyClass[0],null}; //will parse a list of objects of class MyClass, parsing the parameters for each one MyClass e=new MyPointer(); //a variable that is saved but not parsed MyClass f=new MyPointer(); //a variable that is saved but not parsed Object[][] parameters= {{"A short description. The longer description of this class comes after the period"}, {"par1", a, "comment on this parameter", "par2", b, "another comment", "par3", c, "comment", "par4", d, "comment"}, {e,f}} //list of all the variables to save, with no strings
public abstract void initialize(int level)
0 new object: initialize everything, allocate new arrays (this is only called once) 1 new experiment: initialize everything, don't reallocate arrays, set the random number seed to some standard value 2 new run initialize weights, but don't reset the seed, don't forget results of previous runs 3 new trial initialize state, but don't reset the seed or weights or previous results
All Packages Class Hierarchy This Package Previous Next Index