Modification Class Reference

Inheritance diagram for Modification:

Inheritance graph
[legend]

Collaboration diagram for Modification:

Collaboration graph
[legend]

List of all members.


Public Member Functions

 Modification ()
 Default constructor.
Date getTimestamp ()
 Get modification timestamp.
Modification setTimestamp (Date timestamp)
 Set modification timestamp.
String getModifier ()
 Get the name of the person who made this modification.
Modification setModifier (String modifier)
 Set the name of the person who made this modification.
String getComment ()
 Get the modification comment (may be null).
Modification setComment (String comment)
 Set the modification comment (may be null).
Modification unsetComment ()
 Unset the modification comment.
int compareTo (Modification other)
String toString ()
 Default String representation: declares that method is not properly defined by default.
boolean equals (Object other)
int hashCode ()

Package Functions

Logger log ()
 Neat method to allow every class to get hold of a custom-named Logger.

Detailed Description

Definition at line 10 of file Modification.java.


Constructor & Destructor Documentation

Modification (  ) 

Default constructor.

Definition at line 30 of file Modification.java.

00030 {}


Member Function Documentation

Date getTimestamp (  ) 

Get modification timestamp.

Definition at line 37 of file Modification.java.

Referenced by Modification.compareTo(), Modification.hashCode(), and Modification.toString().

00037                                {
00038         return _timestamp;
00039     }

Modification setTimestamp ( Date  timestamp  ) 

Set modification timestamp.

Definition at line 41 of file Modification.java.

00041                                                      {
00042         _timestamp = timestamp;
00043         return this;
00044     }

String getModifier (  ) 

Get the name of the person who made this modification.

Definition at line 48 of file Modification.java.

Referenced by Modification.hashCode(), and Modification.toString().

00048                                 {
00049         return _modifier;
00050     }

Modification setModifier ( String  modifier  ) 

Set the name of the person who made this modification.

Definition at line 52 of file Modification.java.

00052                                                      {
00053         _modifier = modifier;
00054         return this;
00055     }

String getComment (  ) 

Get the modification comment (may be null).

Definition at line 59 of file Modification.java.

Referenced by Modification.hashCode(), and Modification.toString().

00059                                {
00060         return _comment;
00061     }

Modification setComment ( String  comment  ) 

Set the modification comment (may be null).

Definition at line 63 of file Modification.java.

00063                                                    {
00064         _comment = comment;
00065         return this;
00066     }

Modification unsetComment (  ) 

Unset the modification comment.

Definition at line 68 of file Modification.java.

00068                                        {
00069         _comment = null;
00070         return this;
00071     }

int compareTo ( Modification  other  ) 

Definition at line 77 of file Modification.java.

References Modification.getTimestamp(), and Storeable.log().

00077                                              {
00078         log().debug("Comparing modifications...");
00079         if (getTimestamp() == null) {
00080             log().warn("Null timestamp");
00081             return 1; // Sort null at the end
00082         } else if (getTimestamp().after(other.getTimestamp())) {
00083             log().debug("Greater than");
00084             return 1;
00085         } else if (getTimestamp().before(other.getTimestamp())) {
00086             log().debug("Less than");
00087             return -1;
00088         } else {
00089             log().debug("Equal to");
00090             return 0;
00091         }
00092     }

String toString (  ) 

Default String representation: declares that method is not properly defined by default.

Reimplemented from Storeable.

Definition at line 98 of file Modification.java.

References Modification.getComment(), Modification.getModifier(), and Modification.getTimestamp().

00098                              {
00099         StringBuffer s = new StringBuffer();
00100         s.append(getTimestamp().toString() + ", ");
00101         s.append(getModifier() + "\n");
00102         s.append(getComment());
00103         return s.toString();
00104     }

boolean equals ( Object  other  ) 

Definition at line 107 of file Modification.java.

References Modification.hashCode().

00107                                         {
00108         if (this == other) return true;
00109         if (! (other instanceof Modification)) return false;
00110         return hashCode() == other.hashCode();
00111     }

int hashCode (  ) 

Definition at line 114 of file Modification.java.

References Modification.getComment(), Modification.getModifier(), and Modification.getTimestamp().

Referenced by Modification.equals().

00114                           {
00115         int code = 53;
00116         if (getTimestamp() != null) code ^= getTimestamp().hashCode();
00117         if (getModifier() != null)  code ^= getModifier().hashCode();
00118         if (getComment() != null)   code ^= getComment().hashCode();
00119         return code;
00120     }

Logger log (  )  [package, inherited]


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


Generated on Tue Apr 21 15:54:46 2009 for HepData object model by  doxygen 1.5.5