Skip to content

Commit 9f9581a

Browse files
committed
update collection interface
1 parent 4227b6e commit 9f9581a

File tree

12 files changed

+119
-103
lines changed

12 files changed

+119
-103
lines changed

build/multiplex.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -919,13 +919,13 @@ declare module mx {
919919
/**
920920
* Gets a collection containing the keys in the SortedList, in sorted order.
921921
*/
922-
keys(): TKey[]
922+
keys(): Collection<TKey>
923923

924924

925925
/**
926926
* Gets a collection containing the values in the SortedLis.
927927
*/
928-
values(): TValue[]
928+
values(): Collection<TValue>
929929

930930

931931
/**
@@ -1113,15 +1113,15 @@ declare module mx {
11131113

11141114

11151115
/**
1116-
* Gets a Array containing the keys of the Dictionary.
1116+
* Gets a Collection containing the keys of the Dictionary.
11171117
*/
1118-
keys(): TKey[]
1118+
keys(): Collection<TKey>
11191119

11201120

11211121
/**
1122-
* Gets a Array containing the values in the Dictionary.
1122+
* Gets a Collection containing the values in the Dictionary.
11231123
*/
1124-
values(): TValue[]
1124+
values(): Collection<TValue>
11251125

11261126

11271127
/**

build/multiplex.intellisense.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,15 +1920,15 @@ intellisense.annotate(mx.SortedList.prototype, {
19201920
/// <summary>
19211921
/// Gets a collection containing the keys in the SortedList, in sorted order.
19221922
/// </summary>
1923-
/// <returns type="Array" />
1923+
/// <returns type="Collection" />
19241924
/// </signature>
19251925
},
19261926
"values": function () {
19271927
/// <signature>
19281928
/// <summary>
19291929
/// Gets a collection containing the values in the SortedLis.
19301930
/// </summary>
1931-
/// <returns type="Array" />
1931+
/// <returns type="Collection" />
19321932
/// </signature>
19331933
},
19341934
"indexOfKey": function () {
@@ -2066,17 +2066,17 @@ intellisense.annotate(mx.Dictionary.prototype, {
20662066
"keys": function () {
20672067
/// <signature>
20682068
/// <summary>
2069-
/// Gets a Array containing the keys of the Dictionary.
2069+
/// Gets a Collection containing the keys of the Dictionary.
20702070
/// </summary>
2071-
/// <returns type="Array" />
2071+
/// <returns type="Collection" />
20722072
/// </signature>
20732073
},
20742074
"values": function () {
20752075
/// <signature>
20762076
/// <summary>
2077-
/// Gets a Array containing the values of the Dictionary.
2077+
/// Gets a Collection containing the values of the Dictionary.
20782078
/// </summary>
2079-
/// <returns type="Array" />
2079+
/// <returns type="Collection" />
20802080
/// </signature>
20812081
},
20822082
"get": function () {
@@ -2857,16 +2857,6 @@ intellisense.annotate(mx.OrderedEnumerable.prototype, {
28572857
/* window
28582858
---------------------------------------------------------------------- */
28592859
intellisense.annotate(window, {
2860-
"mx": mx.Enumerable,
2861-
"ReadOnlyCollection": mx.ReadOnlyCollection,
2862-
"List": mx.List,
2863-
"Dictionary": mx.Dictionary,
2864-
"KeyValuePair": mx.KeyValuePair,
2865-
"HashSet": mx.HashSet,
2866-
"LinkedList": mx.LinkedList,
2867-
"LinkedListNode": mx.LinkedListNode,
2868-
"Queue": mx.Queue,
2869-
"Stack": mx.Stack,
2870-
"Comparer": mx.Comparer,
2871-
"EqualityComparer": mx.EqualityComparer
2860+
"mx": mx,
2861+
"multiplex": mx
28722862
});

build/multiplex.js

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,12 @@
11591159

11601160
/**
11611161
* Initializes a new instance of the abstract Collection class.
1162+
* @param {Enumerable=} value Enumerable whose elements are copied to the new collection.
11621163
*/
1163-
function Collection() {
1164+
function Collection(value) {
1165+
if (__Enumerable.is(value)) {
1166+
$prop(this, $buffer(value, false));
1167+
}
11641168
}
11651169

11661170

@@ -1170,6 +1174,13 @@
11701174
* @returns {Number}
11711175
*/
11721176
count: function () {
1177+
1178+
var _source = $prop(this);
1179+
1180+
if(_source){
1181+
return $count(_source);
1182+
}
1183+
11731184
/// implemented in sub-classes
11741185
$error(ERROR_METHOD_NOT_IMPLEMENTED);
11751186
},
@@ -1188,6 +1199,13 @@
11881199
* @returns {Enumerator}
11891200
*/
11901201
getEnumerator: function () {
1202+
1203+
var _source = $prop(this);
1204+
1205+
if (_source) {
1206+
return $enumerator(_source);
1207+
}
1208+
11911209
/// implemented in sub-classes
11921210
$error(ERROR_METHOD_NOT_IMPLEMENTED);
11931211
},
@@ -2045,20 +2063,20 @@
20452063

20462064
/**
20472065
* Gets a collection containing the keys in the SortedList, in sorted order.
2048-
* @returns {Array}
2066+
* @returns {Collection}
20492067
*/
20502068
keys: function () {
20512069
var _source = $prop(this);
2052-
return _source.keys.slice(0, _source.size);
2070+
return new __Collection(_source.keys.slice(0, _source.size));
20532071
},
20542072

20552073
/**
20562074
* Gets a collection containing the values in the SortedLis.
2057-
* @returns {Array}
2075+
* @returns {Collection}
20582076
*/
20592077
values: function () {
20602078
var _source = $prop(this);
2061-
return _source.values.slice(0, _source.size);
2079+
return new __Collection(_source.values.slice(0, _source.size));
20622080
},
20632081

20642082
/**
@@ -2350,16 +2368,16 @@
23502368
},
23512369

23522370
/**
2353-
* Gets a Array containing the keys of the Dictionary.
2354-
* @returns {Array}
2371+
* Gets a Collection containing the keys of the Dictionary.
2372+
* @returns {Collection}
23552373
*/
23562374
keys: function () {
23572375
return $prop(this).keys();
23582376
},
23592377

23602378
/**
2361-
* Gets a Array containing the values in the Dictionary.
2362-
* @returns {Array}
2379+
* Gets a Collection containing the values in the Dictionary.
2380+
* @returns {Collection}
23632381
*/
23642382
values: function () {
23652383
return $prop(this).values();
@@ -2648,8 +2666,8 @@
26482666
},
26492667

26502668
/**
2651-
* Gets a Array containing the keys of the HashTable.
2652-
* @returns {Array}
2669+
* Gets a Collection containing the keys of the HashTable.
2670+
* @returns {Collection}
26532671
*/
26542672
keys: function () {
26552673
var _count = this._count,
@@ -2666,12 +2684,12 @@
26662684
}
26672685
}
26682686

2669-
return _arr;
2687+
return new __Collection(_arr);
26702688
},
26712689

26722690
/**
2673-
* Gets a Array containing the values in the HashTable.
2674-
* @returns {Array}
2691+
* Gets a Collection containing the values in the HashTable.
2692+
* @returns {Collection}
26752693
*/
26762694
values: function () {
26772695
var _count = this._count,
@@ -2688,7 +2706,7 @@
26882706
}
26892707
}
26902708

2691-
return _arr;
2709+
return new __Collection(_arr);
26922710
},
26932711

26942712
/**

build/multiplex.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/multiplex.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/javascript/multiplex.intellisense.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,15 +1920,15 @@ intellisense.annotate(mx.SortedList.prototype, {
19201920
/// <summary>
19211921
/// Gets a collection containing the keys in the SortedList, in sorted order.
19221922
/// </summary>
1923-
/// <returns type="Array" />
1923+
/// <returns type="Collection" />
19241924
/// </signature>
19251925
},
19261926
"values": function () {
19271927
/// <signature>
19281928
/// <summary>
19291929
/// Gets a collection containing the values in the SortedLis.
19301930
/// </summary>
1931-
/// <returns type="Array" />
1931+
/// <returns type="Collection" />
19321932
/// </signature>
19331933
},
19341934
"indexOfKey": function () {
@@ -2066,17 +2066,17 @@ intellisense.annotate(mx.Dictionary.prototype, {
20662066
"keys": function () {
20672067
/// <signature>
20682068
/// <summary>
2069-
/// Gets a Array containing the keys of the Dictionary.
2069+
/// Gets a Collection containing the keys of the Dictionary.
20702070
/// </summary>
2071-
/// <returns type="Array" />
2071+
/// <returns type="Collection" />
20722072
/// </signature>
20732073
},
20742074
"values": function () {
20752075
/// <signature>
20762076
/// <summary>
2077-
/// Gets a Array containing the values of the Dictionary.
2077+
/// Gets a Collection containing the values of the Dictionary.
20782078
/// </summary>
2079-
/// <returns type="Array" />
2079+
/// <returns type="Collection" />
20802080
/// </signature>
20812081
},
20822082
"get": function () {
@@ -2857,16 +2857,6 @@ intellisense.annotate(mx.OrderedEnumerable.prototype, {
28572857
/* window
28582858
---------------------------------------------------------------------- */
28592859
intellisense.annotate(window, {
2860-
"mx": mx.Enumerable,
2861-
"ReadOnlyCollection": mx.ReadOnlyCollection,
2862-
"List": mx.List,
2863-
"Dictionary": mx.Dictionary,
2864-
"KeyValuePair": mx.KeyValuePair,
2865-
"HashSet": mx.HashSet,
2866-
"LinkedList": mx.LinkedList,
2867-
"LinkedListNode": mx.LinkedListNode,
2868-
"Queue": mx.Queue,
2869-
"Stack": mx.Stack,
2870-
"Comparer": mx.Comparer,
2871-
"EqualityComparer": mx.EqualityComparer
2860+
"mx": mx,
2861+
"multiplex": mx
28722862
});

0 commit comments

Comments
 (0)