TC Java
2009 Version

gov.nih.nlm.nls.tc.MedLine
Class CitationComparator<T extends java.util.Vector<KeyValueObj<java.lang.String,java.util.Vector<java.lang.String>>>>

java.lang.Object
  extended by gov.nih.nlm.nls.tc.MedLine.CitationComparator<T>
All Implemented Interfaces:
java.util.Comparator<T>

public class CitationComparator<T extends java.util.Vector<KeyValueObj<java.lang.String,java.util.Vector<java.lang.String>>>>
extends java.lang.Object
implements java.util.Comparator<T>

This class provides methods to compare citation by specified field.

History:

Version:
V-2009
Author:
NLM Lexical Systems Group

Constructor Summary
CitationComparator()
           
 
Method Summary
 int compare(T o1, T o2)
          This method compare two citation objects by the specified compare flag.
 void SetCompareField(java.lang.String fieldFlag)
          Set the comparing flag
 void SetCompareLengthFlag(boolean compareLengthFlag)
          Set the flag of copareing length
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

CitationComparator

public CitationComparator()
Method Detail

compare

public int compare(T o1,
                   T o2)
This method compare two citation objects by the specified compare flag. A citaiton object is a Vector with tags (keys) and values (Vector of String for all lines).

Specified by:
compare in interface java.util.Comparator<T extends java.util.Vector<KeyValueObj<java.lang.String,java.util.Vector<java.lang.String>>>>
Parameters:
o1 - the first citation object to be compared
o2 - the second citation object to be compared
Returns:
a negative interger, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

SetCompareField

public void SetCompareField(java.lang.String fieldFlag)
Set the comparing flag

Parameters:
fieldFlag - comparing field flag: any MEDLINE citation tag.

SetCompareLengthFlag

public void SetCompareLengthFlag(boolean compareLengthFlag)
Set the flag of copareing length

Parameters:
compareLengthFlag - boolean flag for coparing length. True to compare length first, then the alphabetic order,

TC Java
2009 Version

Submit a bug or feature

Copyright © 2009 National Library of Medicine