uk.ac.ucl.che.esf.base
Class Warning

java.lang.Object
  extended by uk.ac.ucl.che.esf.base.Warning
All Implemented Interfaces:
java.io.Serializable

public class Warning
extends java.lang.Object
implements java.io.Serializable

During a synthesis (or in fact simulation or optimization) run, certain events will occur that cannot be handled intelligently by the search procedure. in these cases, the object responsible for noting the event will typically throw an exception which will be caught upwards in the hierarchy. However, the action performed due to the exception may often be to simply ignore the situation (for instance, a DesignError exception in a unit model due to a situation which the model was not intended to handle). This class is used to keep a record of warnings, generated in response to these events.

The intention is that a list of warnings will be displayed at the end of a run, allowing the user to decide whether the results generated are actually reasonable or suitable.

See Also:
Serialized Form

Constructor Summary
Warning(java.lang.String msg)
          The constructor simply expects a message which will be output to the user at the end of a run.
 
Method Summary
 java.lang.String getMessage()
          Retrieve the message associated with the warning.
 void invoke()
          Indicate that a warning has been generated.
static void print(java.io.PrintWriter pw)
          Output the list of warning messages, including a count of the number of times each warning was invoked.
static void reset()
          Reset the hash set to start with no previously generated warnings.
 java.lang.String toString()
          Output a terse description of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Warning

public Warning(java.lang.String msg)
The constructor simply expects a message which will be output to the user at the end of a run.

Parameters:
msg - The actual warning message.
Method Detail

getMessage

public final java.lang.String getMessage()
Retrieve the message associated with the warning.


invoke

public void invoke()
Indicate that a warning has been generated. This adds the current object to the set of warnings generated to date.


print

public static void print(java.io.PrintWriter pw)
Output the list of warning messages, including a count of the number of times each warning was invoked.


reset

public static final void reset()
Reset the hash set to start with no previously generated warnings. However, in order to ensure that the numbers of warnings recorded is correct, reset each of the warnings that were encountered in the previous invocation.


toString

public java.lang.String toString()
Output a terse description of this object.

Overrides:
toString in class java.lang.Object