nrc.fuzzy
Class XValuesOutOfOrderException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--nrc.fuzzy.FuzzyException
                    |
                    +--nrc.fuzzy.FuzzySetException
                          |
                          +--nrc.fuzzy.XValuesOutOfOrderException
All Implemented Interfaces:
java.io.Serializable

public class XValuesOutOfOrderException
extends FuzzySetException
implements java.io.Serializable

The XValuesOutOfOrderException class is thrown to indicate that the x values in a FuzzySet that are not in strictly ascending order. This exception is thrown almost exclusively by the FuzzySet constructors, which in turn affects most methods that construct a new FuzzySet in the course of their execution.

In the construction of an XValuesOutOfOrderException, the offending x value, and the x value previous to it will be stored in the exception. The methods getXValue and getPreviousXValue will return these values. These values will also appear in the exception message, should the user call the getMessage method.

See Also:
FuzzySetException, Serialized Form

Constructor Summary
XValuesOutOfOrderException(double prevValue, double currentValue)
          Constructs a new XValuesOutOfOrderException without a specific detail message.
XValuesOutOfOrderException(double prevValue, double currentValue, java.lang.String message)
          Constructs a new XValuesOutOfOrderException with a specific detail message appended to the default detail message.
 
Method Summary
 java.lang.String getMessage()
          Returns the detail message to the user.
 double getPreviousXValue()
          Returns the x value previous to the x value which is out of order.
 double getXValue()
          Returns the offending x value.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XValuesOutOfOrderException

public XValuesOutOfOrderException(double prevValue,
                                  double currentValue)
Constructs a new XValuesOutOfOrderException without a specific detail message. The default detail message informs the user that the x values of a FuzzySet must be in strictly ascending order, and provides the user with the value of the offending x value and the x value previous to it.

Parameters:
prevValue - the x value previous to the x value which is out of order
currentValue - the x value which is out of order

XValuesOutOfOrderException

public XValuesOutOfOrderException(double prevValue,
                                  double currentValue,
                                  java.lang.String message)
Constructs a new XValuesOutOfOrderException with a specific detail message appended to the default detail message. The default detail message informs the user that the x values of a FuzzySet must be in strictly ascending order, and provides the user with the value of the offending x value and the x value previous to it.

Parameters:
prevValue - the x value previous to the x value which is out of order
currentValue - the x value which is out of order
message - the specific detail message
Method Detail

getXValue

public double getXValue()
Returns the offending x value. This x value has a value smaller than the x value previous to it, which indicates that the x values must be out of order.

Returns:
the out of order x value

getPreviousXValue

public double getPreviousXValue()
Returns the x value previous to the x value which is out of order. This value will be larger than that returned by the method getXValue.

Returns:
the x value previous to the one out of order

getMessage

public java.lang.String getMessage()
Returns the detail message to the user.

Overrides:
getMessage in class java.lang.Throwable
Returns:
the String detail message to inform the user of some of the particulars of the situation that caused the exception to be thrown