Declaration
public Structure<TCell>(
IEnumerable<TCell> cells,
IEnumerable<Link<TCell>> links = null,
Func<TCell, IEnumerable<TCell>> getNeighbors = null
)Summary
Constructs a structure with the specified cells and links between them.
Parameters
| IEnumerable<TCell> | cells |
The set of cells the structure consists of; for example, Square.Rectangle(int, int, int, int) or
Hex.LargeHexagon(int, Hex). |
| IEnumerable<Link<TCell>> | links |
An explicit set of links (connections) between cells, defining which pairs of cells are neighbors. See
remarks. |
| Func<TCell, IEnumerable<TCell>> | getNeighbors |
A delegate that defines the neighbors of each cells. See remarks. |
Remarks
One of the following three must be true:
- links is specified and getNeighbors is
null. In this
case, the explicit set of links is used. - getNeighbors is specified and links is
null. In this
case, the delegate is called on every cell to discover all links. The delegate is allowed to return
additional cells that are not in cells; those will be discarded. - TCell implements INeighbor<TCell>, in which case the behavior is
the same as with getNeighbors but INeighbor<TCell>.Neighbors is used
to retrieve the neighbors.