1 /*
2 * Copyright (c) 2005-2007 Creative Sphere Limited.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *
10 * Creative Sphere - initial API and implementation
11 *
12 */
13 package org.abstracthorizon.mercury.maildir.uid;
14
15
16 /**
17 * This class represents UID number
18 *
19 * @author Daniel Sendula
20 */
21 public class UID {
22
23 /** Uid number */
24 protected long uid;
25
26 /**
27 * Constructor
28 * @param uid uid
29 */
30 public UID(long uid) {
31 this.uid = uid;
32 }
33
34 /**
35 * Returns uid number
36 * @return uid number
37 */
38 public long getUID() {
39 return uid;
40 }
41
42 /**
43 * Returns uid converted to integer as hash code.
44 * @return uid converted to integer as hash code.
45 */
46 public int hashCode() {
47 return (int)uid;
48 }
49
50 /**
51 * Compares two <code>UID</code> objects
52 * @param o object to be compared with
53 * @return <code>true</code> if uids are the same
54 */
55 public boolean equals(Object o) {
56 if (o instanceof UID) {
57 return ((UID)o).uid == uid;
58 }
59 return false;
60 }
61
62 /**
63 * Returns uid as long converted to string
64 * @return uid as long converted to string
65 */
66 public String toString() {
67 return Long.toString(uid);
68 }
69 }