com.inxar.syntacs.translator
Class StandardAuditor

java.lang.Object
  |
  +--com.inxar.syntacs.translator.StandardAuditor
All Implemented Interfaces:
Auditor, Serializable

public class StandardAuditor
extends Object
implements Auditor, Serializable

Standard implementation of Auditor.

See Also:
Serialized Form

Inner Class Summary
 class StandardAuditor.StandardComplaint
           
 
Constructor Summary
StandardAuditor()
           
 
Method Summary
 int complaints()
          Returns the current number of complaints (errors() + warnings()).
 int errors()
          Returns the current number of errors.
 List getErrors()
          Returns an unmodifiable list of errors, where each member in the List is an Complaint.
 Properties getProperties()
          Gets the Properties instance.
 String getSource()
          Gets the name of the input source.
 List getWarnings()
          Returns an unmodifiable list of warnings, where each member in the List is an Complaint.
 boolean hasErrors()
          Returns true if there is at least one error, false otherwise.
 boolean hasWarnings()
          Returns true if there is at least one warning, false otherwise.
 boolean isEmpty()
          Returns true if there are no errors or warnings, false if there is at least one error or at least one warning.
 Complaint notify(Complaint d)
          Adds the given Complaint to the end of the the internal List of complaints and returns the same object to the caller.
 Complaint notify(int type, int line, String msg)
          Creates a new Complaint of the given type having the given message and given line number.
 Complaint notify(int type, String msg)
          Creates a new Complaint of the given type having the given message.
 Complaint notify(int type, String msg, Input in, int off, int len)
          Creates a new Complaint of the given type having the given message at the given Input offset with the given length.
 void setProperties(Properties p)
          Sets the Properties instance.
 void setSource(String src)
          Sets the name of the input source.
 String toString()
           
 int warnings()
          Returns the current number of warnings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardAuditor

public StandardAuditor()
Method Detail

setSource

public void setSource(String src)
Description copied from interface: Auditor
Sets the name of the input source. This is useful in order to make more meaningful error messages.
Specified by:
setSource in interface Auditor

getSource

public String getSource()
Description copied from interface: Auditor
Gets the name of the input source.
Specified by:
getSource in interface Auditor

setProperties

public void setProperties(Properties p)
Description copied from interface: Auditor
Sets the Properties instance.
Specified by:
setProperties in interface Auditor

getProperties

public Properties getProperties()
Description copied from interface: Auditor
Gets the Properties instance.
Specified by:
getProperties in interface Auditor

isEmpty

public boolean isEmpty()
Description copied from interface: Auditor
Returns true if there are no errors or warnings, false if there is at least one error or at least one warning.
Specified by:
isEmpty in interface Auditor

complaints

public int complaints()
Description copied from interface: Auditor
Returns the current number of complaints (errors() + warnings()).
Specified by:
complaints in interface Auditor

errors

public int errors()
Description copied from interface: Auditor
Returns the current number of errors.
Specified by:
errors in interface Auditor

warnings

public int warnings()
Description copied from interface: Auditor
Returns the current number of warnings.
Specified by:
warnings in interface Auditor

hasErrors

public boolean hasErrors()
Description copied from interface: Auditor
Returns true if there is at least one error, false otherwise.
Specified by:
hasErrors in interface Auditor

hasWarnings

public boolean hasWarnings()
Description copied from interface: Auditor
Returns true if there is at least one warning, false otherwise.
Specified by:
hasWarnings in interface Auditor

getErrors

public List getErrors()
Description copied from interface: Auditor
Returns an unmodifiable list of errors, where each member in the List is an Complaint.
Specified by:
getErrors in interface Auditor

getWarnings

public List getWarnings()
Description copied from interface: Auditor
Returns an unmodifiable list of warnings, where each member in the List is an Complaint.
Specified by:
getWarnings in interface Auditor

notify

public Complaint notify(int type,
                        int line,
                        String msg)
Description copied from interface: Auditor
Creates a new Complaint of the given type having the given message and given line number. The Complaint is appended to the internal List of complaints and also returned to the caller.
Specified by:
notify in interface Auditor

notify

public Complaint notify(int type,
                        String msg)
Description copied from interface: Auditor
Creates a new Complaint of the given type having the given message. The Complaint is appended to the internal List of complaints and also returned to the caller.
Specified by:
notify in interface Auditor

notify

public Complaint notify(int type,
                        String msg,
                        Input in,
                        int off,
                        int len)
Description copied from interface: Auditor
Creates a new Complaint of the given type having the given message at the given Input offset with the given length. The Complaint is appended to the internal List of complaints and also returned to the caller. This method is generally used for syntactic errors.
Specified by:
notify in interface Auditor

notify

public Complaint notify(Complaint d)
Description copied from interface: Auditor
Adds the given Complaint to the end of the the internal List of complaints and returns the same object to the caller.
Specified by:
notify in interface Auditor

toString

public String toString()
Overrides:
toString in class Object