You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



All Packages  This Package  Class Hierarchy  Class Search  Index

Class grendel.storage.MessageID

java.lang.Object
   |
   +----grendel.storage.MessageID

This class represents a Message-ID. It does not contain the ID itself: there is no way to reconstruct the original string from this object; however, it contains a hash of that string which should be sufficiently unique so that the odds of a collision are 1 in 2^32 (since it is a 64-bit hash.)

We store the hash instead of the original string because it takes up significantly less memory, and in order to do threading, we tend to need a huge number of Message-IDs in memory at once.

See Also: MessageIDTable


class  MessageID
     extends java.lang.Object
{
          // Fields 1
     long hash;

          // Constructors 4
     MessageID();
     MessageID(byte[], int, int);
     MessageID(String);
     MessageID(long);

          // Methods 4
     public boolean equals(Object);
     protected long hashBytes(byte[], int, int);
     public int hashCode();
     public String toString();
}



Fields


hash

   long hash



Constructors


MessageID

   MessageID() 

Constructs a MessageID object with a null hash.



MessageID

   MessageID(long hash) 

Constructs a MessageID object with the given hash.



MessageID

   MessageID(byte[] bytes, 
             int start, 
             int length) 

Constructs a MessageID object for the given sub-sequence of bytes. A pointer to the bytes is not retained.



MessageID

   MessageID(String chars) 



Methods


toString

   public String toString() 

Converts it to a string, for debugging.

Overrides:
toString in class Object


hashCode

   public int hashCode() 
Overrides:
hashCode in class Object


equals

   public boolean equals(Object x) 
Overrides:
equals in class Object


hashBytes

   protected long hashBytes(byte[] bytes, 
                            int start, 
                            int length) 

Computes a 64-bit hash of the given subsequence of bytes.

Note: this hash value is written out to mail summary files by the MailSummaryFileGrendel class. If the hash algorithm is changed, it will invalidate all existing mail summary files, and necessitate a change of the file format version number.

See Also: MailSummaryFileGrendel



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4