[ Pobierz całość w formacie PDF ]
" There must be some mathematical permutation À of the nonnegative integers less than
Result(2), such that for every nonnegative integer j less than Result(2), if propertyold[j]
existed, thennew[À(j)]is exactly the same value asold[j],. but if propertyold[j] did not
exist, thennew[À(j)]does not exist.
" Then for all nonnegative integers j and k, each less than Result(2), if SortCompare(j,k)
SortCompare below), then À(j)
Here the notationold[j]is used to refer to the hypothetical result of calling the [[Get]] method of
this object with argument j before this function is executed, and the notationnew[j]to refer to the
hypothetical result of calling the [[Get]] method of this object with argument j after this function has
been executed.
A function comparefn is a consistent comparison function for a set of values S if all of the
requirements below are met for all values a, b, and c (possibly the same value) in the set S: The
notation a
a >CF b means comparefn(a,b) > 0.
" Calling comparefn(a,b) always returns the same value v when given a specific pair of values a
and b as its two arguments. Furthermore, v has type Number, and v is not NaN. Note that this
implies that exactly one of a CF b will be true for a given pair of a and b.
" a =CF a (reflexivity)
" If a =CF b, then b =CF a (symmetry)
" If a =CF b and b =CF c, then a =CF c (transitivity of =CF)
" If a
- 95 -
" If a >CF b and b >CF c, then a >CF c (transitivity of >CF)
NOTE
The above conditions are necessary and sufficient to ensure that comparefn divides the set S into
equivalence classes and that these equivalence classes are totally ordered.
When the SortCompare operator is called with two arguments j and k, the following steps are taken:
1. Call ToString(j).
2. Call ToString(k).
3. If this object does not have a property named by Result(1), and this object does not have a
property named by Result(2), return +0.
4. If this object does not have a property named by Result(1), return 1.
5. If this object does not have a property named by Result(2), return 1.
6. Call the [[Get]] method of this object with argument Result(1).
7. Call the [[Get]] method of this object with argument Result(2).
8. Let x be Result(6).
9. Let y be Result(7).
10. If x and y are both undefined, return +0.
11. If x is undefined, return 1.
12. If y is undefined, return -1.
13. If the argument comparefn is undefined, go to step 16.
14. Call comparefn with arguments x and y.
15. Return Result(14).
16. Call ToString(x).
17. Call ToString(y).
18. If Result(16)
19. If Result(16) > Result(17), return 1.
20. Return +0.
NOTE 1
Because non-existent property values always compare greater than undefined property values, and
undefined always compares greater than any other value, undefined property values always sort to
the end of the result, followed by non-existent property values.
NOTE 2
Thesortfunction is intentionally generic; it does not require that its this value be an Array object.
Therefore, it can be transferred to other kinds of objects for use as a method. Whether thesort
function can be applied successfully to a host object is implementation-dependent.
15.4.4.12 Array.prototype.splice (start, deleteCount [ , item1 [ , item2 [ , & ] ] ] )
When thesplicemethod is called with two or more arguments start, deleteCount and (optionally)
item1, item2, etc., the deleteCount elements of the array starting at array index start are replaced by
the arguments item1, item2, etc. The following steps are taken:
1. Let A be a new array created as if by the expressionnew Array().
2. Call the [[Get]] method of this object with argument"length".
3. Call ToUint32(Result(2)).
4. Call ToInteger(start).
5. If Result(4) is negative, use max((Result(3)+Result(4)),0); else use min(Result(4),Result(3)).
6. Compute min(max(ToInteger(deleteCount),0),Result(3) Result(5)).
7. Let k be 0.
8. If k equals Result(6), go to step 16.
9. Call ToString(Result(5)+k).
10. If this object has a property named by Result(9), go to step 11; but if this object has no property
named by Result(9), then go to step 14.
11. Call ToString(k).
12. Call the [[Get]] method of this object with argument Result(9).
13. Call the [[Put]] method of A with arguments Result(11) and Result(12).
- 96 -
14. Increment k by 1.
15. Go to step 8.
16. Call the [[Put]] method of A with arguments"length"and Result(6).
17. Compute the number of additional arguments item1, item2, etc.
18. If Result(17) is equal to Result(6), go to step 48.
19. If Result(17) is greater than Result(6), go to step 37.
20. Let k be Result(5).
21. If k is equal to (Result(3) Result(6)), go to step 31.
22. Call ToString(k+Result(6)).
23. Call ToString(k+Result(17)).
24. If this object has a property named by Result(22), go to step 25; but if this object has no property
named by Result(22), then go to step 28.
25. Call the [[Get]] method of this object with argument Result(22).
26. Call the [[Put]] method of this object with arguments Result(23) and Result(25).
27. Go to step 29.
28. Call the [[Delete]] method of this object with argument Result(23).
29. Increase k by 1.
30. Go to step 21.
31. Let k be Result(3).
32. If k is equal to (Result(3) Result(6)+Result(17)), go to step 48.
33. Call ToString(k 1).
34. Call the [[Delete]] method of this object with argument Result(33).
35. Decrease k by 1.
36. Go to step 32.
37. Let k be (Result(3) Result(6)).
38. If k is equal to Result(5), go to step 48.
39. Call ToString(k+Result(6) 1).
40. Call ToString(k+Result(17) 1)
41. If this object has a property named by Result(39), go to step 42; but if this object has no property
named by Result(39), then go to step 45.
42. Call the [[Get]] method of this object with argument Result(39).
43. Call the [[Put]] method of this object with arguments Result(40) and Result(42).
44. Go to step 46.
45. Call the [[Delete]] method of this object with argument Result(40).
46. Decrease k by 1.
47. Go to step 38.
48. Let k be Result(5).
49. Get the next argument in the part of the argument list that starts with item1; if there are no more
arguments, go to step 53.
50. Call the [[Put]] method of this object with arguments ToString(k) and Result(49).
51. Increase k by 1.
52. Go to step 49.
53. Call the [[Put]] method of this object with arguments"length"and (Result(3)
Result(6)+Result(17)).
54. Return A.
Thelengthproperty of thesplicemethod is 2.
NOTE
Thesplicefunction is intentionally generic; it does not require that its this value be an Array
object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the
splicefunction can be applied successfully to a host object is implementation-dependent.
15.4.4.13 Array.prototype.unshift ( [ item1 [ , item2 [ , & ] ] ] )
The arguments are prepended to the start of the array, such that their order within the array is the
same as the order in which they appear in the argument list.
When theunshiftmethod is called with zero or more arguments item1, item2, etc., the following
steps are taken:
- 97 -
1. Call the [[Get]] method of this object with argument"length".
2. Call ToUint32(Result(1)).
3. Compute the number of arguments.
4. Let k be Result(2).
5. If k is zero, go to step 15.
6. Call ToString(k 1).
7. Call ToString(k+Result(3) 1).
8. If this object has a property named by Result(6), go to step 9; but if this object has no property
named by Result(6), then go to step 12.
9. Call the [[Get]] method of this object with argument Result(6).
[ Pobierz całość w formacie PDF ]
-
Odnośniki
- Strona startowa
- DEM Extraction
- Rogers Shirley TeksaśÂ„ski kochanek
- sartrenause
- 03. Kay Patricia Klub bogatych kobiet Tydzien we dwoje
- Van Vogt, AE The Weapon Shops of Isher
- King.William. .Przygody.Gotreka.i.Felixa.03. .Zabójca demonów
- Mirror of Alchemy R Bacon
- Przeciwko babom Joanna Chmielewska
- Jo Clayton Diadem 08 The Snares of Ibex (v1.1)
- Asimov, Isaac Black W
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- zona-meza.xlx.pl