com.sas.storage.olap
Class MemberLevelComparator

com.sas.storage.olap.MemberLevelComparator
All Implemented Interfaces:
java.util.Comparator

public class MemberLevelComparator
implements java.util.Comparator

MemberLevelComparator is used to compare two com.sas.storage.olap.MemberInterface objects by the depth of the level the members belong to. This is useful to sort an array of MemberInterface objects, such as that returned from the getMembers method of the com.sas.storage.olap.MetadataInterface, as this method is not guaranteed to return the members in any order.

Since:
3.1

Field Summary
static MemberLevelComparator defaultInstance
          If you wish to use a default MemberLevelComparator, you can use defaultInstance to avoid creating a new instance.
 
Constructor Summary
MemberLevelComparator()
           
 
Method Summary
 int compare(java.lang.Object member1, java.lang.Object member2)
          Compares two com.sas.storage.olap.MemberInterface objects by their level depth value.
 boolean equals(java.lang.Object obj)
           
 

Field Detail

defaultInstance

public static final MemberLevelComparator defaultInstance
If you wish to use a default MemberLevelComparator, you can use defaultInstance to avoid creating a new instance.

Constructor Detail

MemberLevelComparator

public MemberLevelComparator()
Method Detail

compare

public int compare(java.lang.Object member1,
                   java.lang.Object member2)
Compares two com.sas.storage.olap.MemberInterface objects by their level depth value.

Returns a negative integer, indicating member1 is less than member2, if member1 is null or if the depth of the level member1 belongs to is less than that of member2's level depth. Returns 0 if member1 is equal to member2, or if their level depths are the same. Returns a positive integer, indicating member1 is greater than member2, if member2 is null or if member2's level depth less than that of member1's level depth.

Specified by:
compare in interface java.util.Comparator
Parameters:
member1 - the first object to be compared
member2 - the second object to be compared
Throws:
java.lang.ClassCastException - if the arguments are not null and are not instances of com.sas.storage.olap.MemberInterface

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object



Copyright © 2009 SAS Institute Inc. All Rights Reserved.