From 21ea8aff1d3376769f993f440b8703bb39d956c5 Mon Sep 17 00:00:00 2001 From: CedricNew Date: Sat, 7 Jan 2023 00:44:04 +0100 Subject: [PATCH] Nexus 6 Singelton Klasse --- .idea/runConfigurations.xml | 10 ++++++++++ domain/Nexus6.java | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .idea/runConfigurations.xml create mode 100644 domain/Nexus6.java diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/domain/Nexus6.java b/domain/Nexus6.java new file mode 100644 index 0000000..576d047 --- /dev/null +++ b/domain/Nexus6.java @@ -0,0 +1,32 @@ +package domain; + +import utility.robot_exceptions.ExceptionStorage; +import utility.robot_exceptions.RobotException; +import utility.robot_exceptions.robotExceptions; + +public final class Nexus6 extends Robot { + + private static final Nexus6 INSTANCE = new Nexus6(); + + private Nexus6() { + super(1, "Nexus-6", "Nexus-6"); + } + + public static Nexus6 getInstance() { + return INSTANCE; + } + + @Override + public String speak(int[] numbers) throws RobotException { + RobotException e = new RobotException(robotExceptions.ILLEGALSTATE, getName()); + this.exceptions = new ExceptionStorage(e); + throw e; + } + + @Override + public int[] think(int[] numbers) throws RobotException { + RobotException e = new RobotException(robotExceptions.ILLEGALSTATE, getName()); + this.exceptions = new ExceptionStorage(e); + throw e; + } +}