Skip to content

Commit f53dd63

Browse files
committed
Rectangle: override the toString() method
1 parent fc3d6be commit f53dd63

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

jme3-core/src/main/java/com/jme3/math/Rectangle.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -253,4 +253,19 @@ public Rectangle clone() {
253253
throw new AssertionError();
254254
}
255255
}
256+
257+
/**
258+
* Returns a string representation of the Recatangle, which is unaffected.
259+
* For example, a rectangle with vertices at (1,0,0), (2,0,0), (1,2,0), and
260+
* (2,2,0) is represented by:
261+
* <pre>
262+
* Rectangle [A: (1.0, 0.0, 0.0) B: (2.0, 0.0, 0.0) C: (1.0, 2.0, 0.0)]
263+
* </pre>
264+
*
265+
* @return the string representation (not null, not empty)
266+
*/
267+
@Override
268+
public String toString() {
269+
return getClass().getSimpleName() + " [A: " + a + " B: " + b + " C: " + c + "]";
270+
}
256271
}

0 commit comments

Comments
 (0)