Skip to content

Commit fb8baba

Browse files
committed
bit more privacy and putting the object argument first
1 parent 6836c98 commit fb8baba

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/main/java/net/itarray/automotion/internal/UIElement.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,44 +125,44 @@ public Vector getCorner() {
125125
return rectangle.getCorner();
126126
}
127127

128-
public boolean hasEqualBegin(Direction direction, UIElement other) {
128+
private boolean hasEqualBegin(UIElement other, Direction direction) {
129129
return getBegin(direction).equals(other.getBegin(direction));
130130
}
131131

132-
public boolean hasEqualEnd(Direction direction, UIElement other) {
132+
private boolean hasEqualEnd(UIElement other, Direction direction) {
133133
return getEnd(direction).equals(other.getEnd(direction));
134134
}
135135

136136
public boolean hasEqualLeftOffsetAs(UIElement other) {
137-
return hasEqualBegin(RIGHT, other);
137+
return hasEqualBegin(other, RIGHT);
138138
}
139139

140140
public boolean hasEqualRightOffsetAs(UIElement other) {
141-
return hasEqualBegin(LEFT, other);
141+
return hasEqualBegin(other, LEFT);
142142
}
143143

144144
public boolean hasEqualTopOffsetAs(UIElement other) {
145-
return hasEqualBegin(DOWN, other);
145+
return hasEqualBegin(other, DOWN);
146146
}
147147

148148
public boolean hasEqualBottomOffsetAs(UIElement other) {
149-
return hasEqualBegin(UP, other);
149+
return hasEqualBegin(other, UP);
150150
}
151151

152-
public <V extends GroupElement<V>> boolean hasEqualExtendAs(ExtendGiving<V> direction, UIElement other) {
152+
private <V extends GroupElement<V>> boolean hasEqualExtendAs(UIElement other, ExtendGiving<V> direction) {
153153
return getExtend(direction).equals(other.getExtend(direction));
154154
}
155155

156156
public boolean hasSameWidthAs(UIElement other) {
157-
return hasEqualExtendAs(RIGHT, other);
157+
return hasEqualExtendAs(other, RIGHT);
158158
}
159159

160160
public boolean hasSameHeightAs(UIElement other) {
161-
return hasEqualExtendAs(DOWN, other);
161+
return hasEqualExtendAs(other, DOWN);
162162
}
163163

164164
public boolean hasSameSizeAs(UIElement other) {
165-
return hasEqualExtendAs(DOWN, other) && hasEqualExtendAs(RIGHT, other);
165+
return hasEqualExtendAs(other, Rectangle.ORIGIN_CORNER);
166166
}
167167

168168
public boolean overlaps(UIElement other) {
@@ -263,7 +263,7 @@ public void validateBottomAlignedWith(UIElement element, Errors errors) {
263263
}
264264

265265
public void validateEqualEnd(Direction direction, UIElement element, Errors errors) {
266-
if (!hasEqualEnd(direction, element)) {
266+
if (!hasEqualEnd(element, direction)) {
267267
errors.add(
268268
String.format("Element %s has not the same %s offset as element %s",
269269
getQuotedName(),
@@ -286,7 +286,7 @@ public void validateSameWidth(UIElement element, Errors errors) {
286286
}
287287

288288
public <V extends GroupElement<V>> void validateSameExtend(ExtendGiving<V> direction, UIElement element, Errors errors) {
289-
if (!hasEqualExtendAs(direction, element)) {
289+
if (!hasEqualExtendAs(element, direction)) {
290290
errors.add(
291291
String.format("Element %s has not the same %s as element %s. %s of %s is %s. %s of element is %s",
292292
getQuotedName(),
@@ -302,7 +302,7 @@ public <V extends GroupElement<V>> void validateSameExtend(ExtendGiving<V> direc
302302
}
303303

304304
public <V extends GroupElement<V>> void validateNotSameExtend(ExtendGiving<V> direction, UIElement element, Errors errors) {
305-
if (hasEqualExtendAs(direction, element)) {
305+
if (hasEqualExtendAs(element, direction)) {
306306
errors.add(
307307
String.format("Element %s has the same %s as element %s. %s of %s is %s. %s of element is %s",
308308
getQuotedName(),

0 commit comments

Comments
 (0)