ConstraintSolver 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/ConstraintSolver +24 -0
- data/doc/classes/Array.html +209 -0
- data/doc/classes/ConstraintSolver.html +242 -0
- data/doc/classes/ConstraintSolver/AbstractConstraint.html +317 -0
- data/doc/classes/ConstraintSolver/AllDifferentConstraint.html +451 -0
- data/doc/classes/ConstraintSolver/AllDifferentConstraintTest.html +397 -0
- data/doc/classes/ConstraintSolver/BinaryConstraint.html +483 -0
- data/doc/classes/ConstraintSolver/BinaryConstraintTest.html +367 -0
- data/doc/classes/ConstraintSolver/BinaryRelation.html +276 -0
- data/doc/classes/ConstraintSolver/BinaryRelationTest.html +194 -0
- data/doc/classes/ConstraintSolver/ConstraintList.html +208 -0
- data/doc/classes/ConstraintSolver/ConstraintListTest.html +252 -0
- data/doc/classes/ConstraintSolver/ConstraintSolver.html +353 -0
- data/doc/classes/ConstraintSolver/ConstraintSolverTest.html +403 -0
- data/doc/classes/ConstraintSolver/Domain.html +522 -0
- data/doc/classes/ConstraintSolver/DomainTest.html +356 -0
- data/doc/classes/ConstraintSolver/DomainWipeoutException.html +158 -0
- data/doc/classes/ConstraintSolver/Problem.html +239 -0
- data/doc/classes/ConstraintSolver/ProblemTest.html +227 -0
- data/doc/classes/ConstraintSolver/Solution.html +342 -0
- data/doc/classes/ConstraintSolver/SolutionTest.html +250 -0
- data/doc/classes/ConstraintSolver/UndoStackEmptyException.html +158 -0
- data/doc/classes/ConstraintSolver/Variable.html +418 -0
- data/doc/classes/ConstraintSolver/VariableTest.html +284 -0
- data/doc/classes/ExtensionsTest.html +233 -0
- data/doc/classes/Fixnum.html +153 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +38 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +392 -0
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_10.dot +392 -0
- data/doc/dot/f_10.png +0 -0
- data/doc/dot/f_11.dot +38 -0
- data/doc/dot/f_11.png +0 -0
- data/doc/dot/f_12.dot +392 -0
- data/doc/dot/f_12.png +0 -0
- data/doc/dot/f_13.dot +392 -0
- data/doc/dot/f_13.png +0 -0
- data/doc/dot/f_14.dot +392 -0
- data/doc/dot/f_14.png +0 -0
- data/doc/dot/f_15.dot +392 -0
- data/doc/dot/f_15.png +0 -0
- data/doc/dot/f_16.dot +392 -0
- data/doc/dot/f_16.png +0 -0
- data/doc/dot/f_17.dot +392 -0
- data/doc/dot/f_17.png +0 -0
- data/doc/dot/f_18.dot +392 -0
- data/doc/dot/f_18.png +0 -0
- data/doc/dot/f_19.dot +392 -0
- data/doc/dot/f_19.png +0 -0
- data/doc/dot/f_2.dot +392 -0
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/f_3.dot +392 -0
- data/doc/dot/f_3.png +0 -0
- data/doc/dot/f_4.dot +392 -0
- data/doc/dot/f_4.png +0 -0
- data/doc/dot/f_5.dot +392 -0
- data/doc/dot/f_5.png +0 -0
- data/doc/dot/f_6.dot +14 -0
- data/doc/dot/f_6.png +0 -0
- data/doc/dot/f_7.dot +392 -0
- data/doc/dot/f_7.png +0 -0
- data/doc/dot/f_8.dot +392 -0
- data/doc/dot/f_8.png +0 -0
- data/doc/dot/f_9.dot +392 -0
- data/doc/dot/f_9.png +0 -0
- data/doc/dot/m_10_0.dot +392 -0
- data/doc/dot/m_10_0.png +0 -0
- data/doc/dot/m_12_0.dot +392 -0
- data/doc/dot/m_12_0.png +0 -0
- data/doc/dot/m_13_0.dot +392 -0
- data/doc/dot/m_13_0.png +0 -0
- data/doc/dot/m_14_0.dot +392 -0
- data/doc/dot/m_14_0.png +0 -0
- data/doc/dot/m_15_0.dot +392 -0
- data/doc/dot/m_15_0.png +0 -0
- data/doc/dot/m_16_0.dot +392 -0
- data/doc/dot/m_16_0.png +0 -0
- data/doc/dot/m_17_0.dot +392 -0
- data/doc/dot/m_17_0.png +0 -0
- data/doc/dot/m_18_0.dot +392 -0
- data/doc/dot/m_18_0.png +0 -0
- data/doc/dot/m_19_0.dot +392 -0
- data/doc/dot/m_19_0.png +0 -0
- data/doc/dot/m_1_0.dot +392 -0
- data/doc/dot/m_1_0.png +0 -0
- data/doc/dot/m_2_0.dot +392 -0
- data/doc/dot/m_2_0.png +0 -0
- data/doc/dot/m_3_0.dot +392 -0
- data/doc/dot/m_3_0.png +0 -0
- data/doc/dot/m_4_0.dot +392 -0
- data/doc/dot/m_4_0.png +0 -0
- data/doc/dot/m_5_0.dot +392 -0
- data/doc/dot/m_5_0.png +0 -0
- data/doc/dot/m_7_0.dot +392 -0
- data/doc/dot/m_7_0.png +0 -0
- data/doc/dot/m_8_0.dot +392 -0
- data/doc/dot/m_8_0.png +0 -0
- data/doc/dot/m_9_0.dot +392 -0
- data/doc/dot/m_9_0.png +0 -0
- data/doc/files/lib/AbstractConstraint_rb.html +148 -0
- data/doc/files/lib/AllDifferentConstraint_rb.html +156 -0
- data/doc/files/lib/BinaryConstraint_rb.html +155 -0
- data/doc/files/lib/ConstraintList_rb.html +148 -0
- data/doc/files/lib/ConstraintSolver_rb.html +162 -0
- data/doc/files/lib/Domain_rb.html +155 -0
- data/doc/files/lib/Problem_rb.html +148 -0
- data/doc/files/lib/Solution_rb.html +148 -0
- data/doc/files/lib/Variable_rb.html +148 -0
- data/doc/files/lib/extensions_rb.html +108 -0
- data/doc/files/test/AllDifferentConstraintTest_rb.html +158 -0
- data/doc/files/test/BinaryConstraintTest_rb.html +158 -0
- data/doc/files/test/ConstraintListTest_rb.html +160 -0
- data/doc/files/test/ConstraintSolverTest_rb.html +164 -0
- data/doc/files/test/DomainTest_rb.html +156 -0
- data/doc/files/test/ProblemTest_rb.html +160 -0
- data/doc/files/test/SolutionTest_rb.html +159 -0
- data/doc/files/test/TestSuite_rb.html +113 -0
- data/doc/files/test/VariableTest_rb.html +157 -0
- data/doc/files/test/extensionsTest_rb.html +118 -0
- data/doc/fr_class_index.html +51 -0
- data/doc/fr_file_index.html +46 -0
- data/doc/fr_method_index.html +133 -0
- data/doc/index.html +24 -0
- data/examples/example.rb +7 -0
- data/examples/queens.rb +13 -0
- data/examples/soft.rb +14 -0
- data/lib/AbstractConstraint.rb +45 -0
- data/lib/AllDifferentConstraint.rb +160 -0
- data/lib/BinaryConstraint.rb +187 -0
- data/lib/ConstraintList.rb +31 -0
- data/lib/ConstraintSolver.rb +213 -0
- data/lib/Domain.rb +100 -0
- data/lib/GraphUtils.rb +293 -0
- data/lib/OneOfEqualsConstraint.rb +81 -0
- data/lib/Problem.rb +30 -0
- data/lib/Solution.rb +56 -0
- data/lib/TupleConstraint.rb +111 -0
- data/lib/Variable.rb +74 -0
- data/lib/extensions.rb +55 -0
- data/test/AllDifferentConstraintTest.rb +140 -0
- data/test/BinaryConstraintTest.rb +108 -0
- data/test/ConstraintListTest.rb +41 -0
- data/test/ConstraintSolverTest.rb +274 -0
- data/test/DomainTest.rb +83 -0
- data/test/GraphUtilsTest.rb +83 -0
- data/test/OneOfEqualsConstraintTest.rb +82 -0
- data/test/ProblemTest.rb +35 -0
- data/test/SolutionTest.rb +35 -0
- data/test/TestSuite.rb +10 -0
- data/test/TupleConstraintTest.rb +151 -0
- data/test/VariableTest.rb +47 -0
- data/test/extensionsTest.rb +57 -0
- metadata +212 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: ConstraintSolver::Domain</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">ConstraintSolver::Domain</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/Domain_rb.html">
|
|
59
|
+
lib/Domain.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
Object
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
<!-- banner header -->
|
|
74
|
+
|
|
75
|
+
<div id="bodyContent">
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<div id="contextContent">
|
|
80
|
+
<div id="diagram">
|
|
81
|
+
<map id="map" name="map">
|
|
82
|
+
<area shape="rect" coords="1537,5,1665,53" href="../Test/Unit/TestCase.html" alt="Test::Unit::TestCase" />
|
|
83
|
+
<area shape="rect" coords="937,133,1089,181" href="AllDifferentConstraintTest.html" alt="AllDifferentConstraintTest" />
|
|
84
|
+
<area shape="rect" coords="2305,133,2396,181" href="SolutionTest.html" alt="SolutionTest" />
|
|
85
|
+
<area shape="rect" coords="204,133,335,181" href="ConstraintSolverTest.html" alt="ConstraintSolverTest" />
|
|
86
|
+
<area shape="rect" coords="1923,133,2040,181" href="ConstraintListTest.html" alt="ConstraintListTest" />
|
|
87
|
+
<area shape="rect" coords="1123,133,1213,181" href="VariableTest.html" alt="VariableTest" />
|
|
88
|
+
<area shape="rect" coords="2429,133,2517,181" href="DomainTest.html" alt="DomainTest" />
|
|
89
|
+
<area shape="rect" coords="1387,133,1517,181" href="BinaryConstraintTest.html" alt="BinaryConstraintTest" />
|
|
90
|
+
<area shape="rect" coords="1797,133,1888,181" href="ProblemTest.html" alt="ProblemTest" />
|
|
91
|
+
<area shape="rect" coords="1541,133,1661,181" href="BinaryRelationTest.html" alt="BinaryRelationTest" />
|
|
92
|
+
<area shape="rect" coords="589,5,667,53" href="../Exception.html" alt="Exception" />
|
|
93
|
+
<area shape="rect" coords="463,133,615,181" href="DomainWipeoutException.html" alt="DomainWipeoutException" />
|
|
94
|
+
<area shape="rect" coords="639,133,799,181" href="UndoStackEmptyException.html" alt="UndoStackEmptyException" />
|
|
95
|
+
<area shape="rect" coords="53,133,171,181" href="AbstractConstraint.html" alt="AbstractConstraint" />
|
|
96
|
+
<area shape="rect" coords="160,237,269,285" href="BinaryConstraint.html" alt="BinaryConstraint" />
|
|
97
|
+
<area shape="rect" coords="301,237,432,285" href="AllDifferentConstraint.html" alt="AllDifferentConstraint" />
|
|
98
|
+
<area shape="rect" coords="2085,5,2157,53" href="../Array.html" alt="Array" />
|
|
99
|
+
<area shape="rect" coords="2073,133,2169,181" href="ConstraintList.html" alt="ConstraintList" />
|
|
100
|
+
<area shape="rect" coords="37,237,136,285" href="BinaryRelation.html" alt="BinaryRelation" />
|
|
101
|
+
<area shape="rect" coords="2201,133,2273,181" href="Variable.html" alt="Variable" />
|
|
102
|
+
<area shape="rect" coords="1693,133,1765,181" href="Solution.html" alt="Solution" />
|
|
103
|
+
<area shape="rect" coords="1245,133,1355,181" href="ConstraintSolver.html" alt="ConstraintSolver" />
|
|
104
|
+
<area shape="rect" coords="831,133,903,181" href="Problem.html" alt="Problem" />
|
|
105
|
+
<area shape="rect" coords="367,133,439,181" href="Domain.html" alt="Domain" />
|
|
106
|
+
<area shape="rect" coords="2419,99,2531,192" href="../ConstraintSolver.html" alt="test/DomainTest.rb" />
|
|
107
|
+
<area shape="rect" coords="2295,99,2408,192" href="../ConstraintSolver.html" alt="test/SolutionTest.rb" />
|
|
108
|
+
<area shape="rect" coords="27,203,280,296" href="../ConstraintSolver.html" alt="lib/BinaryConstraint.rb" />
|
|
109
|
+
<area shape="rect" coords="2191,99,2284,192" href="../ConstraintSolver.html" alt="lib/Variable.rb" />
|
|
110
|
+
<area shape="rect" coords="1912,99,2052,192" href="../ConstraintSolver.html" alt="test/ConstraintListTest.rb" />
|
|
111
|
+
<area shape="rect" coords="2063,99,2180,192" href="../ConstraintSolver.html" alt="lib/ConstraintList.rb" />
|
|
112
|
+
<area shape="rect" coords="1787,99,1901,192" href="../ConstraintSolver.html" alt="test/ProblemTest.rb" />
|
|
113
|
+
<area shape="rect" coords="1683,99,1776,192" href="../ConstraintSolver.html" alt="lib/Solution.rb" />
|
|
114
|
+
<area shape="rect" coords="1376,99,1672,192" href="../ConstraintSolver.html" alt="test/BinaryConstraintTest.rb" />
|
|
115
|
+
<area shape="rect" coords="1235,99,1365,192" href="../ConstraintSolver.html" alt="lib/ConstraintSolver.rb" />
|
|
116
|
+
<area shape="rect" coords="1111,99,1224,192" href="../ConstraintSolver.html" alt="test/VariableTest.rb" />
|
|
117
|
+
<area shape="rect" coords="924,99,1100,192" href="../ConstraintSolver.html" alt="test/AllDifferentConstraintTest.rb" />
|
|
118
|
+
<area shape="rect" coords="291,203,443,296" href="../ConstraintSolver.html" alt="lib/AllDifferentConstraint.rb" />
|
|
119
|
+
<area shape="rect" coords="820,99,913,192" href="../ConstraintSolver.html" alt="lib/Problem.rb" />
|
|
120
|
+
<area shape="rect" coords="192,99,345,192" href="../ConstraintSolver.html" alt="test/ConstraintSolverTest.rb" />
|
|
121
|
+
<area shape="rect" coords="356,99,809,192" href="../ConstraintSolver.html" alt="lib/Domain.rb" />
|
|
122
|
+
<area shape="rect" coords="43,99,181,192" href="../ConstraintSolver.html" alt="lib/AbstractConstraint.rb" />
|
|
123
|
+
<area shape="rect" coords="16,64,2541,307" href="../ConstraintSolver.html" alt="ConstraintSolver" />
|
|
124
|
+
</map>
|
|
125
|
+
<img src="../../dot/m_19_0.png" usemap="#map" border="0" alt="dot/m_19_0.png">
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<div id="description">
|
|
129
|
+
<p>
|
|
130
|
+
This class represents the domain of a variable, i.e. a set of values that
|
|
131
|
+
can be assigned to the variable.
|
|
132
|
+
</p>
|
|
133
|
+
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div id="method-list">
|
|
140
|
+
<h3 class="section-bar">Methods</h3>
|
|
141
|
+
|
|
142
|
+
<div class="name-list">
|
|
143
|
+
<a href="#M000049"><<</a>
|
|
144
|
+
<a href="#M000059">==</a>
|
|
145
|
+
<a href="#M000053">collect</a>
|
|
146
|
+
<a href="#M000050">delete</a>
|
|
147
|
+
<a href="#M000051">each</a>
|
|
148
|
+
<a href="#M000054">empty?</a>
|
|
149
|
+
<a href="#M000057">include?</a>
|
|
150
|
+
<a href="#M000048">new</a>
|
|
151
|
+
<a href="#M000055">prune</a>
|
|
152
|
+
<a href="#M000052">sort</a>
|
|
153
|
+
<a href="#M000058">to_s</a>
|
|
154
|
+
<a href="#M000056">undoPruning</a>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<!-- if includes -->
|
|
162
|
+
|
|
163
|
+
<div id="section">
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
<div id="attribute-list">
|
|
170
|
+
<h3 class="section-bar">Attributes</h3>
|
|
171
|
+
|
|
172
|
+
<div class="name-list">
|
|
173
|
+
<table>
|
|
174
|
+
<tr class="top-aligned-row context-row">
|
|
175
|
+
<td class="context-item-name">undoStack</td>
|
|
176
|
+
<td class="context-item-value"> [R] </td>
|
|
177
|
+
<td class="context-item-desc"></td>
|
|
178
|
+
</tr>
|
|
179
|
+
<tr class="top-aligned-row context-row">
|
|
180
|
+
<td class="context-item-name">values</td>
|
|
181
|
+
<td class="context-item-value"> [R] </td>
|
|
182
|
+
<td class="context-item-desc"></td>
|
|
183
|
+
</tr>
|
|
184
|
+
</table>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<!-- if method_list -->
|
|
191
|
+
<div id="methods">
|
|
192
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
193
|
+
|
|
194
|
+
<div id="method-M000048" class="method-detail">
|
|
195
|
+
<a name="M000048"></a>
|
|
196
|
+
|
|
197
|
+
<div class="method-heading">
|
|
198
|
+
<a href="#M000048" class="method-signature">
|
|
199
|
+
<span class="method-name">new</span><span class="method-args">(values=nil)</span>
|
|
200
|
+
</a>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<div class="method-description">
|
|
204
|
+
<p>
|
|
205
|
+
Initialises a <a href="Domain.html#M000048">new</a> domain. Optionally, a
|
|
206
|
+
set of initial values can be given.
|
|
207
|
+
</p>
|
|
208
|
+
<p><a class="source-toggle" href="#"
|
|
209
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
|
210
|
+
<div class="method-source-code" id="M000048-source">
|
|
211
|
+
<pre>
|
|
212
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 12</span>
|
|
213
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">values</span>=<span class="ruby-keyword kw">nil</span>)
|
|
214
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> (<span class="ruby-identifier">values</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Set</span>))
|
|
215
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Values must be a set!"</span>
|
|
216
|
+
<span class="ruby-keyword kw">end</span>
|
|
217
|
+
<span class="ruby-ivar">@values</span> = <span class="ruby-identifier">values</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">values</span>
|
|
218
|
+
<span class="ruby-ivar">@undoStack</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
219
|
+
<span class="ruby-keyword kw">end</span>
|
|
220
|
+
</pre>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
226
|
+
|
|
227
|
+
<div id="method-M000049" class="method-detail">
|
|
228
|
+
<a name="M000049"></a>
|
|
229
|
+
|
|
230
|
+
<div class="method-heading">
|
|
231
|
+
<a href="#M000049" class="method-signature">
|
|
232
|
+
<span class="method-name"><<</span><span class="method-args">(value)</span>
|
|
233
|
+
</a>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<div class="method-description">
|
|
237
|
+
<p>
|
|
238
|
+
Adds value to the domain.
|
|
239
|
+
</p>
|
|
240
|
+
<p><a class="source-toggle" href="#"
|
|
241
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
|
242
|
+
<div class="method-source-code" id="M000049-source">
|
|
243
|
+
<pre>
|
|
244
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 21</span>
|
|
245
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">value</span>)
|
|
246
|
+
<span class="ruby-ivar">@values</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">value</span>
|
|
247
|
+
<span class="ruby-keyword kw">end</span>
|
|
248
|
+
</pre>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<div id="method-M000059" class="method-detail">
|
|
254
|
+
<a name="M000059"></a>
|
|
255
|
+
|
|
256
|
+
<div class="method-heading">
|
|
257
|
+
<a href="#M000059" class="method-signature">
|
|
258
|
+
<span class="method-name">==</span><span class="method-args">(domain)</span>
|
|
259
|
+
</a>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div class="method-description">
|
|
263
|
+
<p><a class="source-toggle" href="#"
|
|
264
|
+
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
|
265
|
+
<div class="method-source-code" id="M000059-source">
|
|
266
|
+
<pre>
|
|
267
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 81</span>
|
|
268
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">domain</span>)
|
|
269
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Domain</span>)
|
|
270
|
+
(<span class="ruby-ivar">@values</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">values</span>) <span class="ruby-keyword kw">and</span> (<span class="ruby-ivar">@undoStack</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">undoStack</span>)
|
|
271
|
+
<span class="ruby-keyword kw">end</span>
|
|
272
|
+
</pre>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div id="method-M000053" class="method-detail">
|
|
278
|
+
<a name="M000053"></a>
|
|
279
|
+
|
|
280
|
+
<div class="method-heading">
|
|
281
|
+
<a href="#M000053" class="method-signature">
|
|
282
|
+
<span class="method-name">collect</span><span class="method-args">(&block)</span>
|
|
283
|
+
</a>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<div class="method-description">
|
|
287
|
+
<p><a class="source-toggle" href="#"
|
|
288
|
+
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
|
|
289
|
+
<div class="method-source-code" id="M000053-source">
|
|
290
|
+
<pre>
|
|
291
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 40</span>
|
|
292
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">collect</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
293
|
+
<span class="ruby-identifier">values</span>.<span class="ruby-identifier">collect</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
294
|
+
<span class="ruby-keyword kw">end</span>
|
|
295
|
+
</pre>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<div id="method-M000050" class="method-detail">
|
|
301
|
+
<a name="M000050"></a>
|
|
302
|
+
|
|
303
|
+
<div class="method-heading">
|
|
304
|
+
<a href="#M000050" class="method-signature">
|
|
305
|
+
<span class="method-name">delete</span><span class="method-args">(value)</span>
|
|
306
|
+
</a>
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
<div class="method-description">
|
|
310
|
+
<p>
|
|
311
|
+
Deletes value from the domain.
|
|
312
|
+
</p>
|
|
313
|
+
<p><a class="source-toggle" href="#"
|
|
314
|
+
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
|
|
315
|
+
<div class="method-source-code" id="M000050-source">
|
|
316
|
+
<pre>
|
|
317
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 26</span>
|
|
318
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">value</span>)
|
|
319
|
+
<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">value</span>)
|
|
320
|
+
<span class="ruby-keyword kw">end</span>
|
|
321
|
+
</pre>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
|
|
326
|
+
<div id="method-M000051" class="method-detail">
|
|
327
|
+
<a name="M000051"></a>
|
|
328
|
+
|
|
329
|
+
<div class="method-heading">
|
|
330
|
+
<a href="#M000051" class="method-signature">
|
|
331
|
+
<span class="method-name">each</span><span class="method-args">() {|value| ...}</span>
|
|
332
|
+
</a>
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
<div class="method-description">
|
|
336
|
+
<p><a class="source-toggle" href="#"
|
|
337
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
|
338
|
+
<div class="method-source-code" id="M000051-source">
|
|
339
|
+
<pre>
|
|
340
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 30</span>
|
|
341
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
|
|
342
|
+
<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
|
343
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">value</span>
|
|
344
|
+
}
|
|
345
|
+
<span class="ruby-keyword kw">end</span>
|
|
346
|
+
</pre>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
|
|
351
|
+
<div id="method-M000054" class="method-detail">
|
|
352
|
+
<a name="M000054"></a>
|
|
353
|
+
|
|
354
|
+
<div class="method-heading">
|
|
355
|
+
<a href="#M000054" class="method-signature">
|
|
356
|
+
<span class="method-name">empty?</span><span class="method-args">()</span>
|
|
357
|
+
</a>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
<div class="method-description">
|
|
361
|
+
<p><a class="source-toggle" href="#"
|
|
362
|
+
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
|
|
363
|
+
<div class="method-source-code" id="M000054-source">
|
|
364
|
+
<pre>
|
|
365
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 44</span>
|
|
366
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty?</span>
|
|
367
|
+
<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">empty?</span>
|
|
368
|
+
<span class="ruby-keyword kw">end</span>
|
|
369
|
+
</pre>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
<div id="method-M000057" class="method-detail">
|
|
375
|
+
<a name="M000057"></a>
|
|
376
|
+
|
|
377
|
+
<div class="method-heading">
|
|
378
|
+
<a href="#M000057" class="method-signature">
|
|
379
|
+
<span class="method-name">include?</span><span class="method-args">(value)</span>
|
|
380
|
+
</a>
|
|
381
|
+
</div>
|
|
382
|
+
|
|
383
|
+
<div class="method-description">
|
|
384
|
+
<p><a class="source-toggle" href="#"
|
|
385
|
+
onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
|
|
386
|
+
<div class="method-source-code" id="M000057-source">
|
|
387
|
+
<pre>
|
|
388
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 73</span>
|
|
389
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include?</span>(<span class="ruby-identifier">value</span>)
|
|
390
|
+
<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">value</span>)
|
|
391
|
+
<span class="ruby-keyword kw">end</span>
|
|
392
|
+
</pre>
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
<div id="method-M000055" class="method-detail">
|
|
398
|
+
<a name="M000055"></a>
|
|
399
|
+
|
|
400
|
+
<div class="method-heading">
|
|
401
|
+
<a href="#M000055" class="method-signature">
|
|
402
|
+
<span class="method-name">prune</span><span class="method-args">(values)</span>
|
|
403
|
+
</a>
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
<div class="method-description">
|
|
407
|
+
<p>
|
|
408
|
+
Prunes the values from the domain.
|
|
409
|
+
</p>
|
|
410
|
+
<p><a class="source-toggle" href="#"
|
|
411
|
+
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
|
412
|
+
<div class="method-source-code" id="M000055-source">
|
|
413
|
+
<pre>
|
|
414
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 49</span>
|
|
415
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prune</span>(<span class="ruby-identifier">values</span>)
|
|
416
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Set</span>)
|
|
417
|
+
<span class="ruby-identifier">values</span> = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">values</span> ])
|
|
418
|
+
<span class="ruby-keyword kw">end</span>
|
|
419
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">empty?</span>
|
|
420
|
+
<span class="ruby-keyword kw">return</span>
|
|
421
|
+
<span class="ruby-keyword kw">end</span>
|
|
422
|
+
<span class="ruby-ivar">@undoStack</span>.<span class="ruby-identifier">push</span>(<span class="ruby-ivar">@values</span>)
|
|
423
|
+
<span class="ruby-ivar">@values</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">values</span>
|
|
424
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">empty?</span>
|
|
425
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">undoPruning</span>
|
|
426
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">DomainWipeoutException</span>
|
|
427
|
+
<span class="ruby-keyword kw">end</span>
|
|
428
|
+
<span class="ruby-keyword kw">end</span>
|
|
429
|
+
</pre>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
<div id="method-M000052" class="method-detail">
|
|
435
|
+
<a name="M000052"></a>
|
|
436
|
+
|
|
437
|
+
<div class="method-heading">
|
|
438
|
+
<a href="#M000052" class="method-signature">
|
|
439
|
+
<span class="method-name">sort</span><span class="method-args">(&block)</span>
|
|
440
|
+
</a>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
<div class="method-description">
|
|
444
|
+
<p><a class="source-toggle" href="#"
|
|
445
|
+
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
|
|
446
|
+
<div class="method-source-code" id="M000052-source">
|
|
447
|
+
<pre>
|
|
448
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 36</span>
|
|
449
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sort</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
450
|
+
<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">sort</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
451
|
+
<span class="ruby-keyword kw">end</span>
|
|
452
|
+
</pre>
|
|
453
|
+
</div>
|
|
454
|
+
</div>
|
|
455
|
+
</div>
|
|
456
|
+
|
|
457
|
+
<div id="method-M000058" class="method-detail">
|
|
458
|
+
<a name="M000058"></a>
|
|
459
|
+
|
|
460
|
+
<div class="method-heading">
|
|
461
|
+
<a href="#M000058" class="method-signature">
|
|
462
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
|
463
|
+
</a>
|
|
464
|
+
</div>
|
|
465
|
+
|
|
466
|
+
<div class="method-description">
|
|
467
|
+
<p><a class="source-toggle" href="#"
|
|
468
|
+
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
|
|
469
|
+
<div class="method-source-code" id="M000058-source">
|
|
470
|
+
<pre>
|
|
471
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 77</span>
|
|
472
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
|
473
|
+
<span class="ruby-value str">"{"</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">", "</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"}"</span>
|
|
474
|
+
<span class="ruby-keyword kw">end</span>
|
|
475
|
+
</pre>
|
|
476
|
+
</div>
|
|
477
|
+
</div>
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
<div id="method-M000056" class="method-detail">
|
|
481
|
+
<a name="M000056"></a>
|
|
482
|
+
|
|
483
|
+
<div class="method-heading">
|
|
484
|
+
<a href="#M000056" class="method-signature">
|
|
485
|
+
<span class="method-name">undoPruning</span><span class="method-args">()</span>
|
|
486
|
+
</a>
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
<div class="method-description">
|
|
490
|
+
<p>
|
|
491
|
+
Undoes pruning by replacing the current list of values with the one before
|
|
492
|
+
the last time <a href="Domain.html#M000055">prune</a> was called.
|
|
493
|
+
</p>
|
|
494
|
+
<p><a class="source-toggle" href="#"
|
|
495
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
|
496
|
+
<div class="method-source-code" id="M000056-source">
|
|
497
|
+
<pre>
|
|
498
|
+
<span class="ruby-comment cmt"># File lib/Domain.rb, line 66</span>
|
|
499
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">undoPruning</span>
|
|
500
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@undoStack</span>.<span class="ruby-identifier">empty?</span>
|
|
501
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">UndoStackEmptyException</span>, <span class="ruby-value str">"No more prunes to undo!"</span>
|
|
502
|
+
<span class="ruby-keyword kw">end</span>
|
|
503
|
+
<span class="ruby-ivar">@values</span> = <span class="ruby-ivar">@undoStack</span>.<span class="ruby-identifier">pop</span>
|
|
504
|
+
<span class="ruby-keyword kw">end</span>
|
|
505
|
+
</pre>
|
|
506
|
+
</div>
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
</div>
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
</div>
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
<div id="validator-badges">
|
|
518
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
519
|
+
</div>
|
|
520
|
+
|
|
521
|
+
</body>
|
|
522
|
+
</html>
|