Last change
on this file since 193 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
906 bytes
|
Rev | Line | |
---|
[107] | 1 | package com.framsticks.params; |
---|
| 2 | |
---|
| 3 | public class OpaqueObject { |
---|
| 4 | |
---|
| 5 | protected final String typeName; |
---|
| 6 | protected final long address; |
---|
| 7 | |
---|
| 8 | /** |
---|
| 9 | * @param typeName |
---|
| 10 | * @param address |
---|
| 11 | */ |
---|
| 12 | public OpaqueObject(String typeName, long address) { |
---|
| 13 | this.typeName = typeName; |
---|
| 14 | this.address = address; |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | @Override |
---|
| 18 | public String toString() { |
---|
| 19 | return typeName + "<0x" + Long.toHexString(address) + ">"; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | /** |
---|
| 23 | * @return the typeName |
---|
| 24 | */ |
---|
| 25 | public String getTypeName() { |
---|
| 26 | return typeName; |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * @return the address |
---|
| 31 | */ |
---|
| 32 | public long getAddress() { |
---|
| 33 | return address; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | @Override |
---|
| 37 | public boolean equals(Object obj) { |
---|
| 38 | if (!(obj instanceof OpaqueObject)) { |
---|
| 39 | return false; |
---|
| 40 | } |
---|
| 41 | OpaqueObject opaque = (OpaqueObject) obj; |
---|
| 42 | return typeName.equals(opaque.getTypeName()) && address == opaque.getAddress(); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | @Override |
---|
| 46 | public int hashCode() { |
---|
| 47 | return typeName.hashCode() ^ new Long(address).hashCode(); |
---|
| 48 | } |
---|
| 49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.