aboutsummaryrefslogtreecommitdiff
path: root/test/ch/epfl/xblast/namecheck/NameCheck01.java
blob: 278d85b066f8a855826291f252456cdfefec121f (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package ch.epfl.xblast.namecheck;

import java.util.List;

import ch.epfl.xblast.Cell;
import ch.epfl.xblast.Direction;
import ch.epfl.xblast.SubCell;

/**
 * Classe abstraite utilisant tous les éléments de l'étape 1, pour essayer de
 * garantir que ceux-ci ont le bon nom et les bons types. Attention, ceci n'est
 * pas un test unitaire, et n'a pas pour but d'être exécuté!
 */

abstract class NameCheck01 {
    void checkDirection() {
        Direction d = Direction.N;
        d = Direction.E;
        d = Direction.S;
        d = Direction.W;
        if (d.isHorizontal() || d.isParallelTo(d))
            d = d.opposite();
    }

    void checkCell() {
        int c = Cell.COLUMNS;
        int r = Cell.ROWS;
        int t = Cell.COUNT;
        List<Cell> l = Cell.ROW_MAJOR_ORDER;
        l.get(c + r + t);
        l = Cell.SPIRAL_ORDER;
        l.get(c + r + t);
        Cell d = new Cell(c, r);
        c = d.x() + d.y() + d.rowMajorIndex();
        d = d.neighbor(Direction.N);
    }

    void checkSubCell() {
        SubCell c = SubCell.centralSubCellOf(new Cell(0,0));
        c = new SubCell(0, 0);
        int t = c.x() + c.y() + c.distanceToCentral();
        if (t < 10 && c.isCentral())
            c = c.neighbor(Direction.N);
        else {
            Cell cc = c.containingCell();
            System.out.println(cc);
        }
    }
}