Skip to content

Commit

Permalink
Remove the unnecessary 'public' keyword from interface methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicofisi authored and bensku committed Jul 5, 2018
1 parent 3e50ba7 commit 5670c1e
Show file tree
Hide file tree
Showing 29 changed files with 95 additions and 111 deletions.
13 changes: 6 additions & 7 deletions src/main/java/ch/njol/skript/classes/Arithmetic.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
*/
public interface Arithmetic<A, R> {

public R difference(A first, A second);
R difference(A first, A second);

public A add(A value, R difference);
A add(A value, R difference);

public A subtract(A value, R difference);
A subtract(A value, R difference);

public A multiply(A value, R multiplier);
A multiply(A value, R multiplier);

public A divide(A value, R divider);

public A power(A value, R exponent);
A divide(A value, R divider);

A power(A value, R exponent);
}
8 changes: 4 additions & 4 deletions src/main/java/ch/njol/skript/classes/Changer.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public interface Changer<T> {

public static enum ChangeMode {
enum ChangeMode {
ADD, SET, REMOVE, REMOVE_ALL, DELETE, RESET;
}

Expand All @@ -52,7 +52,7 @@ public static enum ChangeMode {
* mark them as supported.
*/
@Nullable
public abstract Class<?>[] acceptChange(ChangeMode mode);
Class<?>[] acceptChange(ChangeMode mode);

/**
* @param what The objects to change
Expand All @@ -61,9 +61,9 @@ public static enum ChangeMode {
* @param mode
* @throws UnsupportedOperationException (optional) if this method was called on an unsupported ChangeMode.
*/
public abstract void change(T[] what, @Nullable Object[] delta, ChangeMode mode);
void change(T[] what, @Nullable Object[] delta, ChangeMode mode);

public static abstract class ChangerUtils {
abstract class ChangerUtils {

@SuppressWarnings("unchecked")
public static <T, V> void change(final Changer<T> changer, final Object[] what, final @Nullable Object[] delta, final ChangeMode mode) {
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/ch/njol/skript/classes/Comparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface Comparator<T1, T2> {
/**
* represents a relation between two objects.
*/
public static enum Relation {
enum Relation {
EQUAL, NOT_EQUAL, GREATER, GREATER_OR_EQUAL, SMALLER, SMALLER_OR_EQUAL;

/**
Expand Down Expand Up @@ -195,7 +195,7 @@ public int getRelation() {
* @param <T1> see {@link Comparator}
* @param <T2> dito
*/
public static class ComparatorInfo<T1, T2> {
class ComparatorInfo<T1, T2> {

public Class<T1> c1;
public Class<T2> c2;
Expand Down Expand Up @@ -232,11 +232,10 @@ public boolean supportsOrdering() {
* @param o2 Non-null object
* @return the relation of the objects. Should neither return GREATER_OR_EQUAL nor SMALLER_OR_EQUAL.
*/
public Relation compare(T1 o1, T2 o2);
Relation compare(T1 o1, T2 o2);

/**
* @return whether this comparator supports ordering of elements or not.
*/
public boolean supportsOrdering();

boolean supportsOrdering();
}
14 changes: 7 additions & 7 deletions src/main/java/ch/njol/skript/classes/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
*/
public interface Converter<F, T> {

public final static int NO_LEFT_CHAINING = 1;
public final static int NO_RIGHT_CHAINING = 2;
public final static int NO_CHAINING = NO_LEFT_CHAINING | NO_RIGHT_CHAINING;
public final static int NO_COMMAND_ARGUMENTS = 4;
int NO_LEFT_CHAINING = 1;
int NO_RIGHT_CHAINING = 2;
int NO_CHAINING = NO_LEFT_CHAINING | NO_RIGHT_CHAINING;
int NO_COMMAND_ARGUMENTS = 4;

/**
* holds information about a converter
Expand All @@ -48,7 +48,7 @@ public interface Converter<F, T> {
*/
@SuppressWarnings("null")
@NonNullByDefault
public final static class ConverterInfo<F, T> {
final class ConverterInfo<F, T> {

public final Class<F> from;
public final Class<T> to;
Expand All @@ -71,9 +71,9 @@ public ConverterInfo(final Class<F> from, final Class<T> to, final Converter<F,
* @return the converted object
*/
@Nullable
public T convert(F f);
T convert(F f);

public final static class ConverterUtils {
final class ConverterUtils {

public static <F, T> Converter<?, T> createInstanceofConverter(final ConverterInfo<F, T> conv) {
return createInstanceofConverter(conv.from, conv.converter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
*/
public interface NodeValidator {

public boolean validate(Node node);

boolean validate(Node node);
}
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/doc/Description.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
@Documented
public @interface Description {

public String[] value();
String[] value();
}
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/doc/DocumentationId.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
@Documented
public @interface DocumentationId {

public String value();
String value();
}
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/doc/Examples.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
@Documented
public @interface Examples {

public String[] value();
String[] value();
}
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/doc/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
@Documented
public @interface Name {

public String value();
String value();
}
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/doc/Since.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
@Documented
public @interface Since {

public String value();
String value();
}
5 changes: 2 additions & 3 deletions src/main/java/ch/njol/skript/lang/Debuggable.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ public interface Debuggable {
* @param debug If true this should print more information, if false this should print what is shown to the end user
* @return String representation of this object
*/
public String toString(@Nullable Event e, boolean debug);
String toString(@Nullable Event e, boolean debug);

/**
* Should return <tt>{@link #toString(Event, boolean) toString}(null, false)</tt>
*/
@Override
public String toString();

String toString();
}
5 changes: 2 additions & 3 deletions src/main/java/ch/njol/skript/lang/DefaultExpression.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
*/
public interface DefaultExpression<T> extends Expression<T> {

public boolean init();
boolean init();

/**
* @return Usually true, though this is not required, as e.g. SimpleLiteral implements DefaultExpression but is usually not the default of an event.
*/
@Override
public boolean isDefault();

boolean isDefault();
}
36 changes: 18 additions & 18 deletions src/main/java/ch/njol/skript/lang/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @throws UnsupportedOperationException (optional) if this was called on a non-single expression
*/
@Nullable
public T getSingle(final Event e);
T getSingle(final Event e);

/**
* Get all the values of this expression. The returned array is empty if this expression doesn't have any values for the given event.
Expand All @@ -71,7 +71,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @param e The event
* @return An array of values of this expression which must neither be null nor contain nulls, and which must not be an internal array.
*/
public T[] getArray(final Event e);
T[] getArray(final Event e);

/**
* Gets all possible return values of this expression, i.e. it returns the same as {@link #getArray(Event)} if {@link #getAnd()} is true, otherwise all possible values for
Expand All @@ -80,12 +80,12 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @param e The event
* @return An array of all possible values of this expression for the given event which must neither be null nor contain nulls, and which must not be an internal array.
*/
public T[] getAll(final Event e);
T[] getAll(final Event e);

/**
* @return true if this expression will ever only return one value at most, false if it can return multiple values.
*/
public abstract boolean isSingle();
boolean isSingle();

/**
* Checks this expression against the given checker. This is the normal version of this method and the one which must be used for simple checks,
Expand All @@ -103,7 +103,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @return Whether this expression matches or doesn't match the given checker depending on the condition's negated state.
* @see SimpleExpression#check(Object[], Checker, boolean, boolean)
*/
public boolean check(final Event e, final Checker<? super T> c, final boolean negated);
boolean check(final Event e, final Checker<? super T> c, final boolean negated);

/**
* Checks this expression against the given checker. This method must only be used around other checks, use {@link #check(Event, Checker, boolean)} for a simple ckeck or the
Expand All @@ -114,7 +114,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @return Whether this expression matches the given checker
* @see SimpleExpression#check(Object[], Checker, boolean, boolean)
*/
public boolean check(final Event e, final Checker<? super T> c);
boolean check(final Event e, final Checker<? super T> c);

/**
* Tries to convert this expression to the given type. This method can print an error prior to returning null to specify the cause.
Expand All @@ -132,14 +132,14 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @see ConvertedExpression
*/
@Nullable
public <R> Expression<? extends R> getConvertedExpression(final Class<R>... to);
<R> Expression<? extends R> getConvertedExpression(final Class<R>... to);

/**
* Gets the return type of this expression.
*
* @return A supertype of any objects returned by {@link #getSingle(Event)} and the component type of any arrays returned by {@link #getArray(Event)}
*/
public abstract Class<? extends T> getReturnType();
Class<? extends T> getReturnType();

/**
* Returns true if this expression returns all possible values, false if it only returns some of them.
Expand All @@ -151,7 +151,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
*
* @return Whether this expression returns all values at once or only part of them.
*/
public boolean getAnd();
boolean getAnd();

/**
* Sets the time of this expression, i.e. whether the returned value represents this expression before or after the event.
Expand All @@ -169,13 +169,13 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @see SimpleExpression#setTime(int, Expression, Class...)
* @see ScriptLoader#isCurrentEvent(Class...)
*/
public boolean setTime(int time);
boolean setTime(int time);

/**
* @return The value passed to {@link #setTime(int)} or 0 if it was never changed.
* @see #setTime(int)
*/
public int getTime();
int getTime();

/**
* Returns whether this value represents the default value of its type for the event, i.e. it can be replaced with a call to event.getXyz() if one knows the event & value type.
Expand All @@ -184,7 +184,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
*
* @return Whether is is the return types' default expression
*/
public boolean isDefault();
boolean isDefault();

/**
* Returns the same as {@link #getArray(Event)} but as an iterator. This method should be overriden by expressions intended to be looped to increase performance.
Expand All @@ -193,7 +193,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @return An iterator to iterate over all values of this expression which may be empty and/or null, but must not return null elements.
*/
@Nullable
public Iterator<? extends T> iterator(Event e);
Iterator<? extends T> iterator(Event e);

/**
* Checks whether the given 'loop-...' expression should match this loop, e.g. loop-block matches any loops that loop through blocks and loop-argument matches an
Expand All @@ -204,7 +204,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @param s The entered string
* @return Whether this loop matches the given string
*/
public boolean isLoopOf(String s);
boolean isLoopOf(String s);

/**
* Returns the original expression that was parsed, i.e. without any conversions done.
Expand All @@ -213,7 +213,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
*
* @return The unconverted source expression of this expression or this expression itself if it was never converted.
*/
public Expression<?> getSource();
Expression<?> getSource();

/**
* Simplifies the expression, e.g. if it only contains literals the expression may be simplified to a literal, and wrapped expressions are unwrapped.
Expand All @@ -225,7 +225,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @return A reference to a simpler version of this expression. Can change this expression directly and return itself if applicable, i.e. no references to the expression before
* this method call should be kept!
*/
public Expression<? extends T> simplify();
Expression<? extends T> simplify();

/**
* Tests whether this expression supports the given mode, and if yes what type it expects the <code>delta</code> to be.
Expand All @@ -244,7 +244,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* mark them as supported.
*/
@Nullable
public Class<?>[] acceptChange(ChangeMode mode);
Class<?>[] acceptChange(ChangeMode mode);

/**
* Changes the expression's value by the given amount. This will only be called on supported modes and with the desired <code>delta</code> type as returned by
Expand All @@ -256,7 +256,7 @@ public interface Expression<T> extends SyntaxElement, Debuggable {
* @param mode
* @throws UnsupportedOperationException (optional) - If this method was called on an unsupported ChangeMode.
*/
public void change(Event e, final @Nullable Object[] delta, final ChangeMode mode);
void change(Event e, final @Nullable Object[] delta, final ChangeMode mode);

/**
* This method is called before this expression is set to another one.
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/ch/njol/skript/lang/Literal.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
*/
public interface Literal<T> extends Expression<T> {

public T[] getArray();
T[] getArray();

public T getSingle();
T getSingle();

@Override
@Nullable
public <R> Literal<? extends R> getConvertedExpression(Class<R>... to);

public T[] getAll();
<R> Literal<? extends R> getConvertedExpression(Class<R>... to);

T[] getAll();
}
6 changes: 3 additions & 3 deletions src/main/java/ch/njol/skript/lang/SyntaxElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public interface SyntaxElement {
* @return Whether this expression was initialised successfully. An error should be printed prior to returning false to specify the cause.
* @see ScriptLoader#isCurrentEvent(Class...)
*/
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult);

boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult);
/**
* Sets parser instance for this syntax element. Make sure to override this, if it is needed.
* If this method is not overridden, it does <b>nothing</b>, since not everything needs
Expand All @@ -55,7 +55,7 @@ public interface SyntaxElement {
* "pi" or "parserInstance", if it is needed. No getter should be written.
* @param pi Parser instance.
*/
public default void setParserInstance(ParserInstance pi) {
default void setParserInstance(ParserInstance pi) {

}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ch/njol/skript/lang/Testable.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@
*/
public interface Testable {

public boolean test(Event e);

boolean test(Event e);
}
Loading

0 comments on commit 5670c1e

Please sign in to comment.