Skip to content

Commit c6d8e52

Browse files
Merge pull request #99 from lifebeyondfife/constrained-array
chore(types): make constrained array internals immutable
2 parents a76f894 + ad6d29e commit c6d8e52

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

Csp/Csp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<PackageDescription>An Open Source .Net Constraint Programming Solver</PackageDescription>
1313
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1414
<RepositoryUrl>https://github.com/lifebeyondfife/Decider</RepositoryUrl>
15-
<Version>2.2.0</Version>
15+
<Version>2.2.1</Version>
1616
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
1717
<Deterministic>true</Deterministic>
1818
</PropertyGroup>

Csp/Integer/ConstrainedArray.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
/*
2-
Copyright © Iain McDonald 2010-2024
2+
Copyright © Iain McDonald 2010-2026
33
44
This file is part of Decider.
55
*/
6+
using System.Collections.ObjectModel;
67
using Decider.Csp.Integer;
78
using System.Collections.Generic;
89
using System.Linq;
910

1011
namespace Decider.Csp.BaseTypes
1112
{
12-
public class ConstrainedArray : List<int>
13+
public class ConstrainedArray : ReadOnlyCollection<int>
1314
{
1415
private VariableInteger Index { get; set; }
1516

@@ -24,8 +25,8 @@ public MetaExpressionInteger this[VariableInteger index]
2425
}
2526

2627
public ConstrainedArray(IEnumerable<int> elements)
28+
: base(elements.ToList())
2729
{
28-
this.AddRange(elements);
2930
}
3031

3132
private VariableInteger GetVariableInteger()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,4 @@ Released under the MIT licence, Decider is freely available for commercial use.
192192
Author
193193
------
194194

195-
I have a PhD in Constraint Programming and love turning NP-complete problems into CSPs. Visit my blog at http://lifebeyondfife.com/.
195+
I have a PhD in Constraint Programming and love turning NP-complete problems into CSPs. Visit my blog at https://lifebeyondfife.com/.

0 commit comments

Comments
 (0)