Last change
on this file since 547 was
433,
checked in by sherbold, 12 years ago
|
- renamed packages to fit QUEST project structure
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.4 KB
|
Line | |
---|
1 | package de.ugoe.cs.quest.eventcore.mock;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.quest.eventcore.IReplayable;
|
---|
4 |
|
---|
5 | public class MockReplayable implements IReplayable {
|
---|
6 |
|
---|
7 | private static final long serialVersionUID = 1L;
|
---|
8 |
|
---|
9 | final String replay;
|
---|
10 | final String target;
|
---|
11 |
|
---|
12 | public MockReplayable(String replay, String target) {
|
---|
13 | this.replay = replay;
|
---|
14 | this.target = target;
|
---|
15 | }
|
---|
16 |
|
---|
17 | @Override
|
---|
18 | public String getReplay() {
|
---|
19 | return replay;
|
---|
20 | }
|
---|
21 |
|
---|
22 | @Override
|
---|
23 | public String getTarget() {
|
---|
24 | return target;
|
---|
25 | }
|
---|
26 |
|
---|
27 | @Override
|
---|
28 | public boolean equals(Object other) {
|
---|
29 | if (this == other) {
|
---|
30 | return true;
|
---|
31 | }
|
---|
32 | if (other instanceof MockReplayable) {
|
---|
33 | if (replay != null && target != null) {
|
---|
34 | return replay.equals(((MockReplayable) other).replay)
|
---|
35 | && target.equals(((MockReplayable) other).target);
|
---|
36 | } else if (replay != null && target == null) {
|
---|
37 | return replay.equals(((MockReplayable) other).replay)
|
---|
38 | && ((MockReplayable) other).target == null;
|
---|
39 | } else if (replay == null && target != null) {
|
---|
40 | return ((MockReplayable) other).replay == null
|
---|
41 | && target.equals(((MockReplayable) other).target);
|
---|
42 | } else {
|
---|
43 | return ((MockReplayable) other).replay == null
|
---|
44 | && ((MockReplayable) other).target == null;
|
---|
45 | }
|
---|
46 | }
|
---|
47 | return false;
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public int hashCode() {
|
---|
52 | int hashCode = 17;
|
---|
53 | if( replay!=null ) {
|
---|
54 | hashCode *= replay.hashCode();
|
---|
55 | }
|
---|
56 | if( target!=null ) {
|
---|
57 | hashCode *= target.hashCode();
|
---|
58 | }
|
---|
59 | return hashCode;
|
---|
60 | }
|
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.