public class DancingLinks<ColumnName>
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
DancingLinks.SolutionAcceptor<ColumnName> |
Applications should implement this to receive the solutions to their
problems.
|
| Constructor | Description |
|---|---|
DancingLinks() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addColumn(ColumnName name) |
Add a column to the table
|
void |
addColumn(ColumnName name,
boolean primary) |
Add a column to the table
|
void |
addRow(boolean[] values) |
Add a row to the table.
|
java.lang.String |
getColumnName(int index) |
Get the name of a given column as a string
|
int |
getNumberColumns() |
Get the number of columns.
|
int |
solve(int[] prefix,
DancingLinks.SolutionAcceptor<ColumnName> output) |
Given a prefix, find solutions under it.
|
int |
solve(DancingLinks.SolutionAcceptor<ColumnName> output) |
Solve a complete problem
|
java.util.List<int[]> |
split(int depth) |
Generate a list of row choices to cover the first moves.
|
public void addColumn(ColumnName name, boolean primary)
name - The name of the column, which will be returned as part of
solutionsprimary - Is the column required for a solution?public void addColumn(ColumnName name)
name - The name of the column, which will be included in the solutionpublic int getNumberColumns()
public java.lang.String getColumnName(int index)
index - the index of the columnpublic void addRow(boolean[] values)
values - the columns that are satisfied by this rowpublic java.util.List<int[]> split(int depth)
depth - the length of the prefixes to generatepublic int solve(int[] prefix,
DancingLinks.SolutionAcceptor<ColumnName> output)
prefix - a list of row choices that control which part of the search
tree to exploreoutput - the output for each solutionpublic int solve(DancingLinks.SolutionAcceptor<ColumnName> output)
output - the acceptor to receive answersCopyright © 2008–2025 Apache Software Foundation. All rights reserved.