Skip to content

Commit d7cbbd2

Browse files
committed
improved naming
1 parent bf4b664 commit d7cbbd2

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ public ResponsiveUIChunkValidatorBase alignedAsGrid(int horizontalGridSize, int
8484

8585
@Override
8686
public ChunkUIElementValidator areAlignedAsGridCells() {
87-
if (rootElements.size() == 2) {
87+
validateAlignedAsGridCells(rootElements);
88+
return this;
89+
}
90+
91+
public void validateAlignedAsGridCells(List<UIElement> rootElements) {
92+
if (this.rootElements.size() == 2) {
8893
errors.add("banane");
8994
}
90-
return this;
9195
}
9296

9397
/**

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import net.itarray.automotion.internal.geometry.Direction;
44
import net.itarray.automotion.internal.geometry.ExtendGiving;
5-
import net.itarray.automotion.internal.geometry.Group;
5+
import net.itarray.automotion.internal.geometry.GroupElement;
66
import net.itarray.automotion.internal.geometry.Rectangle;
77
import net.itarray.automotion.internal.geometry.Scalar;
88
import net.itarray.automotion.internal.geometry.Vector;
@@ -91,7 +91,7 @@ public Scalar getEnd(Direction direction) {
9191
return direction.end(rectangle);
9292
}
9393

94-
public <V extends Group<V>> V getExtend(ExtendGiving<V> direction) {
94+
public <V extends GroupElement<V>> V getExtend(ExtendGiving<V> direction) {
9595
return direction.extend(rectangle);
9696
}
9797

@@ -147,7 +147,7 @@ public boolean hasEqualBottomOffsetAs(UIElement other) {
147147
return hasEqualBegin(UP, other);
148148
}
149149

150-
public <V extends Group<V>> boolean hasEqualExtendAs(ExtendGiving<V> direction, UIElement other) {
150+
public <V extends GroupElement<V>> boolean hasEqualExtendAs(ExtendGiving<V> direction, UIElement other) {
151151
return direction.extend(rectangle).equals(direction.extend(other.rectangle));
152152
}
153153

@@ -283,7 +283,7 @@ public void validateSameWidth(UIElement element, Errors errors) {
283283
validateSameExtend(RIGHT, element, errors);
284284
}
285285

286-
public <V extends Group<V>> void validateSameExtend(ExtendGiving<V> direction, UIElement element, Errors errors) {
286+
public <V extends GroupElement<V>> void validateSameExtend(ExtendGiving<V> direction, UIElement element, Errors errors) {
287287
if (!hasEqualExtendAs(direction, element)) {
288288
errors.add(
289289
String.format("Element %s has not the same %s as element %s. %s of %s is %s. %s of element is %s",
@@ -299,7 +299,7 @@ public <V extends Group<V>> void validateSameExtend(ExtendGiving<V> direction, U
299299
}
300300
}
301301

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

src/main/java/net/itarray/automotion/internal/geometry/ExtendGiving.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package net.itarray.automotion.internal.geometry;
22

3-
public interface ExtendGiving<V extends Group<V>> {
3+
public interface ExtendGiving<V extends GroupElement<V>> {
44
String extendName();
55
V begin(Rectangle rectangle);
66
V end(Rectangle rectangle);

src/main/java/net/itarray/automotion/internal/geometry/Group.java renamed to src/main/java/net/itarray/automotion/internal/geometry/GroupElement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package net.itarray.automotion.internal.geometry;
22

3-
public interface Group<V> {
3+
public interface GroupElement<V> {
44
V plus(V addend);
55
V minus(V subtrahend);
66
String toStringWithUnits(String units);

src/main/java/net/itarray/automotion/internal/geometry/Scalar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import net.itarray.automotion.validation.properties.Condition;
55
import org.apache.commons.math3.fraction.Fraction;
66

7-
public class Scalar implements Group<Scalar>, Comparable<Scalar> {
7+
public class Scalar implements GroupElement<Scalar>, Comparable<Scalar> {
88
private final Fraction fraction;
99

1010
public Scalar(int value) {

src/main/java/net/itarray/automotion/internal/geometry/Vector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package net.itarray.automotion.internal.geometry;
22

3-
public class Vector implements Group<Vector> {
3+
public class Vector implements GroupElement<Vector> {
44
private final Scalar x;
55
private final Scalar y;
66

src/main/java/net/itarray/automotion/internal/properties/ConditionedExpression.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package net.itarray.automotion.internal.properties;
22

33
import net.itarray.automotion.internal.geometry.Direction;
4-
import net.itarray.automotion.internal.geometry.Group;
5-
import net.itarray.automotion.internal.geometry.Scalar;
4+
import net.itarray.automotion.internal.geometry.GroupElement;
65
import net.itarray.automotion.validation.properties.Condition;
76
import net.itarray.automotion.validation.properties.Expression;
87

@@ -28,6 +27,6 @@ public String getDescription(Context context, Direction direction) {
2827
toBeConditioned.getDescription(context, direction),
2928
toBeApplied.getDescription(context, direction),
3029
toBeConditioned.getRepeatedDescription(context, direction),
31-
(t instanceof Group) ? ((Group) t).toStringWithUnits("px") : t);
30+
(t instanceof GroupElement) ? ((GroupElement) t).toStringWithUnits("px") : t);
3231
}
3332
}

src/main/java/net/itarray/automotion/internal/properties/ElementPropertyExpression.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import net.itarray.automotion.internal.UIElement;
44
import net.itarray.automotion.internal.geometry.Direction;
55
import net.itarray.automotion.internal.geometry.ExtendGiving;
6-
import net.itarray.automotion.internal.geometry.Group;
6+
import net.itarray.automotion.internal.geometry.GroupElement;
77
import net.itarray.automotion.validation.properties.Expression;
88

99
import java.util.function.Function;
@@ -18,7 +18,7 @@ private ElementPropertyExpression(UIElement element, Function<UIElement, T> prop
1818
this.property = new ElementProperty<>(property, descriptionFormat, name);
1919
}
2020

21-
public static <V extends Group<V>> ElementPropertyExpression<V> extend(ExtendGiving<V> direction, UIElement element) {
21+
public static <V extends GroupElement<V>> ElementPropertyExpression<V> extend(ExtendGiving<V> direction, UIElement element) {
2222
return new ElementPropertyExpression<>(element, e -> e.getExtend(direction), direction.extendName() +
2323
" of element %s", direction.extendName());
2424
}

0 commit comments

Comments
 (0)