edu.byu.ece.edif.core
Class NamedObjectCompare

java.lang.Object
  extended by edu.byu.ece.edif.core.NamedObjectCompare
All Implemented Interfaces:
java.util.Comparator

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

Compares NamedObject objects.

Version:
$Id:NamedObjectCompare.java 198 2008-04-16 21:14:21Z jamesfcarroll $
See Also:
NamedObject

Field Summary
static boolean CASE_SENSITIVE
          Variable specifying whether string compares should be case sensitive or not.
private static java.lang.String s1
          The two strings initialized, and then used for comparison by methods in this class.
private static java.lang.String s2
          The two strings initialized, and then used for comparison by methods in this class.
 
Constructor Summary
NamedObjectCompare()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two Objects by their String name.
static boolean equals(java.lang.Object o1, java.lang.Object o2)
          Compare two Objects by their String name.
private static void getStrings(java.lang.Object o1, java.lang.Object o2)
          Initialize the two strings used for comparison by the methods in this class.
static boolean startsWith(java.lang.Object o1, java.lang.Object o2)
          Compare string o2 with the beginning of o1.
 
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

CASE_SENSITIVE

public static boolean CASE_SENSITIVE
Variable specifying whether string compares should be case sensitive or not.


s1

private static java.lang.String s1
The two strings initialized, and then used for comparison by methods in this class.


s2

private static java.lang.String s2
The two strings initialized, and then used for comparison by methods in this class.

Constructor Detail

NamedObjectCompare

public NamedObjectCompare()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compare two Objects by their String name.

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - The first Object for comparison
o2 - The second Object for comparison
Returns:
An int value which specifies the result of the String comparison

equals

public static boolean equals(java.lang.Object o1,
                             java.lang.Object o2)
Compare two Objects by their String name.

Parameters:
o1 - The first Object for comparison
o2 - The second Object for comparison
Returns:
True if o1 equals o2

startsWith

public static boolean startsWith(java.lang.Object o1,
                                 java.lang.Object o2)
Compare string o2 with the beginning of o1.

Parameters:
o1 - The first Object for comparison
o2 - The second Object for comparison
Returns:
True if o1 starts with o2

getStrings

private static void getStrings(java.lang.Object o1,
                               java.lang.Object o2)
Initialize the two strings used for comparison by the methods in this class.

Parameters:
o1 - The first Object for comparison
o2 - The second Object for comparison