org.apache.commons.math3.exception
Class NonMonotonicSequenceException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.IllegalArgumentException
                  extended by org.apache.commons.math3.exception.MathIllegalArgumentException
                      extended by org.apache.commons.math3.exception.MathIllegalNumberException
                          extended by org.apache.commons.math3.exception.NonMonotonicSequenceException
All Implemented Interfaces:
Serializable, ExceptionContextProvider

public class NonMonotonicSequenceException
extends MathIllegalNumberException

Exception to be thrown when the a sequence of values is not monotonically increasing or decreasing.

Since:
2.2 (name changed to "NonMonotonicSequenceException" in 3.0)
Version:
$Id: NonMonotonicSequenceException.java 1364378 2012-07-22 17:42:38Z tn $
See Also:
Serialized Form

Constructor Summary
NonMonotonicSequenceException(Number wrong, Number previous, int index)
          Construct the exception.
NonMonotonicSequenceException(Number wrong, Number previous, int index, MathArrays.OrderDirection direction, boolean strict)
          Construct the exception.
 
Method Summary
 MathArrays.OrderDirection getDirection()
           
 int getIndex()
          Get the index of the wrong value.
 Number getPrevious()
           
 boolean getStrict()
           
 
Methods inherited from class org.apache.commons.math3.exception.MathIllegalNumberException
getArgument
 
Methods inherited from class org.apache.commons.math3.exception.MathIllegalArgumentException
getContext, getLocalizedMessage, getMessage
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, 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

NonMonotonicSequenceException

public NonMonotonicSequenceException(Number wrong,
                                     Number previous,
                                     int index)
Construct the exception. This constructor uses default values assuming that the sequence should have been strictly increasing.

Parameters:
wrong - Value that did not match the requirements.
previous - Previous value in the sequence.
index - Index of the value that did not match the requirements.

NonMonotonicSequenceException

public NonMonotonicSequenceException(Number wrong,
                                     Number previous,
                                     int index,
                                     MathArrays.OrderDirection direction,
                                     boolean strict)
Construct the exception.

Parameters:
wrong - Value that did not match the requirements.
previous - Previous value in the sequence.
index - Index of the value that did not match the requirements.
direction - Strictly positive for a sequence required to be increasing, negative (or zero) for a decreasing sequence.
strict - Whether the sequence must be strictly increasing or decreasing.
Method Detail

getDirection

public MathArrays.OrderDirection getDirection()
Returns:
the order direction.

getStrict

public boolean getStrict()
Returns:
true is the sequence should be strictly monotonic.

getIndex

public int getIndex()
Get the index of the wrong value.

Returns:
the current index.

getPrevious

public Number getPrevious()
Returns:
the previous value.


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.