Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align toString methods in geo module #13302

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lucene/core/src/java/org/apache/lucene/geo/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("CIRCLE(");
sb.append("Circle(");
sb.append("[" + lat + "," + lon + "]");
sb.append(" radius = " + radiusMeters + " meters");
sb.append(')');
Expand Down
2 changes: 1 addition & 1 deletion lucene/core/src/java/org/apache/lucene/geo/Line.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("LINE(");
sb.append("Line(");
for (int i = 0; i < lats.length; i++) {
sb.append("[").append(lons[i]).append(", ").append(lats[i]).append("]");
}
Expand Down
1 change: 1 addition & 0 deletions lucene/core/src/java/org/apache/lucene/geo/Polygon.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public boolean equals(Object obj) {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Polygon");
for (int i = 0; i < polyLats.length; i++) {
sb.append("[").append(polyLats[i]).append(", ").append(polyLons[i]).append("] ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public int hashCode() {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("XYRectangle(x=");
sb.append("Rectangle2D(x=");
sb.append(minX);
sb.append(" TO ");
sb.append(maxX);
Expand Down
2 changes: 1 addition & 1 deletion lucene/core/src/java/org/apache/lucene/geo/XYCircle.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("CIRCLE(");
sb.append("XYCircle(");
sb.append("[" + x + "," + y + "]");
sb.append(" radius = " + radius);
sb.append(')');
Expand Down
2 changes: 1 addition & 1 deletion lucene/core/src/java/org/apache/lucene/geo/XYLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("XYLINE(");
sb.append("XYLine(");
for (int i = 0; i < x.length; i++) {
sb.append("[").append(x[i]).append(", ").append(y[i]).append("]");
}
Expand Down
2 changes: 1 addition & 1 deletion lucene/core/src/java/org/apache/lucene/geo/XYPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Point(");
sb.append("XYPoint(");
sb.append(x);
sb.append(",");
sb.append(y);
Expand Down
1 change: 1 addition & 0 deletions lucene/core/src/java/org/apache/lucene/geo/XYPolygon.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public boolean equals(Object obj) {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("XYPolygon");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While were doing this standardization, can we also add the name to the others that are missing it too? Like Polygon

StringBuilder sb = new StringBuilder();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Added it to Polygon, too.

for (int i = 0; i < x.length; i++) {
sb.append("[").append(x[i]).append(", ").append(y[i]).append("] ");
}
Expand Down