Top Description Fields Constructors Methods
org.apache.commons.math3.exception

public Class NonMonotonicSequenceException

extends MathIllegalNumberException
Class Inheritance
Imports
org.apache.commons.math3.util.MathArrays, org.apache.commons.math3.exception.util.LocalizedFormats

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)

Field Summary

Modifier and TypeField and Description
private final MathArrays.OrderDirection
direction

Direction (positive for increasing, negative for decreasing).

private final int
index

Index of the wrong value.

private final Number
previous

Previous value.

private static final long
private final boolean
strict

Whether the sequence must be strictly increasing or decreasing.

Inherited from org.apache.commons.math3.exception.MathIllegalNumberException:
INTEGER_ZERO

Constructor Summary

AccessConstructor and Description
public
NonMonotonicSequenceException(Number
Value that did not match the requirements.
wrong
,
Number
Previous value in the sequence.
previous
,
int
Index of the value that did not match the requirements.
index
)

Construct the exception.

public
NonMonotonicSequenceException(Number
Value that did not match the requirements.
wrong
,
Number
Previous value in the sequence.
previous
,
int
Index of the value that did not match the requirements.
index
,
MathArrays.OrderDirection
Strictly positive for a sequence required to be increasing, negative (or zero) for a decreasing sequence.
direction
,
boolean
Whether the sequence must be strictly increasing or decreasing.
strict
)

Construct the exception.

Method Summary

Modifier and TypeMethod and Description
public MathArrays.OrderDirection

Returns:

the order direction.
getDirection
()

public int

Returns:

the current index.
getIndex
()

Get the index of the wrong value.

public Number

Returns:

the previous value.
getPrevious
()

public boolean

Returns:

true is the sequence should be strictly monotonic.
getStrict
()

Inherited from org.apache.commons.math3.exception.MathIllegalNumberException:
getArgument

Field Detail

directionback to summary
private final MathArrays.OrderDirection direction

Direction (positive for increasing, negative for decreasing).

indexback to summary
private final int index

Index of the wrong value.

previousback to summary
private final Number previous

Previous value.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.commons.math3.exception.MathIllegalNumberException.serialVersionUID.

Serializable version Id.

strictback to summary
private final boolean strict

Whether the sequence must be strictly increasing or decreasing.

Constructor Detail

NonMonotonicSequenceExceptionback to summary
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:Number

Value that did not match the requirements.

previous:Number

Previous value in the sequence.

index:int

Index of the value that did not match the requirements.

NonMonotonicSequenceExceptionback to summary
public NonMonotonicSequenceException(Number wrong, Number previous, int index, MathArrays.OrderDirection direction, boolean strict)

Construct the exception.

Parameters
wrong:Number

Value that did not match the requirements.

previous:Number

Previous value in the sequence.

index:int

Index of the value that did not match the requirements.

direction:MathArrays.OrderDirection

Strictly positive for a sequence required to be increasing, negative (or zero) for a decreasing sequence.

strict:boolean

Whether the sequence must be strictly increasing or decreasing.

Method Detail

getDirectionback to summary
public MathArrays.OrderDirection getDirection()
Returns:MathArrays.OrderDirection

the order direction.

getIndexback to summary
public int getIndex()

Get the index of the wrong value.

Returns:int

the current index.

getPreviousback to summary
public Number getPrevious()
Returns:Number

the previous value.

getStrictback to summary
public boolean getStrict()
Returns:boolean

true is the sequence should be strictly monotonic.