Class Clues
- Namespace
- NonoSharp
- Assembly
- NonoSharp.dll
The clues of a line. Each Clue in Clues can be accessed by using the indexer. E.g.: Clue clueAtI = (Clues) clues[i].
public class Clues : ICloneable, IEnumerable<Clue>, IEnumerable
- Inheritance
-
Clues
- Implements
- Inherited Members
Constructors
Clues()
Creates an empty Clues instance.
public Clues()
Clues(List<Clue>)
Creates Clues instance, representing a collection of Clues from clues.
public Clues(List<Clue> clues)
Parameters
Clues(params int[])
Creates a Clues instance, representing a collection of Clues from numbers. Each
number in numbers is converted into a Clue with Clue.Number matching the number.
public Clues(params int[] numbers)
Parameters
numbersint[]The numbers to create clues from.
Properties
Count
The total number of Clue instances contained in this Clues instance.
public int Count { get; }
Property Value
FullyCompleted
Whether this line of Clues is fully completed (i.e. all clues are completed).
public bool FullyCompleted { get; }
Property Value
this[int]
Gets the Clue instance located at position index in this instance.
public Clue this[int index] { get; }
Parameters
indexintClue to get
Property Value
TotalCellsInClues
The total amount of filled cells these clues concern.
public int TotalCellsInClues { get; }
Property Value
Methods
Add(Clue)
Adds a Clue to this Clues instance. It is appended to the end.
public void Add(Clue clue)
Parameters
clueClueThe clue to add.
Clone()
Deep copies this Clues instance.
public object Clone()
Returns
- object
Deep copy of this instance
FromString(string)
Converts a string in a form like "X X X X", where each X is an integer, to a Clues instance. Each X is converted into a Clue with Clue.Number matching X.
public static Clues FromString(string str)
Parameters
strstringThe string to convert.
Returns
- Clues
A Clues instance as above.
Examples
The following code creates a Clues instance where the contained clues have 1, 2, 3 as their Number property
respectively, in the same ordering.
Clues instance = Clues.FromString("1 2 3");
Remarks
X must be non-negative. If constructing an empty Clues instance (one without any
filled cells in the line), 0 must be the only number in the string. 0 is only allowed to appear str
on its own, with no other numbers.
Exceptions
- FormatException
Thrown when any of the numbers is not a valid integer or is of an incorrect format in any other way
- OverflowException
Thrown when any of the numbers is not between MinValue and MaxValue.
- ArgumentException
Thrown when any parsed number X is negative or 0 appears in a string with other clues.
GetEnumerator()
Gets the Enumerator over the Clue instances contained in this instance.
public IEnumerator<Clue> GetEnumerator()
Returns
- IEnumerator<Clue>
Enumerator as above