mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
ActionWithResult interface, ActionWithBooleanResult.
This commit is contained in:
parent
b0a1c07067
commit
039d9663f0
2 changed files with 38 additions and 0 deletions
25
Mage.Common/src/mage/interfaces/ActionWithResult.java
Normal file
25
Mage.Common/src/mage/interfaces/ActionWithResult.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package mage.interfaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /**
|
||||||
|
* Light weight action interface
|
||||||
|
* For executing actions without any context.
|
||||||
|
*
|
||||||
|
* @param <T> Type to return as a result of execution.
|
||||||
|
*
|
||||||
|
* @author noxx
|
||||||
|
*/
|
||||||
|
public interface ActionWithResult<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes and returns result.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public T execute();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns negative result specific for type <T>.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public T negativeResult();
|
||||||
|
}
|
13
Mage.Common/src/mage/utils/ActionWithBooleanResult.java
Normal file
13
Mage.Common/src/mage/utils/ActionWithBooleanResult.java
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package mage.utils;
|
||||||
|
|
||||||
|
import mage.interfaces.ActionWithResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author noxx
|
||||||
|
*/
|
||||||
|
public abstract class ActionWithBooleanResult implements ActionWithResult<Boolean> {
|
||||||
|
@Override
|
||||||
|
public Boolean negativeResult() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue