mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -14,7 +14,7 @@ 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) {
|
||||
@@ -26,7 +26,7 @@ public class Aggregates {
|
||||
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) {
|
||||
@@ -39,7 +39,7 @@ 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;
|
||||
@@ -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);
|
||||
@@ -124,14 +124,18 @@ 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) )
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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