From 3037087aa5365b61e88084312b355b50cfe0dd83 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 2 Sep 2022 15:42:18 +0200 Subject: [PATCH] =?UTF-8?q?Erstellen=20der=20ben=C3=B6tigten=20Klassen/Int?= =?UTF-8?q?erfaces=20-=20IAction=20-=20SimpleActivity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SimpleActivityStack/src/testat/IAction.java | 11 ++++ .../src/testat/SimpleActivity.java | 56 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 SimpleActivityStack/src/testat/IAction.java create mode 100644 SimpleActivityStack/src/testat/SimpleActivity.java diff --git a/SimpleActivityStack/src/testat/IAction.java b/SimpleActivityStack/src/testat/IAction.java new file mode 100644 index 0000000..19b0b64 --- /dev/null +++ b/SimpleActivityStack/src/testat/IAction.java @@ -0,0 +1,11 @@ +package testat; + +/** + * + * @author cm + * + * @param + */ +public interface IAction { + public void execute(E e); +} diff --git a/SimpleActivityStack/src/testat/SimpleActivity.java b/SimpleActivityStack/src/testat/SimpleActivity.java new file mode 100644 index 0000000..9fdc945 --- /dev/null +++ b/SimpleActivityStack/src/testat/SimpleActivity.java @@ -0,0 +1,56 @@ +package testat; + +/** + * + * @author cm + * + */ +public class SimpleActivity { + + private String desc; + private String name; + private boolean isActive; + + public SimpleActivity(String name, String desc, boolean activityState) { + this.name = name; + this.setDesc(desc); + this.setActive(activityState); + } + + public SimpleActivity(String name) { + this.name = name; + this.setActive(true); + } + + public void activate() { + this.setActive(true); + } + + public void destroy() { + System.out.println(this.name + " is destroyed"); + } + + public void passivate() { + this.setActive(false); + } + + public boolean isActive() { + return isActive; + } + + public void setActive(boolean isActive) { + this.isActive = isActive; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public String getName() { + return name; + } +}