Lvg Java
2006p Version

gov.nih.nlm.nls.lvg.Lib
Class LexItemComparator

java.lang.Object
  extended by gov.nih.nlm.nls.lvg.Lib.LexItemComparator
All Implemented Interfaces:
java.util.Comparator

public class LexItemComparator
extends java.lang.Object
implements java.util.Comparator

This class performs a comparator for LexItems. This class is used with CombinedRecord for output filter

History:

Version:
V-2006p
Author:
NLM NLS Development Team

Field Summary
static int ALPHABETIC
           
static int LVG_RULE
           
static int NONE
          an enumerated type for setting the comparing rule by LVG principle
static int TERM
           
static int TERM_CAT
           
static int TERM_CAT_INFL
           
 
Constructor Summary
LexItemComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          To compare two object o1 and o2.
static int GetCategoryPriority(long category)
          Get the priority of ordering for a category.
 void SetCase(boolean caseFlag)
          Set the .g for case sensitivity
 void SetRule(int rule)
          Set the comparing rule for this comparator.
 
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
 

Field Detail

NONE

public static final int NONE
an enumerated type for setting the comparing rule by LVG principle

See Also:
Constant Field Values

TERM

public static final int TERM
See Also:
Constant Field Values

TERM_CAT

public static final int TERM_CAT
See Also:
Constant Field Values

TERM_CAT_INFL

public static final int TERM_CAT_INFL
See Also:
Constant Field Values

LVG_RULE

public static final int LVG_RULE
See Also:
Constant Field Values

ALPHABETIC

public static final int ALPHABETIC
See Also:
Constant Field Values
Constructor Detail

LexItemComparator

public LexItemComparator()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
To compare two object o1 and o2. Both objects o1 and o2 are LexItems.

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - first object to be compared
o2 - second object to be compared
Returns:
a negative integer, 0, or positive integer to represent the object o1 is less, equals, or greater than object 02.

SetRule

public void SetRule(int rule)
Set the comparing rule for this comparator.

Parameters:
rule - an enumurated value. Such as Lvg.LexItemComparator.LVG_RULE means to use lvg principle to compare object. Otherwise, use compartor for combining records.

SetCase

public void SetCase(boolean caseFlag)
Set the .g for case sensitivity

Parameters:
caseFlag - flag for case sensitivity

GetCategoryPriority

public static int GetCategoryPriority(long category)
Get the priority of ordering for a category.

Parameters:
category - a long integer value of a category
Returns:
the priority of the given category. The priority is from 1 to 12. The lower value of priority, such as 1, means it shows up and is used more often.

Lvg Java
2006p Version

Submit a bug or feature

Copyright © 2006p National Library of Medicine