/**
* Base class for all non-trivial classes.
* Used as a centralised repository for all the functionalities which
* all classes written by me, which will be of use.
*
* @author H W Yau
* @version $Revision: 1.7 $ $Date: 1999/02/16 18:53:43 $
*/
public class Universal<region P> {
//------------------------------------------------------------------------
// Class variables.
//------------------------------------------------------------------------
/**
* Class variable, for whether to print debug messages. This one is
* unique to this class, and can hence be set in the one place.
*/
private static boolean UNIVERSAL_DEBUG in P;
//------------------------------------------------------------------------
// Instance variables.
//------------------------------------------------------------------------
/**
* Variable, for whether to print debug messages. This one can
* be set by subsequent child classes.
*/
private boolean DEBUG in P;
/**
* The prompt to write before any debug messages.
*/
private String prompt in P;
//------------------------------------------------------------------------
// Constructors.
//------------------------------------------------------------------------
/**
* Default constructor.
*/
public Universal() writes P {
//super();
this.DEBUG=true;
this.UNIVERSAL_DEBUG=true;
this.prompt="Universal> ";
}
//------------------------------------------------------------------------
// Methods.
//------------------------------------------------------------------------
//------------------------------------------------------------------------
// Accessor methods for class AppDemo/Universal.
// Generated by 'makeJavaAccessor.pl' script. HWY. 20th January 1999.
//------------------------------------------------------------------------
/**
* Accessor method for private instance variable <code>DEBUG</code>.
*
* @return Value of instance variable <code>DEBUG</code>.
*/
public boolean get_DEBUG() reads P {
return(this.DEBUG);
}
/**
* Set method for private instance variable <code>DEBUG</code>.
*
* @param DEBUG the value to set for the instance variable <code>DEBUG</code>.
*/
public void set_DEBUG(boolean DEBUG) writes P {
this.DEBUG = DEBUG;
}
/**
* Accessor method for private instance variable <code>UNIVERSAL_DEBUG</code>.
*
* @return Value of instance variable <code>UNIVERSAL_DEBUG</code>.
*/
public boolean get_UNIVERSAL_DEBUG() reads P {
return(this.UNIVERSAL_DEBUG);
}
/**
* Set method for private instance variable <code>DEBUG</code>.
*
* @param UNIVERSAL_DEBUG the value to set for the instance
* variable <code>UNIVERSAL_DEBUG</code>.
*/
public void set_UNIVERSAL_DEBUG(boolean UNIVERSAL_DEBUG) writes P {
this.UNIVERSAL_DEBUG = UNIVERSAL_DEBUG;
}
/**
* Accessor method for private instance variable <code>prompt</code>.
*
* @return Value of instance variable <code>prompt</code>.
*/
public String get_prompt() reads P {
return(this.prompt);
}
/**
* Set method for private instance variable <code>prompt</code>.
*
* @param prompt the value to set for the instance variable <code>prompt</code>.
*/
public void set_prompt(String prompt) writes P {
this.prompt = prompt;
}
//------------------------------------------------------------------------
/**
* Used to print debug messages.
*
* @param s The debug message to print out, to PrintStream "out".
*/
public void dbgPrintln(String s) reads P {
if( DEBUG || UNIVERSAL_DEBUG ) {
System.out.println("DBG "+prompt+s);
}
}
/**
* Used to print debug messages.
*
* @param s The debug message to print out, to PrintStream "out".
*/
public void dbgPrint(String s) reads P {
if( DEBUG || UNIVERSAL_DEBUG ) {
System.out.print("DBG "+prompt+s);
}
}
/**
* Used to print error messages.
*
* @param s The error message to print out, to PrintStream "err".
*/
public void errPrintln(String s) reads P {
System.err.println(prompt+s);
}
/**
* Used to print error messages.
*
* @param s The error message to print out, to PrintStream "err".
*/
public void errPrint(String s) reads P {
System.err.print(prompt+s);
}
}