From 039d9663f0d1ed3252e2871e8d658a94be84c75e Mon Sep 17 00:00:00 2001 From: magenoxx Date: Thu, 26 Jan 2012 00:38:45 +0400 Subject: [PATCH] ActionWithResult interface, ActionWithBooleanResult. --- .../src/mage/interfaces/ActionWithResult.java | 25 +++++++++++++++++++ .../mage/utils/ActionWithBooleanResult.java | 13 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Mage.Common/src/mage/interfaces/ActionWithResult.java create mode 100644 Mage.Common/src/mage/utils/ActionWithBooleanResult.java diff --git a/Mage.Common/src/mage/interfaces/ActionWithResult.java b/Mage.Common/src/mage/interfaces/ActionWithResult.java new file mode 100644 index 00000000000..d51a7213ad3 --- /dev/null +++ b/Mage.Common/src/mage/interfaces/ActionWithResult.java @@ -0,0 +1,25 @@ +package mage.interfaces; + +/** + * /** + * Light weight action interface + * For executing actions without any context. + * + * @param Type to return as a result of execution. + * + * @author noxx + */ +public interface ActionWithResult { + + /** + * Executes and returns result. + * @return + */ + public T execute(); + + /** + * Returns negative result specific for type . + * @return + */ + public T negativeResult(); +} diff --git a/Mage.Common/src/mage/utils/ActionWithBooleanResult.java b/Mage.Common/src/mage/utils/ActionWithBooleanResult.java new file mode 100644 index 00000000000..e0acfb23b2c --- /dev/null +++ b/Mage.Common/src/mage/utils/ActionWithBooleanResult.java @@ -0,0 +1,13 @@ +package mage.utils; + +import mage.interfaces.ActionWithResult; + +/** + * @author noxx + */ +public abstract class ActionWithBooleanResult implements ActionWithResult { + @Override + public Boolean negativeResult() { + return false; + } +}