Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.flowcache; |
| 2 | |
| 3 | public class PendingSwRespKey { |
| 4 | long swDpid; |
| 5 | int transId; |
| 6 | |
| 7 | public PendingSwRespKey(long swDpid, int transId) { |
| 8 | this.swDpid = swDpid; |
| 9 | this.transId = transId; |
| 10 | } |
| 11 | |
| 12 | @Override |
| 13 | public int hashCode() { |
| 14 | final int prime = 97; |
| 15 | Long dpid = swDpid; |
| 16 | Integer tid = transId; |
| 17 | return (tid.hashCode()*prime + dpid.hashCode()); |
| 18 | } |
| 19 | |
| 20 | @Override |
| 21 | public boolean equals(Object obj) { |
| 22 | if (this == obj) { |
| 23 | return true; |
| 24 | } |
| 25 | if (obj == null) { |
| 26 | return false; |
| 27 | } |
| 28 | if (!(obj instanceof PendingSwRespKey)) { |
| 29 | return false; |
| 30 | } |
| 31 | PendingSwRespKey other = (PendingSwRespKey) obj; |
| 32 | if ((swDpid != other.swDpid) || (transId != other.transId)) { |
| 33 | return false; |
| 34 | } |
| 35 | return true; |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public String toString() { |
| 40 | return Long.toHexString(swDpid)+","+Integer.toString(transId); |
| 41 | } |
| 42 | } |