From fefe84c272f3b8bb58894d5c2b35446c8ceecb02 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 18 May 2017 12:51:23 -0700 Subject: [PATCH] geometry: move up custom `to_s` to the interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/geometry/boxes.nit | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/geometry/boxes.nit b/lib/geometry/boxes.nit index 6ecf483..314cde3 100644 --- a/lib/geometry/boxes.nit +++ b/lib/geometry/boxes.nit @@ -83,6 +83,8 @@ interface Boxed[N: Numeric] # assert b.left == 2 and b.right == 8 and b.top == 13 and b.bottom == 7 # ~~~ fun padded(dist: N): Box[N] do return new Box[N].lrtb(left - dist, right + dist, top + dist, bottom - dist) + + redef fun to_s do return "<{class_name} left: {left}, right: {right}, top: {top}, bottom: {bottom}>" end # A 2d bounded object and an implementation of `Boxed` @@ -146,8 +148,6 @@ class Box[N: Numeric] do init(left, left+width, top, top - height) end - - redef fun to_s do return "" end # An 3d abstract bounded object @@ -195,6 +195,8 @@ interface Boxed3d[N: Numeric] end redef fun padded(dist): Box3d[N] do return new Box3d[N].lrtbfb(left - dist, right + dist, top + dist, bottom - dist, front + dist, back - dist) + + redef fun to_s do return "<{class_name} left: {left}, right: {right}, top: {top}, bottom: {bottom}, front: {front}, back: {back}>" end # A 3d bounded object and an implementation of Boxed @@ -278,8 +280,6 @@ class Box3d[N: Numeric] self.front = front self.back = front - depth end - - redef fun to_s do return "