mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- CheckStyle.
This commit is contained in:
@@ -14,24 +14,24 @@ import com.google.common.base.Function;
|
||||
public class Aggregates {
|
||||
|
||||
// Returns the value matching predicate conditions with the maximum value of whatever valueAccessor returns.
|
||||
public final static <T> Integer max(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
public static final <T> Integer max(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
if (source == null) { return null; }
|
||||
int max = Integer.MIN_VALUE;
|
||||
for (final T c : source) {
|
||||
int value = valueAccessor.apply(c);
|
||||
if ( value > max ) {
|
||||
if (value > max) {
|
||||
max = value;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
public final static <T> Integer min(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
public static final <T> Integer min(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
if (source == null) { return null; }
|
||||
int max = Integer.MAX_VALUE;
|
||||
for (final T c : source) {
|
||||
int value = valueAccessor.apply(c);
|
||||
if ( value < max ) {
|
||||
if (value < max) {
|
||||
max = value;
|
||||
}
|
||||
}
|
||||
@@ -39,13 +39,13 @@ public class Aggregates {
|
||||
}
|
||||
|
||||
|
||||
public final static <T> T itemWithMax(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
public static final <T> T itemWithMax(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
if (source == null) { return null; }
|
||||
int max = Integer.MIN_VALUE;
|
||||
T result = null;
|
||||
for (final T c : source) {
|
||||
int value = valueAccessor.apply(c);
|
||||
if ( value > max ) {
|
||||
if (value > max) {
|
||||
max = value;
|
||||
result = c;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class Aggregates {
|
||||
return result;
|
||||
}
|
||||
|
||||
public final static <T> int sum(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
public static final <T> int sum(final Iterable<T> source, final Function<T, Integer> valueAccessor) {
|
||||
int result = 0;
|
||||
if (source != null) {
|
||||
for (final T c : source) {
|
||||
@@ -72,7 +72,7 @@ public class Aggregates {
|
||||
* the source
|
||||
* @return the t
|
||||
*/
|
||||
public final static <T> T random(final Iterable<T> source) {
|
||||
public static final <T> T random(final Iterable<T> source) {
|
||||
int n = 0;
|
||||
T candidate = null;
|
||||
for (final T item : source) {
|
||||
@@ -85,7 +85,7 @@ public class Aggregates {
|
||||
|
||||
// Get several random values
|
||||
// should improve to make 1 pass over source and track N candidates at once
|
||||
public final static <T> List<T> random(final Iterable<T> source, final int count) {
|
||||
public static final <T> List<T> random(final Iterable<T> source, final int count) {
|
||||
final List<T> result = new ArrayList<T>();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final T toAdd = Aggregates.random(source);
|
||||
@@ -112,7 +112,7 @@ public class Aggregates {
|
||||
T result = null;
|
||||
for (final T c : source) {
|
||||
int value = valueAccessor.apply(c);
|
||||
if ( value < max ) {
|
||||
if (value < max) {
|
||||
max = value;
|
||||
result = c;
|
||||
}
|
||||
@@ -123,15 +123,19 @@ public class Aggregates {
|
||||
|
||||
public static <TItem, TField> TItem firstFieldEquals(List<TItem> source, Function<TItem, TField> valueAccessor, TField valueEquals) {
|
||||
if (source == null) { return null; }
|
||||
if( valueEquals == null ) {
|
||||
for (final TItem c : source)
|
||||
if ( null == valueAccessor.apply(c) )
|
||||
if (valueEquals == null) {
|
||||
for (final TItem c : source) {
|
||||
if (null == valueAccessor.apply(c)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (final TItem c : source)
|
||||
if ( valueEquals.equals(valueAccessor.apply(c)) )
|
||||
for (final TItem c : source) {
|
||||
if (valueEquals.equals(valueAccessor.apply(c))) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ import java.util.Set;
|
||||
* @version V0.0 19.08.2009
|
||||
* @see Properties
|
||||
*/
|
||||
public class TreeProperties /* implements Iterable<PropertyElement> */{
|
||||
public class TreeProperties /* implements Iterable<PropertyElement> */ {
|
||||
/** Constant <code>suffixes</code>. */
|
||||
private static final Map<String, PropertyType<?>> SUFFIXES;
|
||||
/** Constant <code>types</code>. */
|
||||
|
||||
@@ -255,8 +255,8 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
positionAllCards();
|
||||
}
|
||||
|
||||
private void positionAllCards()
|
||||
{
|
||||
private void positionAllCards() {
|
||||
|
||||
// Position all card panels.
|
||||
int x = 0;
|
||||
int y = PlayArea.GUTTER_Y;
|
||||
|
||||
Reference in New Issue
Block a user