| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
package com.drew.metadata; |
| 22 |
|
| 23 |
import com.drew.lang.annotations.NotNull; |
| 24 |
import com.drew.lang.annotations.Nullable; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public class Face |
| 36 |
{ |
| 37 |
private final int _x; |
| 38 |
private final int _y; |
| 39 |
private final int _width; |
| 40 |
private final int _height; |
| 41 |
@Nullable |
| 42 |
private final String _name; |
| 43 |
@Nullable |
| 44 |
private final Age _age; |
| 45 |
|
| 46 |
public Face(int x, int y, int width, int height, @Nullable String name, @Nullable Age age) |
| 47 |
{ |
| 48 |
_x = x; |
| 49 |
_y = y; |
| 50 |
_width = width; |
| 51 |
_height = height; |
| 52 |
_name = name; |
| 53 |
_age = age; |
| 54 |
} |
| 55 |
|
| 56 |
public int getX() |
| 57 |
{ |
| 58 |
return _x; |
| 59 |
} |
| 60 |
|
| 61 |
public int getY() |
| 62 |
{ |
| 63 |
return _y; |
| 64 |
} |
| 65 |
|
| 66 |
public int getWidth() |
| 67 |
{ |
| 68 |
return _width; |
| 69 |
} |
| 70 |
|
| 71 |
public int getHeight() |
| 72 |
{ |
| 73 |
return _height; |
| 74 |
} |
| 75 |
|
| 76 |
@Nullable |
| 77 |
public String getName() |
| 78 |
{ |
| 79 |
return _name; |
| 80 |
} |
| 81 |
|
| 82 |
@Nullable |
| 83 |
public Age getAge() |
| 84 |
{ |
| 85 |
return _age; |
| 86 |
} |
| 87 |
|
| 88 |
@Override |
| 89 |
public boolean equals(@Nullable Object o) |
| 90 |
{ |
| 91 |
if (this == o) return true; |
| 92 |
if (o == null || getClass() != o.getClass()) return false; |
| 93 |
|
| 94 |
Face face = (Face)o; |
| 95 |
|
| 96 |
if (_height != face._height) return false; |
| 97 |
if (_width != face._width) return false; |
| 98 |
if (_x != face._x) return false; |
| 99 |
if (_y != face._y) return false; |
| 100 |
if (_age != null ? !_age.equals(face._age) : face._age != null) return false; |
| 101 |
if (_name != null ? !_name.equals(face._name) : face._name != null) return false; |
| 102 |
|
| 103 |
return true; |
| 104 |
} |
| 105 |
|
| 106 |
@Override |
| 107 |
public int hashCode() |
| 108 |
{ |
| 109 |
int result = _x; |
| 110 |
result = 31 * result + _y; |
| 111 |
result = 31 * result + _width; |
| 112 |
result = 31 * result + _height; |
| 113 |
result = 31 * result + (_name != null ? _name.hashCode() : 0); |
| 114 |
result = 31 * result + (_age != null ? _age.hashCode() : 0); |
| 115 |
return result; |
| 116 |
} |
| 117 |
|
| 118 |
@Override |
| 119 |
@NotNull |
| 120 |
public String toString() |
| 121 |
{ |
| 122 |
StringBuilder result = new StringBuilder(); |
| 123 |
result.append("x: ").append(_x); |
| 124 |
result.append(" y: ").append(_y); |
| 125 |
result.append(" width: ").append(_width); |
| 126 |
result.append(" height: ").append(_height); |
| 127 |
if (_name != null) |
| 128 |
result.append(" name: ").append(_name); |
| 129 |
if (_age != null) |
| 130 |
result.append(" age: ").append(_age.toFriendlyString()); |
| 131 |
return result.toString(); |
| 132 |
} |
| 133 |
} |