This repository was archived by the owner on Jun 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathArray.html
More file actions
115 lines (115 loc) · 23 KB
/
Array.html
File metadata and controls
115 lines (115 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en"><!-- use theme color or fallback -->
<!--use textcolor from settings, otherwise create a contrasting color to theme color-->
<head><meta charset="utf-8"/><link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet"/><link href="./bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"/><link href="./bootstrap/css/bootstrap-select.min.css" rel="stylesheet"/><link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600,600italic,400" rel="stylesheet" type="text/css"/><link href="https://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet" type="text/css"/><script src="./jquery-1.9.1.min.js"></script><script src="./bootstrap/js/bootstrap.min.js"></script><script src="./bootstrap/js/bootstrap-select.min.js"></script><link href="./styles.css" rel="stylesheet"/><link href="./extra-styles.css" rel="stylesheet"/><link href="./haxe-nav.css" rel="stylesheet"/><link href="./dark-mode.css" rel="stylesheet"/><script>var dox = {rootPath: "./",platforms: ["types"]};</script><script src="./nav.js"></script><script src="./index.js"></script><link rel="icon" href="./favicon.ico" type="image/x-icon"/><title>Array</title></head><body><script>/* Here to prevent flash of unstyled content */let systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;if ((!localStorage.theme && systemDarkMode) || localStorage.theme == "dark") {document.body.style.backgroundColor = "#111";document.body.style.opacity = "0";document.addEventListener("DOMContentLoaded", function(event) {toggleTheme();document.body.style.backgroundColor = "";document.body.style.opacity = "";});}</script><style>
.navbar .brand {
display: inline-block;
float: none;
text-shadow: 0 0 0 transparent;
}
</style><nav class="nav"><div class="navbar"><div class="navbar-inner" style="background:#FAFAFA; border-bottom:1px solid rgba(0,0,0,.09)"><div class="container"><a class="brand" style="color:#000000" href="./">API Documentation</a><a href="#" id="theme-toggle" class="brand" style="color:#000000" onclick="toggleTheme()" title="Toggle Dark Mode"><i class="fa fa-moon-o"></i></a></div></div></div></nav><div class="container main-content"><div class="row-fluid"><div class="span3"><div class="well sidebar-nav"><form class="form-search" id="searchForm"><div class="input-prepend input-block-level"><span class="add-on"><i class="fa fa-search"></i></span><input id="search" type="text" placeholder="Filter (Ctrl+P)" autocomplete="off"/></div></form></div><div class="well sidebar-nav" id="explorer"><div id="nav"></div></div></div><div class="span9"><div class="page-header"><h1><small>class</small> Array<<span class="type">T</span>></h1><h4><small><a href="./">no package</a></small></h4> <h4><small><span class="muted">extended by </span><a class="type" title="js.lib.RegExpMatch - A return value of the RegExp." href="./js/lib/RegExpMatch.html">RegExpMatch</a></small></h4><span class="label label-meta label-meta-directlyUsed" title="Marks types that are directly referenced by non-extern code.">@:directlyUsed</span><span class="label label-meta label-meta-coreApi" title="Identifies this class as a core API class (forces API check).">@:coreApi</span></div><div class="body"><div class="doc doc-main"><p></p></div><h3 class="section">Constructor</h3><div class="fields"><div class="field "><a name="new"></a><h3 class="anchor"><code><a href="#new"><span class="identifier">new</span></a>()</code></h3><div class="doc"><p>Creates a new Array.</p></div></div></div><h3 class="section">Variables</h3><div class="fields"><div class="field "><a name="length"></a><h3 class="anchor"><code><span class="label">read only</span><a href="#length"><span class="identifier">length</span></a>:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></code></h3><div class="doc"><p>The length of <code>this</code> Array.</p></div></div></div><h3 class="section">Methods</h3><div class="fields"><div class="field "><a name="concat"></a><h3 class="anchor"><code><a href="#concat"><span class="identifier">concat</span></a>(<span style="white-space:nowrap">a:<a class="type" title="Array" href="./Array.html">Array</a><<span class="type">T</span>></span>):<a class="type" title="Array" href="./Array.html">Array</a><<span class="type">T</span>></code></h3><div class="doc"><p>Returns a new Array by appending the elements of <code>a</code> to the elements of
<code>this</code> Array.</p>
<p>This operation does not modify <code>this</code> Array.</p>
<p>If <code>a</code> is the empty Array <code>[]</code>, a copy of <code>this</code> Array is returned.</p>
<p>The length of the returned Array is equal to the sum of <code>this.<a href="#length">length</a></code>
and <code>a.length</code>.</p>
<p>If <code>a</code> is <code>null</code>, the result is unspecified.</p></div></div><div class="field "><a name="contains"></a><h3 class="anchor"><code><span class="label label-inline">inline</span><a href="#contains"><span class="identifier">contains</span></a>(<span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="Bool - The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></code></h3><div class="doc"><p>Returns whether <code>this</code> Array contains <code>x</code>.</p>
<p>If <code>x</code> is found by checking standard equality, the function returns <code><a href="./Bool.html">true</a></code>, otherwise
the function returns <code><a href="./Bool.html">false</a></code>.</p></div></div><div class="field "><a name="copy"></a><h3 class="anchor"><code><span class="label label-inline">inline</span><a href="#copy"><span class="identifier">copy</span></a>():<a class="type" title="Array" href="./Array.html">Array</a><<span class="type">T</span>></code></h3><div class="doc"><p>Returns a shallow copy of <code>this</code> Array.</p>
<p>The elements are not copied and retain their identity, so
<code>a[i] == a.copy()[i]</code> is true for any valid <code>i</code>. However,
<code>a == a.copy()</code> is always false.</p></div></div><div class="field "><a name="filter"></a><h3 class="anchor"><code><span class="label label-meta label-meta-runtime" title="">@:runtime</span><span class="label label-inline">inline</span><a href="#filter"><span class="identifier">filter</span></a>(<span style="white-space:nowrap">f:<span class="type">T</span> ‑> <a class="type" title="Bool - The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></span>):<a class="type" title="Array" href="./Array.html">Array</a><<span class="type">T</span>></code></h3><div class="doc"><p>Returns an Array containing those elements of <code>this</code> for which <code>f</code>
returned true.</p>
<p>The individual elements are not duplicated and retain their identity.</p>
<p>If <code>f</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="indexOf"></a><h3 class="anchor"><code><a href="#indexOf"><span class="identifier">indexOf</span></a>(<span style="white-space:nowrap">x:<span class="type">T</span>,</span> <span style="white-space:nowrap">?fromIndex:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></code></h3><div class="doc"><p>Returns position of the first occurrence of <code>x</code> in <code>this</code> Array, searching front to back.</p>
<p>If <code>x</code> is found by checking standard equality, the function returns its index.</p>
<p>If <code>x</code> is not found, the function returns -1.</p>
<p>If <code>fromIndex</code> is specified, it will be used as the starting index to search from,
otherwise search starts with zero index. If it is negative, it will be taken as the
offset from the end of <code>this</code> Array to compute the starting index. If given or computed
starting index is less than 0, the whole array will be searched, if it is greater than
or equal to the length of <code>this</code> Array, the function returns -1.</p></div></div><div class="field "><a name="insert"></a><h3 class="anchor"><code><span class="label label-inline">inline</span><a href="#insert"><span class="identifier">insert</span></a>(<span style="white-space:nowrap">pos:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a>,</span> <span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="Void - The standard Void type." href="./Void.html">Void</a></code></h3><div class="doc"><p>Inserts the element <code>x</code> at the position <code>pos</code>.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p>The offset is calculated like so:</p><ul><li>If <code>pos</code> exceeds <code>this.<a href="#length">length</a></code>, the offset is <code>this.<a href="#length">length</a></code>.</li><li>If <code>pos</code> is negative, the offset is calculated from the end of <code>this</code>
Array, i.e. <code>this.<a href="#length">length</a> + pos</code>. If this yields a negative value, the
offset is 0.</li><li>Otherwise, the offset is <code>pos</code>.</li></ul>
<p>If the resulting offset does not exceed <code>this.<a href="#length">length</a></code>, all elements from
and including that offset to the end of <code>this</code> Array are moved one index
ahead.</p></div></div><div class="field "><a name="iterator"></a><h3 class="anchor"><code><span class="label label-meta label-meta-runtime" title="">@:runtime</span><span class="label label-inline">inline</span><a href="#iterator"><span class="identifier">iterator</span></a>():<a class="type" title="haxe.iterators.ArrayIterator" href="./haxe/iterators/ArrayIterator.html">ArrayIterator</a><<span class="type">T</span>></code></h3><div class="doc"><p>Returns an iterator of the Array values.</p></div></div><div class="field "><a name="join"></a><h3 class="anchor"><code><a href="#join"><span class="identifier">join</span></a>(<span style="white-space:nowrap">sep:<a class="type" title="String - The basic String class." href="./String.html">String</a></span>):<a class="type" title="String - The basic String class." href="./String.html">String</a></code></h3><div class="doc"><p>Returns a string representation of <code>this</code> Array, with <code>sep</code> separating
each element.</p>
<p>The result of this operation is equal to <code><a href="./Std.html#string">Std.string</a>(this[0]) + sep +
<a href="./Std.html#string">Std.string</a>(this[1]) + sep + ... + sep + <a href="./Std.html#string">Std.string</a>(this[this.<a href="#length">length</a>-1])</code></p>
<p>If <code>this</code> is the empty Array <code>[]</code>, the result is the empty String <code>""</code>.
If <code>this</code> has exactly one element, the result is equal to a call to
<code><a href="./Std.html#string">Std.string</a>(this[0])</code>.</p>
<p>If <code>sep</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="keyValueIterator"></a><h3 class="anchor"><code><span class="label label-meta label-meta-runtime" title="">@:runtime</span><span class="label label-inline">inline</span><a href="#keyValueIterator"><span class="identifier">keyValueIterator</span></a>():<a class="type" title="haxe.iterators.ArrayKeyValueIterator" href="./haxe/iterators/ArrayKeyValueIterator.html">ArrayKeyValueIterator</a><<span class="type">T</span>></code></h3><div class="doc"><p>Returns an iterator of the Array indices and values.</p></div></div><div class="field "><a name="lastIndexOf"></a><h3 class="anchor"><code><a href="#lastIndexOf"><span class="identifier">lastIndexOf</span></a>(<span style="white-space:nowrap">x:<span class="type">T</span>,</span> <span style="white-space:nowrap">?fromIndex:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></code></h3><div class="doc"><p>Returns position of the last occurrence of <code>x</code> in <code>this</code> Array, searching back to front.</p>
<p>If <code>x</code> is found by checking standard equality, the function returns its index.</p>
<p>If <code>x</code> is not found, the function returns -1.</p>
<p>If <code>fromIndex</code> is specified, it will be used as the starting index to search from,
otherwise search starts with the last element index. If it is negative, it will be
taken as the offset from the end of <code>this</code> Array to compute the starting index. If
given or computed starting index is greater than or equal to the length of <code>this</code> Array,
the whole array will be searched, if it is less than 0, the function returns -1.</p></div></div><div class="field "><a name="map"></a><h3 class="anchor"><code><span class="label label-meta label-meta-runtime" title="">@:runtime</span><span class="label label-inline">inline</span><a href="#map"><span class="identifier">map</span></a><<span class="type">S</span>>(<span style="white-space:nowrap">f:<span class="type">T</span> ‑> <span class="type">S</span></span>):<a class="type" title="Array" href="./Array.html">Array</a><<span class="type">S</span>></code></h3><div class="doc"><p>Creates a new Array by applying function <code>f</code> to all elements of <code>this</code>.</p>
<p>The order of elements is preserved.</p>
<p>If <code>f</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="pop"></a><h3 class="anchor"><code><a href="#pop"><span class="identifier">pop</span></a>():<a class="type" title="Null - Null&lt;T&gt; is a wrapper that can be used to make the basic types Int, Float and Bool nullable on static targets." href="./Null.html">Null</a><<span class="type">T</span>></code></h3><div class="doc"><p>Removes the last element of <code>this</code> Array and returns it.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p>If <code>this</code> has at least one element, <code>this.<a href="#length">length</a></code> will decrease by 1.</p>
<p>If <code>this</code> is the empty Array <code>[]</code>, null is returned and the length
remains 0.</p></div></div><div class="field "><a name="push"></a><h3 class="anchor"><code><a href="#push"><span class="identifier">push</span></a>(<span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></code></h3><div class="doc"><p>Adds the element <code>x</code> at the end of <code>this</code> Array and returns the new
length of <code>this</code> Array.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p><code>this.<a href="#length">length</a></code> increases by 1.</p></div></div><div class="field "><a name="remove"></a><h3 class="anchor"><code><span class="label label-inline">inline</span><a href="#remove"><span class="identifier">remove</span></a>(<span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="Bool - The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></code></h3><div class="doc"><p>Removes the first occurrence of <code>x</code> in <code>this</code> Array.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p>If <code>x</code> is found by checking standard equality, it is removed from <code>this</code>
Array and all following elements are reindexed accordingly. The function
then returns true.</p>
<p>If <code>x</code> is not found, <code>this</code> Array is not changed and the function
returns false.</p></div></div><div class="field "><a name="resize"></a><h3 class="anchor"><code><span class="label label-inline">inline</span><a href="#resize"><span class="identifier">resize</span></a>(<span style="white-space:nowrap">len:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="Void - The standard Void type." href="./Void.html">Void</a></code></h3><div class="doc"><p>Set the length of the Array.</p>
<p>If <code>len</code> is shorter than the array's current size, the last
<code>length - len</code> elements will be removed. If <code>len</code> is longer, the Array
will be extended, with new elements set to a target-specific default
value:</p><ul><li>always null on dynamic targets</li><li>0, 0.0 or false for Int, Float and Bool respectively on static targets</li><li>null for other types on static targets</li></ul></div></div><div class="field "><a name="reverse"></a><h3 class="anchor"><code><a href="#reverse"><span class="identifier">reverse</span></a>():<a class="type" title="Void - The standard Void type." href="./Void.html">Void</a></code></h3><div class="doc"><p>Reverse the order of elements of <code>this</code> Array.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p>If <code>this.<a href="#length">length</a> < 2</code>, <code>this</code> remains unchanged.</p></div></div><div class="field "><a name="shift"></a><h3 class="anchor"><code><a href="#shift"><span class="identifier">shift</span></a>():<a class="type" title="Null - Null&lt;T&gt; is a wrapper that can be used to make the basic types Int, Float and Bool nullable on static targets." href="./Null.html">Null</a><<span class="type">T</span>></code></h3><div class="doc"><p>Removes the first element of <code>this</code> Array and returns it.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p>If <code>this</code> has at least one element, <code>this</code>.length and the index of each
remaining element is decreased by 1.</p>
<p>If <code>this</code> is the empty Array <code>[]</code>, <code>null</code> is returned and the length
remains 0.</p></div></div><div class="field "><a name="slice"></a><h3 class="anchor"><code><a href="#slice"><span class="identifier">slice</span></a>(<span style="white-space:nowrap">pos:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a>,</span> <span style="white-space:nowrap">?end:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="Array" href="./Array.html">Array</a><<span class="type">T</span>></code></h3><div class="doc"><p>Creates a shallow copy of the range of <code>this</code> Array, starting at and
including <code>pos</code>, up to but not including <code>end</code>.</p>
<p>This operation does not modify <code>this</code> Array.</p>
<p>The elements are not copied and retain their identity.</p>
<p>If <code>end</code> is omitted or exceeds <code>this.<a href="#length">length</a></code>, it defaults to the end of
<code>this</code> Array.</p>
<p>If <code>pos</code> or <code>end</code> are negative, their offsets are calculated from the
end of <code>this</code> Array by <code>this.<a href="#length">length</a> + pos</code> and <code>this.<a href="#length">length</a> + end</code>
respectively. If this yields a negative value, 0 is used instead.</p>
<p>If <code>pos</code> exceeds <code>this.<a href="#length">length</a></code> or if <code>end</code> is less than or equals
<code>pos</code>, the result is <code>[]</code>.</p></div></div><div class="field "><a name="sort"></a><h3 class="anchor"><code><a href="#sort"><span class="identifier">sort</span></a>(<span style="white-space:nowrap">f:(<span class="type">T</span>, <span class="type">T</span>) ‑> <a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="Void - The standard Void type." href="./Void.html">Void</a></code></h3><div class="doc"><p>Sorts <code>this</code> Array according to the comparison function <code>f</code>, where
<code>f(x,y)</code> returns 0 if x == y, a positive Int if x > y and a
negative Int if x < y.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p>The sort operation is not guaranteed to be stable, which means that the
order of equal elements may not be retained. For a stable Array sorting
algorithm, <code><a href="./haxe/ds/ArraySort.html#sort">haxe.ds.ArraySort.sort</a>()</code> can be used instead.</p>
<p>If <code>f</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="splice"></a><h3 class="anchor"><code><a href="#splice"><span class="identifier">splice</span></a>(<span style="white-space:nowrap">pos:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a>,</span> <span style="white-space:nowrap">len:<a class="type" title="Int - The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="Array" href="./Array.html">Array</a><<span class="type">T</span>></code></h3><div class="doc"><p>Removes <code>len</code> elements from <code>this</code> Array, starting at and including
<code>pos</code>, an returns them.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p>If <code>len</code> is < 0 or <code>pos</code> exceeds <code>this</code>.length, an empty Array [] is
returned and <code>this</code> Array is unchanged.</p>
<p>If <code>pos</code> is negative, its value is calculated from the end of <code>this</code>
Array by <code>this.<a href="#length">length</a> + pos</code>. If this yields a negative value, 0 is
used instead.</p>
<p>If the sum of the resulting values for <code>len</code> and <code>pos</code> exceed
<code>this.<a href="#length">length</a></code>, this operation will affect the elements from <code>pos</code> to the
end of <code>this</code> Array.</p>
<p>The length of the returned Array is equal to the new length of <code>this</code>
Array subtracted from the original length of <code>this</code> Array. In other
words, each element of the original <code>this</code> Array either remains in
<code>this</code> Array or becomes an element of the returned Array.</p></div></div><div class="field "><a name="toString"></a><h3 class="anchor"><code><a href="#toString"><span class="identifier">toString</span></a>():<a class="type" title="String - The basic String class." href="./String.html">String</a></code></h3><div class="doc"><p>Returns a string representation of <code>this</code> Array.</p>
<p>The result will include the individual elements' String representations
separated by comma. The enclosing [ ] may be missing on some platforms,
use <code><a href="./Std.html#string">Std.string</a>()</code> to get a String representation that is consistent
across platforms.</p></div></div><div class="field "><a name="unshift"></a><h3 class="anchor"><code><a href="#unshift"><span class="identifier">unshift</span></a>(<span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="Void - The standard Void type." href="./Void.html">Void</a></code></h3><div class="doc"><p>Adds the element <code>x</code> at the start of <code>this</code> Array.</p>
<p>This operation modifies <code>this</code> Array in place.</p>
<p><code>this.<a href="#length">length</a></code> and the index of each Array element increases by 1.</p></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#000000">© 2021 </p></div></div></footer><script src=".//highlighter.js"></script><link href="./highlighter.css" rel="stylesheet"/></body></html>