summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/DataKeyID.java
blob: a98129f1f31733e997392d1f2bcfe266b386def4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package net.wotonomy.test;

import net.wotonomy.control.EOGlobalID;
import net.wotonomy.datastore.DataKey;

/**
 * A test implementation of EOGlobalID that wraps a DataKey.
 *
 * @author michael@mpowers.net
 * @author $Author: cgruber $
 * @version $Revision: 893 $
 */
public class DataKeyID extends EOGlobalID {
	private DataKey key;

	/**
	 * Constructor takes a data key.
	 */
	public DataKeyID(DataKey aKey) {
		key = aKey;
	}

	/**
	 * Returns the wrapped data key.
	 */
	public DataKey getKey() {
		return key;
	}

	public boolean isTemporary() {
		return false;
	}

	public Object clone() {
		return new DataKeyID((DataKey) key.clone());
	}

	public String toString() {
		return "[DataKeyID:" + key.toString() + "]";
	}

	public int hashCode() {
		return key.hashCode();
	}

	public boolean equals(Object anObject) {
		if (anObject instanceof DataKeyID) {
			if (((DataKeyID) anObject).key.equals(key)) {
				return true;
			}
		}
		return false;
	}

}

/*
 * $Log$ Revision 1.1 2006/02/16 13:22:22 cgruber Check in all sources in
 * eclipse-friendly maven-enabled packages.
 *
 * Revision 1.3 2001/02/23 23:44:44 mpowers Fixes for hashcode to ensure proper
 * key comparison.
 *
 * Revision 1.2 2001/02/22 20:56:07 mpowers Tests of notification handling.
 *
 * Revision 1.1 2001/02/15 21:14:45 mpowers Test suite now using a persistent
 * object store with editing context.
 *
 * Revision 1.1 2001/02/05 03:45:37 mpowers Starting work on EOEditingContext.
 *
 *
 */