1 | package com.takenoko.shape; | |
2 | ||
3 | import com.takenoko.layers.tile.Tile; | |
4 | import com.takenoko.layers.tile.TileColor; | |
5 | import com.takenoko.vector.PositionVector; | |
6 | import java.util.List; | |
7 | import org.apache.commons.lang3.tuple.Pair; | |
8 | ||
9 | /** Build a mixed color Diamond pattern */ | |
10 | public class MixedColorsDiamond extends Pattern { | |
11 | ||
12 | public MixedColorsDiamond(TileColor tileColor) { | |
13 | super( | |
14 | switch (tileColor) { | |
15 | case PINK -> List.of( | |
16 | Pair.of(new PositionVector(0, 0, 0), new Tile(TileColor.PINK)), | |
17 | Pair.of(new PositionVector(1, 0, -1), new Tile(TileColor.YELLOW)), | |
18 | Pair.of(new PositionVector(0, 1, -1), new Tile(TileColor.PINK)), | |
19 | Pair.of(new PositionVector(-1, 1, 0), new Tile(TileColor.YELLOW))); | |
20 | case GREEN -> List.of( | |
21 | Pair.of(new PositionVector(0, 0, 0), new Tile(TileColor.GREEN)), | |
22 | Pair.of(new PositionVector(1, 0, -1), new Tile(TileColor.PINK)), | |
23 | Pair.of(new PositionVector(0, 1, -1), new Tile(TileColor.GREEN)), | |
24 | Pair.of(new PositionVector(-1, 1, 0), new Tile(TileColor.PINK))); | |
25 | case YELLOW -> List.of( | |
26 | Pair.of(new PositionVector(0, 0, 0), new Tile(TileColor.YELLOW)), | |
27 | Pair.of(new PositionVector(1, 0, -1), new Tile(TileColor.GREEN)), | |
28 | Pair.of(new PositionVector(0, 1, -1), new Tile(TileColor.YELLOW)), | |
29 | Pair.of(new PositionVector(-1, 1, 0), new Tile(TileColor.GREEN))); | |
30 | default -> throw new IllegalArgumentException("Unexpected value: " + tileColor); | |
31 | }); | |
32 | } | |
33 | ||
34 | @Override | |
35 | public String toString() { | |
36 |
1
1. toString : replaced return value with "" for com/takenoko/shape/MixedColorsDiamond::toString → TIMED_OUT |
return "MixedColorsDiamond{" + this.getColorsString() + "}"; |
37 | } | |
38 | } | |
Mutations | ||
36 |
1.1 |