mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Functional interfaces should be annotated as functional interfaces
This commit is contained in:
parent
f1ef3bf68b
commit
752392fc46
22 changed files with 28 additions and 10 deletions
|
@ -3,7 +3,7 @@ package mage.client.util;
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Command {
|
public interface Command {
|
||||||
|
|
||||||
void execute();
|
void execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.io.Serializable;
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
* @param <E>
|
* @param <E>
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Listener<E extends Event> extends Serializable {
|
public interface Listener<E extends Event> extends Serializable {
|
||||||
|
|
||||||
void event(E event);
|
void event(E event);
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class TextboxRule {
|
||||||
|
|
||||||
// An attributed region in the text, which can be applied to an
|
// An attributed region in the text, which can be applied to an
|
||||||
// attributed string.
|
// attributed string.
|
||||||
|
@FunctionalInterface
|
||||||
public interface AttributeRegion {
|
public interface AttributeRegion {
|
||||||
|
|
||||||
void applyToAttributedString(AttributedString str, Font normal, Font italic);
|
void applyToAttributedString(AttributedString str, Font normal, Font italic);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#Generated by Maven
|
#Generated by Maven
|
||||||
#Sun Feb 05 18:32:22 AEDT 2017
|
#Wed Feb 15 19:18:14 MSK 2017
|
||||||
version=1.4.21
|
version=1.4.21
|
||||||
groupId=org.mage
|
groupId=org.mage
|
||||||
artifactId=mage-game-canadianhighlanderduel
|
artifactId=mage-game-canadianhighlanderduel
|
||||||
|
|
|
@ -37,6 +37,8 @@ import mage.players.net.UserData;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@ -51,10 +53,7 @@ public class SessionManager {
|
||||||
|
|
||||||
private final ConcurrentHashMap<String, Session> sessions = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Session> sessions = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public Session getSession(String sessionId) {
|
public Session getSession(@Nonnull String sessionId) {
|
||||||
if (sessionId == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Session session = sessions.get(sessionId);
|
Session session = sessions.get(sessionId);
|
||||||
if (session != null && session.getUserId() != null && UserManager.getInstance().getUser(session.getUserId()) == null) {
|
if (session != null && session.getUserId() != null && UserManager.getInstance().getUser(session.getUserId()) == null) {
|
||||||
logger.error("User for session " + sessionId + " with userId " + session.getUserId() + " is missing. Session removed.");
|
logger.error("User for session " + sessionId + " with userId " + session.getUserId() + " is missing. Session removed.");
|
||||||
|
@ -209,11 +208,11 @@ public class SessionManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValidSession(String sessionId) {
|
public boolean isValidSession(@Nonnull String sessionId) {
|
||||||
return sessions.containsKey(sessionId);
|
return sessions.containsKey(sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<User> getUser(String sessionId) {
|
public Optional<User> getUser(@Nonnull String sessionId) {
|
||||||
Session session = sessions.get(sessionId);
|
Session session = sessions.get(sessionId);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
return UserManager.getInstance().getUser(sessions.get(sessionId).getUserId());
|
return UserManager.getInstance().getUser(sessions.get(sessionId).getUserId());
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.MageException;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface GameCallback {
|
public interface GameCallback {
|
||||||
|
|
||||||
void gameResult(String result) throws MageException;
|
void gameResult(String result) throws MageException;
|
||||||
|
|
|
@ -978,8 +978,8 @@ public class GameController implements GameCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
interface Command {
|
interface Command {
|
||||||
|
|
||||||
void execute(UUID player);
|
void execute(UUID player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ package mage.server.services;
|
||||||
*
|
*
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface FeedbackService {
|
public interface FeedbackService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,7 @@ package mage.server.services;
|
||||||
*
|
*
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface LogService {
|
public interface LogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,6 +35,7 @@ import java.util.UUID;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface MageItem extends Serializable {
|
public interface MageItem extends Serializable {
|
||||||
|
|
||||||
UUID getId();
|
UUID getId();
|
||||||
|
|
|
@ -10,6 +10,7 @@ import mage.game.Game;
|
||||||
*
|
*
|
||||||
* @author nantuko, noxx
|
* @author nantuko, noxx
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Condition extends Serializable {
|
public interface Condition extends Serializable {
|
||||||
|
|
||||||
public enum ComparisonType {
|
public enum ComparisonType {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/*
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -38,6 +39,7 @@ import mage.game.Game;
|
||||||
*
|
*
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface AdjustingSourceCosts {
|
public interface AdjustingSourceCosts {
|
||||||
void adjustCosts(Ability ability, Game game);
|
void adjustCosts(Ability ability, Game game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import mage.game.Game;
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface AlternateManaPaymentAbility {
|
public interface AlternateManaPaymentAbility {
|
||||||
/**
|
/**
|
||||||
* Adds the special action to the state, that allows the user to do the alternate mana payment
|
* Adds the special action to the state, that allows the user to do the alternate mana payment
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.io.Serializable;
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Builder<T> extends Serializable {
|
public interface Builder<T> extends Serializable {
|
||||||
|
|
||||||
T build(Object... options);
|
T build(Object... options);
|
||||||
|
|
|
@ -32,5 +32,6 @@ package mage.filter.predicate;
|
||||||
* @author North
|
* @author North
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface ObjectPlayerPredicate<T extends ObjectPlayer> extends Predicate<T> {
|
public interface ObjectPlayerPredicate<T extends ObjectPlayer> extends Predicate<T> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,5 +32,6 @@ package mage.filter.predicate;
|
||||||
* @author North
|
* @author North
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface ObjectSourcePlayerPredicate<T extends ObjectSourcePlayer> extends ObjectPlayerPredicate<T> {
|
public interface ObjectSourcePlayerPredicate<T extends ObjectSourcePlayer> extends ObjectPlayerPredicate<T> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import mage.game.Game;
|
||||||
* @author North
|
* @author North
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Predicate <T> extends Serializable {
|
public interface Predicate <T> extends Serializable {
|
||||||
/**
|
/**
|
||||||
* Returns the result of applying this predicate to {@code input}. This method is <i>generally
|
* Returns the result of applying this predicate to {@code input}. This method is <i>generally
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class Table implements Serializable {
|
||||||
private Tournament tournament;
|
private Tournament tournament;
|
||||||
private TableRecorder recorder;
|
private TableRecorder recorder;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
public interface TableRecorder {
|
public interface TableRecorder {
|
||||||
void record(Table table);
|
void record(Table table);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.io.Serializable;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Listener<E extends ExternalEvent> extends Serializable {
|
public interface Listener<E extends ExternalEvent> extends Serializable {
|
||||||
void event(E event);
|
void event(E event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.util;
|
package mage.util;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
@ -32,7 +32,7 @@ package mage.util;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Copyable<T> {
|
public interface Copyable<T> {
|
||||||
|
|
||||||
T copy();
|
T copy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ package mage.util.functions;
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface Function<X, Y> {
|
public interface Function<X, Y> {
|
||||||
X apply(Y in);
|
X apply(Y in);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue