lp.trans
Class GrounderMessage

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by lp.trans.GrounderMessage
All Implemented Interfaces:
Serializable

public class GrounderMessage
extends RuntimeException

An error or warning message that is issued by lparse. It can be related to a specific rule.

Version:
1.0.0
Author:
Martin Slota
See Also:
Serialized Form

Field Summary
private  LpRule sourceRule
          The rule that is the reason of this message.
private  boolean warning
          Is true if this is a warning message and false if it is an error message.
 
Constructor Summary
GrounderMessage(String message, LpRule sourceRule, boolean isWarning)
          Creates a new instance of GrounderMessage with the specified message that relates to the given rule.
GrounderMessage(String message, LpRule sourceRule, boolean isWarning, Throwable cause)
          Creates a new instance of GrounderMessage with the specified message that relates to the given rule.
 
Method Summary
 boolean equals(Object obj)
          Returns true if obj is a GrounderMessage with the same members as this one.
 LpRule getSourceRule()
          Returns the rule that is the reason of this message.
 int hashCode()
          Overriden in order to maintain the general contract of Object.hashCode().
 boolean isWarning()
          Returns true if this is a warning message and false if it is an error message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sourceRule

private final LpRule sourceRule
The rule that is the reason of this message. Can be null if no such rule is specified by lparse.


warning

private final boolean warning
Is true if this is a warning message and false if it is an error message.

Constructor Detail

GrounderMessage

public GrounderMessage(String message,
                       LpRule sourceRule,
                       boolean isWarning)
Creates a new instance of GrounderMessage with the specified message that relates to the given rule.

Parameters:
message - the error or warning message
sourceRule - the rule that is the reason of this error or warning
isWarning - true if a warning message should be created, false if an error message should be created

GrounderMessage

public GrounderMessage(String message,
                       LpRule sourceRule,
                       boolean isWarning,
                       Throwable cause)
Creates a new instance of GrounderMessage with the specified message that relates to the given rule.

Parameters:
message - the error or warning message
sourceRule - the rule that is the reason of this error or warning
isWarning - true if a warning message should be created, false if an error message should be created
cause - the cause of this exception
Method Detail

getSourceRule

public LpRule getSourceRule()
Returns the rule that is the reason of this message. Can be null if no such rule is specified by lparse.

Returns:
as specified above

isWarning

public boolean isWarning()
Returns true if this is a warning message and false if it is an error message.


equals

public boolean equals(Object obj)
Returns true if obj is a GrounderMessage with the same members as this one.

Overrides:
equals in class Object
Parameters:
obj - the object to compare with
Returns:
as specified above

hashCode

public int hashCode()
Overriden in order to maintain the general contract of Object.hashCode().

Overrides:
hashCode in class Object
Returns:
the hash of this object