| 6 | import android.os.Parcel; |
| 7 | |
| 8 | public final class Rect { |
| 9 | public int left; |
| 10 | public int top; |
| 11 | public int right; |
| 12 | public int bottom; |
| 13 | |
| 14 | private static final class UnflattenHelper { |
| 15 | private static final Pattern FLATTENED_PATTERN = Pattern.compile( |
| 16 | "(-?\\d+) (-?\\d+) (-?\\d+) (-?\\d+)"); |
| 17 | |
| 18 | static Matcher getMatcher(String str) { |
| 19 | return FLATTENED_PATTERN.matcher(str); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | public Rect() { |
| 24 | } |
| 25 | |
| 26 | public Rect(int left, int top, int right, int bottom) { |
| 27 | this.left = left; |
| 28 | this.top = top; |
| 29 | this.right = right; |
| 30 | this.bottom = bottom; |
| 31 | } |
| 32 | |
| 33 | public Rect(Rect r) { |
| 34 | if (r == null) { |
| 35 | this.left = 0; |
| 36 | this.top = 0; |
| 37 | this.right = 0; |
| 38 | this.bottom = 0; |
| 39 | } else { |
| 40 | this.left = r.left; |
| 41 | this.top = r.top; |
| 42 | this.right = r.right; |
| 43 | this.bottom = r.bottom; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | public void set(int left, int top, int right, int bottom) { |
| 48 | this.left = left; |
| 49 | this.top = top; |
| 50 | this.right = right; |
| 51 | this.bottom = bottom; |
| 52 | } |
| 53 | |
| 54 | public void set(Rect r) { |
| 55 | this.left = r.left; |
| 56 | this.top = r.top; |
| 57 | this.right = r.right; |
| 58 | this.bottom = r.bottom; |
| 59 | } |
| 60 | |
| 61 | public final int getWidth() { |
| 62 | return right - left; |
| 63 | } |
| 64 | |
| 65 | public final int getHeight() { |
nothing calls this directly
no outgoing calls
no test coverage detected