SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.matrixtype.sparse
Enum SparseElement.TopLeftFirstComparator

java.lang.Object
  extended by java.lang.Enum<SparseElement.TopLeftFirstComparator>
      extended by com.numericalmethod.suanshu.matrix.doubles.matrixtype.sparse.SparseElement.TopLeftFirstComparator
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<SparseElement.TopLeftFirstComparator>, java.util.Comparator<SparseElement>
Enclosing class:
SparseElement

public static enum SparseElement.TopLeftFirstComparator
extends java.lang.Enum<SparseElement.TopLeftFirstComparator>
implements java.util.Comparator<SparseElement>

This Comparator can be used when a list of matrix elements are to be sorted according to their coordinates. The sorted order provided by this Comparator is from top to bottom (compare row-index first), from left to right (then compare column-index for the elements in the same row).


Enum Constant Summary
INSTANCE
           
 
Method Summary
 int compare(SparseElement o1, SparseElement o2)
           
static SparseElement.TopLeftFirstComparator valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static SparseElement.TopLeftFirstComparator[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Enum Constant Detail

INSTANCE

public static final SparseElement.TopLeftFirstComparator INSTANCE
Method Detail

values

public static SparseElement.TopLeftFirstComparator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SparseElement.TopLeftFirstComparator c : SparseElement.TopLeftFirstComparator.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SparseElement.TopLeftFirstComparator valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

compare

public int compare(SparseElement o1,
                   SparseElement o2)
Specified by:
compare in interface java.util.Comparator<SparseElement>

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.