AlgART Home

net.algart.arrays
Class Arrays.MinMaxInfo

java.lang.Object
  extended by net.algart.arrays.Arrays.MinMaxInfo
Enclosing class:
Arrays

public static final class Arrays.MinMaxInfo
extends java.lang.Object

The helper class for Arrays.rangeOf(PArray, MinMaxInfo) method, containing information about the minimum and maximum in some AlgART array.

The instance of this class contains the following information:

The only way to create an instance of this class is the constructor without arguments, that creates an uninitialized instance. The only way to change the information stored in this instance is calling Arrays.rangeOf(PArray, MinMaxInfo) method, that fills the instance by the actual information and changes its state to initialized.

This class is thread-safe: you may use the same instance of this class in several threads. The state of the instance is always consistent: all information, stored in it, including initialized flag, is always changed simultaneously in a synchronized block.


Constructor Summary
Constructor and Description
Arrays.MinMaxInfo()
          Creates new uninitialized instance of this class.
 
Method Summary
Modifier and Type Method and Description
 boolean equals(java.lang.Object obj)
          Indicates whether some other instance of this class is equal to this instance.
 int hashCode()
          Returns the hash code of this range.
 long indexOfMax()
          Returns the index of the maximal array element stored in this object.
 long indexOfMin()
          Returns the index of the minimal array element stored in this object.
 boolean isInitialized()
          Returns true if and only this object is initialized, that is if it was passed to Arrays.rangeOf(PArray, MinMaxInfo) method at least once and this method was successfully finished.
 double max()
          Returns the value of the maximal array element stored in this object.
 double min()
          Returns the value of the minimal array element stored in this object.
 Range range()
          Returns the values of both minimal and maximal array element stored in this object.
 java.lang.String toString()
          Returns a brief string description of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Arrays.MinMaxInfo

public Arrays.MinMaxInfo()
Creates new uninitialized instance of this class. You must call Arrays.rangeOf(PArray, MinMaxInfo) method for this instance before you will be able to use it.

Method Detail

isInitialized

public boolean isInitialized()
Returns true if and only this object is initialized, that is if it was passed to Arrays.rangeOf(PArray, MinMaxInfo) method at least once and this method was successfully finished. If the object is not initialized, then all its methods, excepting this one and methods of the basic Object class (toString, equals, etc.) throw IllegalStateException.

Returns:
whether this object is initialized.

indexOfMin

public long indexOfMin()
Returns the index of the minimal array element stored in this object.

Returns:
the index of the minimal array element stored in this object.
Throws:
java.lang.IllegalStateException - if this instance is not initialized yet.

indexOfMax

public long indexOfMax()
Returns the index of the maximal array element stored in this object.

Returns:
the index of the maximal array element stored in this object.
Throws:
java.lang.IllegalStateException - if this instance is not initialized yet.

min

public double min()
Returns the value of the minimal array element stored in this object.

Returns:
the value of the minimal array element stored in this object.
Throws:
java.lang.IllegalStateException - if this instance is not initialized yet.

max

public double max()
Returns the value of the maximal array element stored in this object.

Returns:
the value of the maximal array element stored in this object.
Throws:
java.lang.IllegalStateException - if this instance is not initialized yet.

range

public Range range()
Returns the values of both minimal and maximal array element stored in this object.

Returns:
the values of both minimal and maximal array element stored in this object.
Throws:
java.lang.IllegalStateException - if this instance is not initialized yet.

toString

public java.lang.String toString()
Returns a brief string description of this object.

The result of this method may depend on implementation and usually contains the indexes and values of the found minimum and maximum.

Overrides:
toString in class java.lang.Object
Returns:
a brief string description of this object.

hashCode

public int hashCode()
Returns the hash code of this range.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this range.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other instance of this class is equal to this instance. Returns true if and only if obj instanceof MinMaxInfo and the information, stored in both instances, is fully identical.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to be compared for equality with this instance.
Returns:
true if the specified object is equal to this one.