OLD | NEW |
(Empty) | |
| 1 package com.google.dart.tools.core.mobile; |
| 2 |
| 3 /** |
| 4 * Class representing a connected android device as returned by |
| 5 * {@link AndroidDebugBridge#getConnectedDevice()}. |
| 6 */ |
| 7 public class AndroidDevice { |
| 8 |
| 9 public static boolean isEqual(AndroidDevice d1, AndroidDevice d2) { |
| 10 return d1 == null ? d2 == null : d1.equals(d2); |
| 11 } |
| 12 |
| 13 private String deviceId; |
| 14 |
| 15 private boolean authorized; |
| 16 |
| 17 public AndroidDevice(String deviceId, boolean authorized) { |
| 18 if (deviceId == null) { |
| 19 throw new IllegalArgumentException(); |
| 20 } |
| 21 this.deviceId = deviceId; |
| 22 this.authorized = authorized; |
| 23 } |
| 24 |
| 25 @Override |
| 26 public boolean equals(Object other) { |
| 27 if (other instanceof AndroidDevice) { |
| 28 AndroidDevice d = (AndroidDevice) other; |
| 29 return deviceId.equals(d.getDeviceId()) && authorized == d.isAuthorized(); |
| 30 } |
| 31 return false; |
| 32 } |
| 33 |
| 34 public String getDeviceId() { |
| 35 return deviceId; |
| 36 } |
| 37 |
| 38 @Override |
| 39 public int hashCode() { |
| 40 return deviceId.hashCode() + (authorized ? 1 : 0); |
| 41 } |
| 42 |
| 43 public boolean isAuthorized() { |
| 44 return authorized; |
| 45 } |
| 46 } |
OLD | NEW |