Documentation API of the 'cern.colt.list.MinMaxNumberList' Java class

Class MinMaxNumberList

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class MinMaxNumberListextends AbstractLongList
    Resizable compressed list holding numbers; based on the fact that a value in a given interval need not take more than log(max-min+1) bits; implemented with a cern.colt.bitvector.BitVector. First see the package summary and javadoc tree view to get the broad picture.

    Numbers can be compressed when minimum and maximum of all values ever to be stored in the list are known. For example, if min=16, max=27, only 4 bits are needed to store a value. No compression is achieved for float and double values.

    You can add, get and set elements quite similar to java.util.ArrayList.

    Applicability: Applicable if the data is non floating point, highly skewed without "outliers" and minimum and maximum known in advance.

    Performance: Basic operations like add(), get(), set(), size() and clear() are O(1), i.e. run in constant time.

    200Mhz Pentium Pro, JDK 1.2, NT:
    10^6 calls to getQuick() --> 0.5 seconds. (50 times slower than reading from a primitive array of the appropriate type.)
    10^6 calls to setQuick() --> 0.8 seconds. (15 times slower than writing to a primitive array of the appropriate type.)

    This class can, for example, be useful when making large lists of numbers persistent. Also useful when very large lists would otherwise consume too much main memory.

    Upon instantiation a contract is signed that defines the interval values may fall into. It is not legal to store values not contained in that interval. WARNING: The contract is not checked. Be sure you do not store illegal values. If you need to store float or double values, you must set the minimum and maximum to [Integer.MIN_VALUE,Integer.MAX_VALUE] or [Long.MIN_VALUE,Long.MAX_VALUE], respectively.

    Although access methods are only defined on long values you can also store all other primitive data types: boolean, byte, short, int, long, float, double and char. You can do this by explicitly representing them as long values. Use casts for discrete data types. Use the methods of java.lang.Float and java.lang.Double for floating point data types: Recall that with those methods you can convert any floating point value to a long value and back without losing any precision:

    Example usage:

     MinMaxNumberList list = ... instantiation goes here double d1 = 1.234; list.add(Double.doubleToLongBits(d1)); double d2 = Double.longBitsToDouble(list.get(0)); if (d1!=d2) System.out.println("This is impossible!"); MinMaxNumberList list2 = ... instantiation goes here float f1 = 1.234f; list2.add((long) Float.floatToIntBits(f1)); float f2 = Float.intBitsToFloat((int)list2.get(0)); if (f1!=f2) System.out.println("This is impossible!"); 
    See Also:
    LongArrayList, DistinctNumberList, Float, Double, Serialized Form

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.