## org.apache.commons.math.exception
Class NonMonotonousSequenceException

    java.lang.Object
      java.lang.Throwable
          java.lang.Exception
              java.lang.RuntimeException
                  java.lang.IllegalArgumentException
                      org.apache.commons.math.exception.MathIllegalArgumentException
                          org.apache.commons.math.exception.MathIllegalNumberException
                              org.apache.commons.math.exception.NonMonotonousSequenceException

All Implemented Interfaces:
  Serializable, MathThrowable

    public class NonMonotonousSequenceException

extends MathIllegalNumberException

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

Since:
  2.2
Version:
  $Revision$ $Date$
See Also:
  Serialized Form

Field Summary
`private MathUtils.OrderDirection` `direction` Direction (positive for increasing, negative for decreasing).
`private int` `index` Index of the wrong value.
`private Number` `previous` Previous value.
`private static long` `serialVersionUID` Serializable version Id.
`private boolean` `strict` Whether the sequence must be strictly increasing or decreasing.

Constructor Summary
`NonMonotonousSequenceException(Number wrong, Number previous, int index)` Construct the exception.
`NonMonotonousSequenceException(Number wrong, Number previous, int index, MathUtils.OrderDirection direction, boolean strict)` Construct the exception.

Method Summary
`MathUtils.OrderDirection` `getDirection()`
`int` `getIndex()` Get the index of the wrong value.
`Number` `getPrevious()`
`boolean` `getStrict()`

Methods inherited from class org.apache.commons.math.exception.MathIllegalNumberException
`getArgument`

Methods inherited from class org.apache.commons.math.exception.MathIllegalArgumentException
`getArguments, getGeneralPattern, getLocalizedMessage, getMessage, getMessage, getSpecificPattern`

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`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

  Serializable version Id.

  See Also:
    Constant Field Values

### direction

    private final MathUtils.OrderDirection direction

  Direction (positive for increasing, negative for decreasing).

### strict

    private final boolean strict

  Whether the sequence must be strictly increasing or decreasing.

### index

    private final int index

  Index of the wrong value.

### previous

    private final Number previous

  Previous value.

Constructor Detail

### NonMonotonousSequenceException

    public NonMonotonousSequenceException(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.

### NonMonotonousSequenceException

    public NonMonotonousSequenceException(Number wrong,
                                          Number previous,
                                          int index,
                                          MathUtils.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 MathUtils.OrderDirection getDirection()

  Returns:
    the order direction.

### getStrict

    public boolean getStrict()

  Returns:
    `true` is the sequence should be strictly monotonous.

### getIndex

    public int getIndex()

  Get the index of the wrong value.

  Returns:
    the current index.

### getPrevious

    public Number getPrevious()

  Returns:
    the previous value.

Copyright (c) 2003-2013 Apache Software Foundation