Skip to content

Commit e9db6ea

Browse files
committed
removed some unused methods and made some methods private
1 parent 44411c0 commit e9db6ea

File tree

1 file changed

+1
-54
lines changed

1 file changed

+1
-54
lines changed

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

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -125,30 +125,10 @@ public Vector getCorner() {
125125
return rectangle.getCorner();
126126
}
127127

128-
private boolean hasEqualBegin(UIElement other, Direction direction) {
129-
return getBegin(direction).equals(other.getBegin(direction));
130-
}
131-
132128
private boolean hasEqualEnd(UIElement other, Direction direction) {
133129
return getEnd(direction).equals(other.getEnd(direction));
134130
}
135131

136-
public boolean hasEqualLeftOffsetAs(UIElement other) {
137-
return hasEqualBegin(other, RIGHT);
138-
}
139-
140-
public boolean hasEqualRightOffsetAs(UIElement other) {
141-
return hasEqualBegin(other, LEFT);
142-
}
143-
144-
public boolean hasEqualTopOffsetAs(UIElement other) {
145-
return hasEqualBegin(other, DOWN);
146-
}
147-
148-
public boolean hasEqualBottomOffsetAs(UIElement other) {
149-
return hasEqualBegin(other, UP);
150-
}
151-
152132
private <V extends MetricSpace<V>> boolean hasEqualExtendAs(UIElement other, ExtendGiving<V> direction, Context context) {
153133
Expression<Boolean> equal = Expression.equalTo(
154134
ElementPropertyExpression.extend(direction, this),
@@ -192,18 +172,10 @@ public boolean hasRightElement(UIElement rightElement) {
192172
return hasSuccessor(RIGHT, rightElement);
193173
}
194174

195-
public boolean hasLeftElement(UIElement leftElement) {
196-
return leftElement.hasSuccessor(RIGHT, this);
197-
}
198-
199175
public boolean hasBelowElement(UIElement bottomElement) {
200176
return hasSuccessor(DOWN, bottomElement);
201177
}
202178

203-
public boolean hasAboveElement(UIElement aboveElement) {
204-
return aboveElement.hasSuccessor(DOWN, this);
205-
}
206-
207179
public String getCssValue(String cssProperty) {
208180
return cssSource.getCssValue(cssProperty);
209181
}
@@ -309,47 +281,22 @@ public void validateNotSameSize(UIElement element, Context context, Errors error
309281
}
310282

311283

312-
public void validateIsRightOf(UIElement leftElement, Errors errors) {
313-
validateSuccessor(LEFT, leftElement, errors);
314-
}
315-
316284
public void validateIsRightOf(UIElement element, Condition<Scalar> condition, Context context, Errors errors) {
317285
validateSuccessor(LEFT, element, condition, context, errors);
318286
}
319287

320-
public void validateIsLeftOf(UIElement rightElement, Errors errors) {
321-
validateSuccessor(RIGHT, rightElement, errors);
322-
}
323-
324288
public void validateIsLeftOf(UIElement element, Condition<Scalar> condition, Context context, Errors errors) {
325289
validateSuccessor(RIGHT, element, condition, context, errors);
326290
}
327291

328-
public void validateIsBelow(UIElement aboveElement, Errors errors) {
329-
validateSuccessor(UP, aboveElement, errors);
330-
}
331-
332292
public void validateIsBelow(UIElement element, Condition<Scalar> condition, Context context, Errors errors) {
333293
validateSuccessor(UP, element, condition, context, errors);
334294
}
335295

336-
public void validateIsAbove(UIElement belowElement, Errors errors) {
337-
validateSuccessor(DOWN, belowElement, errors);
338-
}
339-
340296
public void validateIsAbove(UIElement element, Condition<Scalar> condition, Context context, Errors errors) {
341297
validateSuccessor(DOWN, element, condition, context, errors);
342298
}
343299

344-
public void validateSuccessor(Direction direction, UIElement toBeValidatedSuccessor, Errors errors) {
345-
if (!hasSuccessor(direction, toBeValidatedSuccessor)) {
346-
errors.add(
347-
String.format("%s element aligned not properly",
348-
direction.afterName()),
349-
toBeValidatedSuccessor);
350-
}
351-
}
352-
353300
public void validateSuccessor(Direction direction, UIElement toBeValidatedSuccessor, Condition<Scalar> condition, Context context, Errors errors) {
354301
Scalar signedDistance = signedDistanceToSuccessor(direction, toBeValidatedSuccessor);
355302
if (!signedDistance.satisfies(condition, context, direction)) {
@@ -442,7 +389,7 @@ public void validateWidth(Condition<Scalar> condition, Context context, Errors e
442389
validateExtend(RIGHT, condition, context, errors);
443390
}
444391

445-
public void validateExtend(Direction direction, Condition<Scalar> condition, Context context, Errors errors) {
392+
private void validateExtend(Direction direction, Condition<Scalar> condition, Context context, Errors errors) {
446393
ElementPropertyExpression<Scalar> property = ElementPropertyExpression.extend(direction, this);
447394
Expression<Boolean> assertion = condition.applyTo(property);
448395
if (!assertion.evaluateIn(context, direction)) {

0 commit comments

Comments
 (0)