1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.client;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.HConstants;
23
24
25
26
27
28
29 @InterfaceAudience.Private
30 public class Action<R> implements Comparable<R> {
31
32 private Row action;
33 private int originalIndex;
34 private long nonce = HConstants.NO_NONCE;
35
36 public Action(Row action, int originalIndex) {
37 super();
38 this.action = action;
39 this.originalIndex = originalIndex;
40 }
41
42 public void setNonce(long nonce) {
43 this.nonce = nonce;
44 }
45
46 public boolean hasNonce() {
47 return nonce != HConstants.NO_NONCE;
48 }
49
50 public Row getAction() {
51 return action;
52 }
53
54 public int getOriginalIndex() {
55 return originalIndex;
56 }
57
58 @SuppressWarnings("rawtypes")
59 @Override
60 public int compareTo(Object o) {
61 return action.compareTo(((Action) o).getAction());
62 }
63
64 @Override
65 public int hashCode() {
66 return this.action.hashCode();
67 }
68
69 @Override
70 public boolean equals(Object obj) {
71 if (this == obj) return true;
72 if (obj == null || getClass() != obj.getClass()) return false;
73 Action<?> other = (Action<?>) obj;
74 return compareTo(other) == 0;
75 }
76
77 public long getNonce() {
78 return nonce;
79 }
80 }