Skip to content

Commit 90e2d87

Browse files
committed
Edits to XML for *List classes for reference
1 parent 936de4a commit 90e2d87

22 files changed

+292
-44
lines changed

content/api_en/FloatList.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,28 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
noLoop();
23+
fill(0);
24+
textAlign(CENTER);
25+
}
26+
27+
void draw() {
28+
float nums = inventory.get(2);
29+
text(nums, width/2, height/2);
30+
}
31+
1632
]]></code>
1733
</example>
1834

1935
<description><![CDATA[
20-
To come...
36+
Helper class for a list of Floats. By design (for efficiency), functions like <b>sort()</b> and <b>shuffle()</b> always act on the list itself. To get a sorted copy, use list.copy().sort().
2137
]]></description>
2238

2339

content/api_en/IntList.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,28 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
noLoop();
23+
fill(0);
24+
textAlign(CENTER);
25+
}
26+
27+
void draw() {
28+
int nums = inventory.get(2);
29+
text(nums, width/2, height/2);
30+
}
31+
1632
]]></code>
1733
</example>
1834

1935
<description><![CDATA[
20-
To come...
36+
Helper class for a list of ints. By design (for efficiency), functions like <b>sort()</b> and </b>shuffle()</b> always act on the list itself. To get a sorted copy, use list.copy().sort().
2137
]]></description>
2238

2339

content/api_en/IntList_add.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
inventory.add(1, 15);
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

1929
<description><![CDATA[
20-
To come...
30+
Add to a value.
2131
]]></description>
2232

2333
</root>

content/api_en/IntList_append.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
inventory.append(-16);
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

1929
<description><![CDATA[
20-
To come...
30+
Add a new entry to the list.
2131
]]></description>
2232

2333
</root>

content/api_en/IntList_array.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,23 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
inventory.sort();
23+
int[] sortedInventory = inventory.array();
24+
println(sortedInventory);
25+
}
26+
1627
]]></code>
1728
</example>
1829

1930
<description><![CDATA[
20-
To come...
31+
Create a new array with a copy of all the values.
2132
]]></description>
2233

2334
</root>

content/api_en/IntList_clear.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
inventory.clear();
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

1929
<description><![CDATA[
20-
To come...
30+
Remove all entries from the list.
2131
]]></description>
2232

2333
</root>

content/api_en/IntList_div.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
inventory.div(0, 2);
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

1929
<description><![CDATA[
20-
To come...
30+
Divide a value.
2131
]]></description>
2232

2333
</root>

content/api_en/IntList_get.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,28 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
noLoop();
23+
fill(0);
24+
textAlign(CENTER);
25+
}
26+
27+
void draw() {
28+
int nums = inventory.get(2);
29+
text(nums, width/2, height/2);
30+
}
31+
1632
]]></code>
1733
</example>
1834

1935
<description><![CDATA[
20-
To come...
36+
Get an entry at a particular index.
2137
]]></description>
2238

2339
</root>

content/api_en/IntList_hasValue.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
if (inventory.hasValue(15) == true) {
23+
println("Yes, we have a '15'");
24+
} else {
25+
println("Sorry, no '15'");
26+
}
27+
}
28+
1629
]]></code>
1730
</example>
1831

1932
<description><![CDATA[
20-
To come...
33+
Check if a number is a part of the data structure.
2134
]]></description>
2235

2336
</root>

content/api_en/IntList_increment.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
int[] numbers = { 84, 15, 102 };
16+
IntList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new IntList(numbers);
21+
println(inventory);
22+
inventory.increment(1);
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

1929
<description><![CDATA[
20-
To come...
30+
Add one to a value.
2131
]]></description>
2232

2333
</root>

0 commit comments

Comments
 (0)