Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Match Class Reference

List of all members.

Detailed Description

Utility Class to compare 2 parameters.

Author:
S Butterworth
Version:
Date
2005-10-24 10:16:06 +0100 (Mon, 24 Oct 2005)
Revision
959

Definition at line 9 of file Match.java.


Public Member Functions

 Match (String name, Object val1, Object val2)
String getName ()
String getValue1 ()
String getValue2 ()

Static Public Member Functions

boolean compareDouble (Double val1, Double val2)
< T > boolean compare (T val1, T val2)

Static Public Attributes

String GEN = "Generator"
String VER = "Version"
String PHPDF = "Photon PDF"
String PRPDF = "Proton PDF"

Private Attributes

String name = ""
Object value1 = null
Object value2 = null

Constructor & Destructor Documentation

Match String  name,
Object  val1,
Object  val2
 

Definition at line 20 of file Match.java.

00020                                                        {
00021     this.name=name;
00022     this.value1=val1;
00023     this.value2=val2;
00024     }


Member Function Documentation

<T> boolean compare val1,
val2
[static]
 

Compare two object. The reason we use this instead of the compareTo method is compareTo seems to require doubles to be identical to a precision beyond that in the DB. should probably have used floats!

Definition at line 58 of file Match.java.

00058                                                      {
00059        
00060     if(val1 instanceof Integer){
00061         return ((Integer)val1).equals((Integer)val2);
00062     }
00063 
00064     if(val1 instanceof Double){
00065         return compareDouble((Double)val1, (Double)val2);
00066     }
00067 
00068     return false;
00069     }

boolean compareDouble Double  val1,
Double  val2
[static]
 

Compare two Doubles with the desired precision.

Definition at line 40 of file Match.java.

00040                                                                  {
00041 
00042     Double diff = val1 - val2;
00043     boolean equal = 
00044         Math.abs(diff) <= (Math.abs(val1)+Math.abs(val2)) * 0.00005 ||
00045         //0.00000005 || 
00046         val1==val2;
00047     return equal;
00048     }

String getName  ) 
 

Definition at line 26 of file Match.java.

Referenced by HTMLModelWriter.listNonMatchingParameters().

00026                            {
00027     return name;
00028     }

String getValue1  ) 
 

Definition at line 29 of file Match.java.

Referenced by HTMLModelWriter.listNonMatchingParameters().

00029                              {
00030     return value1.toString();
00031     }

String getValue2  ) 
 

Definition at line 32 of file Match.java.

Referenced by HTMLModelWriter.listNonMatchingParameters().

00032                              {
00033     return value2.toString();
00034     }


Member Data Documentation

String GEN = "Generator" [static]
 

Definition at line 11 of file Match.java.

String name = "" [private]
 

Definition at line 16 of file Match.java.

String PHPDF = "Photon PDF" [static]
 

Definition at line 13 of file Match.java.

String PRPDF = "Proton PDF" [static]
 

Definition at line 14 of file Match.java.

Object value1 = null [private]
 

Definition at line 17 of file Match.java.

Object value2 = null [private]
 

Definition at line 18 of file Match.java.

String VER = "Version" [static]
 

Definition at line 12 of file Match.java.


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007