Modifier and Type | Field and Description |
---|---|
static java.lang.Iterable<Line> |
ALL_LINES
The set of all valid lines
|
static int |
SIZE
The number of marks in a row required for victory.
|
Constructor and Description |
---|
Line(int r,
int c,
int dr,
int dc)
Create a line consisting of the locations (r,c), (r+dr, c+dc),
(r+2dr, c+2dc), ...
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int r,
int c)
Return true if the given location is in this line
|
java.util.Iterator<Location> |
iterator()
Iterate over the locations in this line
|
java.lang.String |
toString() |
public static final int SIZE
public static final java.lang.Iterable<Line> ALL_LINES
public Line(int r, int c, int dr, int dc) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if any of these locations are invalid.java.lang.IllegalArgumentException
- if (dr,dc) is (0,0) or |dr| > 1 or |dc| > 1public java.util.Iterator<Location> iterator()
iterator
in interface java.lang.Iterable<Location>
public boolean contains(int r, int c)
public java.lang.String toString()
toString
in class java.lang.Object