forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpand.xml
More file actions
executable file
·68 lines (51 loc) · 1.62 KB
/
Copy pathexpand.xml
File metadata and controls
executable file
·68 lines (51 loc) · 1.62 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>expand()</name>
<category>Data</category>
<subcategory>Array Functions</subcategory>
<usage>Web & Application</usage>
<example>
<image></image>
<code><![CDATA[
int[] data = {0, 1, 3, 4};
println(data.length); // Prints "4"
data = expand(data);
println(data.length); // Prints "8"
data = expand(data, 512);
println(data.length); // Prints "512"
]]></code>
</example>
<example>
<image></image>
<code><![CDATA[
PImage[] imgs = new PImage[32];
println(imgs.length); // Prints "32"
imgs = (PImage[]) expand(imgs);
println(imgs.length); // Prints "64"
]]></code>
</example>
<description><![CDATA[
Increases the size of an array. By default, this function doubles the size of the array, but the optional <b>newSize</b> parameter provides precise control over the increase in size.
<br/> <br/>
When using an array of objects, the data returned from the function must be cast to the object array's data type. For example: <em>SomeClass[] items = (SomeClass[]) expand(originalArray)</em>.
]]></description>
<syntax><![CDATA[
expand(<kbd>array</kbd>)
expand(<kbd>array</kbd>, <kbd>newSize</kbd>)
]]></syntax>
<parameter>
<label>array</label>
<description><![CDATA[boolean[], byte[], char[], int[], float[], String[], or an array of objects]]></description>
</parameter>
<parameter>
<label>newSize</label>
<description><![CDATA[positive int: new size for the array]]></description>
</parameter>
<returns>Array (the same datatype as the input)</returns>
<related>
contract()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>