equal
deleted
inserted
replaced
|
1 /* |
|
2 * otr4j, the open source java otr library. |
|
3 * |
|
4 * Distributable under LGPL license. |
|
5 * See terms of license at gnu.org. |
|
6 */ |
|
7 package net.java.otr4j.io.messages; |
|
8 |
|
9 /** |
|
10 * |
|
11 * @author George Politis |
|
12 */ |
|
13 public abstract class AbstractMessage { |
|
14 // Fields. |
|
15 public int messageType; |
|
16 |
|
17 // Ctor. |
|
18 public AbstractMessage(int messageType) { |
|
19 this.messageType = messageType; |
|
20 } |
|
21 |
|
22 // Methods. |
|
23 @Override |
|
24 public int hashCode() { |
|
25 final int prime = 31; |
|
26 int result = 1; |
|
27 result = prime * result + messageType; |
|
28 return result; |
|
29 } |
|
30 |
|
31 @Override |
|
32 public boolean equals(Object obj) { |
|
33 if (this == obj) |
|
34 return true; |
|
35 if (obj == null) |
|
36 return false; |
|
37 if (getClass() != obj.getClass()) |
|
38 return false; |
|
39 AbstractMessage other = (AbstractMessage) obj; |
|
40 if (messageType != other.messageType) |
|
41 return false; |
|
42 return true; |
|
43 } |
|
44 |
|
45 // Unencoded |
|
46 public static final int MESSAGE_ERROR = 0xff; |
|
47 public static final int MESSAGE_QUERY = 0x100; |
|
48 public static final int MESSAGE_PLAINTEXT = 0x102; |
|
49 } |