summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/engine/PawnSet.java
blob: 0df2332c618bcd0f41ec56a0c28ff94876a123ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package ch.asynk.tankontank.engine;

import java.util.LinkedHashSet;

public class PawnSet extends LinkedHashSet<Pawn> implements Board.PawnCollection
{
    private final Board board;

    public PawnSet(Board board, int n)
    {
        super(n);
        this.board = board;
    }

    public Pawn first()
    {
        if (isEmpty()) return null;
        return iterator().next();
    }

    public void enable(int i, boolean enable)
    {
        for (Pawn pawn : this)
            pawn.enableOverlay(i, enable);
    }
}