@@ -5,7 +5,7 @@
//
// voire la documentation de {{http://mootools.net/docs/Class/Class|Class}} de MooTools.
-/*global Class, Hash, $defined */
+/*global Class, $defined */
var SudokuSet = new Class({
@@ -14,11 +14,9 @@
//
initialize: function (array_init) {
- this.data = new Hash();
+ this.data = [];
if ($defined(array_init)) {
- array_init.forEach(function (key) {
- this.set(key);
- }, this);
+ this.data.combine(array_init);
}
},
@@ -27,7 +25,7 @@
// ajoute un élément
set: function (key) {
- this.data.set(key, true);
+ this.data.combine([key]);
return this;
},
@@ -38,7 +36,7 @@
// retourne un Booléen
has: function (key) {
- return this.data.has(key);
+ return this.data.contains(key);
},
// ** {{{SudokuSet:erase}}}
@@ -55,7 +53,7 @@
// retourne le nombre d'éléments
getLength: function () {
- return this.data.getLength();
+ return this.data.length;
},
// ** {{{SudokuSet:getKeys}}}
@@ -65,7 +63,7 @@
// Le tableau doit être trié en ordre croissant
getKeys: function () {
- return this.data.getKeys().sort(function (a, b) {
+ return this.data.sort(function (a, b) {
return a - b;
});
},