Looking up the definition of a mixin I’ve come up with this.
Is this what you guys would call a mixin?
public class EntitySorter
{
private Mixin mixin;
public void sortGlobalCards(Card[] globalCards) {
mixin.loop(globalCards, true);
}
public void sortProcessedCards(Card[] toProcess) {
mixin.loop(toProcess, false);
}
protected static void sortGlobalCards(Card globalCard) {
}
protected static void sortProcessedCards(Card toProcess) {
}
private static final class Mixin
{
public void loop(Card[] cards, boolean isGlobalSet) {
for (int i = 0; i < cards.length; i++) {
if(isGlobalSet)
sortGlobalCards(cards[i]);
else
sortProcessedCards(cards[i]);
}
}
}
}