Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,11 +0,0 @@
|
|||
procedure Array_Collection is
|
||||
|
||||
A : array (-3 .. -1) of Integer := (1, 2, 3);
|
||||
|
||||
begin
|
||||
|
||||
A (-3) := 3;
|
||||
A (-2) := 2;
|
||||
A (-1) := 1;
|
||||
|
||||
end Array_Collection;
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
procedure Array_Collection is
|
||||
|
||||
type Array_Type is array (1 .. 3) of Integer;
|
||||
A : Array_Type := (1, 2, 3);
|
||||
|
||||
begin
|
||||
|
||||
A (1) := 3;
|
||||
A (2) := 2;
|
||||
A (3) := 1;
|
||||
|
||||
end Array_Collection;
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
procedure Array_Collection is
|
||||
|
||||
type Array_Type is array (positive range <>) of Integer; -- may be indexed with any positive
|
||||
-- Integer value
|
||||
A : Array_Type(1 .. 3); -- creates an array of three integers, indexed from 1 to 3
|
||||
|
||||
begin
|
||||
|
||||
A (1) := 3;
|
||||
A (2) := 2;
|
||||
A (3) := 1;
|
||||
|
||||
end Array_Collection;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
with Ada.Containers.Doubly_Linked_Lists;
|
||||
use Ada.Containers;
|
||||
|
||||
procedure Doubly_Linked_List is
|
||||
|
||||
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
|
||||
use DL_List_Pkg;
|
||||
|
||||
DL_List : List;
|
||||
|
||||
begin
|
||||
|
||||
DL_List.Append (1);
|
||||
DL_List.Append (2);
|
||||
DL_List.Append (3);
|
||||
|
||||
end Doubly_Linked_List;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
with Ada.Containers.Vectors;
|
||||
use Ada.Containers;
|
||||
|
||||
procedure Vector_Example is
|
||||
|
||||
package Vector_Pkg is new Vectors (Natural, Integer);
|
||||
use Vector_Pkg;
|
||||
|
||||
V : Vector;
|
||||
|
||||
begin
|
||||
|
||||
V.Append (1);
|
||||
V.Append (2);
|
||||
V.Append (3);
|
||||
|
||||
end Vector_Example;
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
identification division.
|
||||
program-id. collections.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 sample-table.
|
||||
05 sample-record occurs 1 to 3 times depending on the-index.
|
||||
10 sample-alpha pic x(4).
|
||||
10 filler pic x value ":".
|
||||
10 sample-number pic 9(4).
|
||||
10 filler pic x value space.
|
||||
77 the-index usage index.
|
||||
|
||||
procedure division.
|
||||
collections-main.
|
||||
|
||||
set the-index to 3
|
||||
move 1234 to sample-number(1)
|
||||
move "abcd" to sample-alpha(1)
|
||||
|
||||
move "test" to sample-alpha(2)
|
||||
|
||||
move 6789 to sample-number(3)
|
||||
move "wxyz" to sample-alpha(3)
|
||||
|
||||
display "sample-table : " sample-table
|
||||
display "sample-number(1): " sample-number(1)
|
||||
display "sample-record(2): " sample-record(2)
|
||||
display "sample-number(3): " sample-number(3)
|
||||
|
||||
*> abend: out of bounds subscript, -debug turns on bounds check
|
||||
set the-index down by 1
|
||||
display "sample-table : " sample-table
|
||||
display "sample-number(3): " sample-number(3)
|
||||
|
||||
goback.
|
||||
end program collections.
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
# Create an Array by separating the elements with commas:
|
||||
$array = "one", 2, "three", 4
|
||||
|
||||
# Using explicit syntax:
|
||||
$array = @("one", 2, "three", 4)
|
||||
|
||||
# Send the values back into individual variables:
|
||||
$var1, $var2, $var3, $var4 = $array
|
||||
|
||||
# An array of several integer ([int]) values:
|
||||
$array = 0, 1, 2, 3, 4, 5, 6, 7
|
||||
|
||||
# Using the range operator (..):
|
||||
$array = 0..7
|
||||
|
||||
# Strongly typed:
|
||||
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
|
||||
|
||||
# An empty array:
|
||||
$array = @()
|
||||
|
||||
# An array with a single element:
|
||||
$array = @("one")
|
||||
|
||||
# I suppose this would be a jagged array:
|
||||
$jaggedArray = @((11, 12, 13),
|
||||
(21, 22, 23),
|
||||
(31, 32, 33))
|
||||
|
||||
$jaggedArray | Format-Wide {$_} -Column 3 -Force
|
||||
|
||||
$jaggedArray[1][1] # returns 22
|
||||
|
||||
# A Multi-dimensional array:
|
||||
$multiArray = New-Object -TypeName "System.Object[,]" -ArgumentList 6,6
|
||||
|
||||
for ($i = 0; $i -lt 6; $i++)
|
||||
{
|
||||
for ($j = 0; $j -lt 6; $j++)
|
||||
{
|
||||
$multiArray[$i,$j] = ($i + 1) * 10 + ($j + 1)
|
||||
}
|
||||
}
|
||||
|
||||
$multiArray | Format-Wide {$_} -Column 6 -Force
|
||||
|
||||
$multiArray[2,2] # returns 33
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
# An empty Hash Table:
|
||||
$hash = @{}
|
||||
|
||||
# A Hash table populated with some values:
|
||||
$nfcCentralDivision = @{
|
||||
Packers = "Green Bay"
|
||||
Bears = "Chicago"
|
||||
Lions = "Detroit"
|
||||
}
|
||||
|
||||
# Add items to a Hash Table:
|
||||
$nfcCentralDivision.Add("Vikings","Minnesota")
|
||||
$nfcCentralDivision.Add("Buccaneers","Tampa Bay")
|
||||
|
||||
# Remove an item from a Hash Table:
|
||||
$nfcCentralDivision.Remove("Buccaneers")
|
||||
|
||||
# Searching for items
|
||||
$nfcCentralDivision.ContainsKey("Packers")
|
||||
$nfcCentralDivision.ContainsValue("Green Bay")
|
||||
|
||||
# A bad value...
|
||||
$hash1 = @{
|
||||
One = 1
|
||||
Two = 3
|
||||
}
|
||||
|
||||
# Edit an item in a Hash Table:
|
||||
$hash1.Set_Item("Two",2)
|
||||
|
||||
# Combine Hash Tables:
|
||||
|
||||
$hash2 = @{
|
||||
Three = 3
|
||||
Four = 4
|
||||
}
|
||||
|
||||
$hash1 + $hash2
|
||||
|
||||
# Using the ([ordered]) accelerator the items in the Hash Table retain the order in which they were input:
|
||||
$nfcCentralDivision = [ordered]@{
|
||||
Bears = "Chicago"
|
||||
Lions = "Detroit"
|
||||
Packers = "Green Bay"
|
||||
Vikings = "Minnesota"
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
$list = New-Object -TypeName System.Collections.ArrayList -ArgumentList 1,2,3
|
||||
|
||||
# or...
|
||||
|
||||
$list = [System.Collections.ArrayList]@(1,2,3)
|
||||
|
||||
|
||||
$list.Add(4) | Out-Null
|
||||
$list.RemoveAt(2)
|
||||
Loading…
Add table
Add a link
Reference in a new issue