From e43add66052fc161d159bb90b30d99dd28b5873d Mon Sep 17 00:00:00 2001 From: Philipp3107 Date: Fri, 9 Dec 2022 00:30:35 +0100 Subject: [PATCH] updated Robot classes --- domain/C3PO.java | 24 +----------------------- domain/R2D2.java | 37 +------------------------------------ 2 files changed, 2 insertions(+), 59 deletions(-) diff --git a/domain/C3PO.java b/domain/C3PO.java index ecdee28..9039fcb 100644 --- a/domain/C3PO.java +++ b/domain/C3PO.java @@ -1,6 +1,6 @@ package domain; -public class C3PO implements Robot{ +public class C3PO extends RobotBasics { private int id; private String name; @@ -11,27 +11,5 @@ public class C3PO implements Robot{ this.name = name; power = false; } - @Override - public int getId() { - return id; - } - @Override - public String getName() { - return name; - } - - @Override - public void triggerPowerSwitch() { - if(power = false){ - power = true; - }else{ - power = false; - } - } - - @Override - public boolean isPowerOn() { - return power; - } } diff --git a/domain/R2D2.java b/domain/R2D2.java index 322f217..ea3dcf5 100644 --- a/domain/R2D2.java +++ b/domain/R2D2.java @@ -1,6 +1,6 @@ package domain; -public class R2D2 implements Robot{ +public class R2D2 extends RobotBasics { private int id; private String name; private boolean power; @@ -16,39 +16,4 @@ public class R2D2 implements Robot{ power = false; } - /** - * @see domain.RobotControl - */ - @Override - public int getId() { - return id; - } - - /** - * @see domain.RobotControl - */ - @Override - public String getName() { - return name; - } - - /** - * @see domain.RobotControl - */ - @Override - public void triggerPowerSwitch() { - if(power == false){ - power = true; - }else{ - power = false; - } - } - - /** - * @see domain.RobotControl - */ - @Override - public boolean isPowerOn() { - return power; - } }