2 次元配列のパラメータ化クラス。
説明
注意事項
注意事項
要素の 2 次元配列を初期化します。 |
要素の 2 次元配列を初期化します。 |
コレクションが空かどうかを調べます。 |
配列の内部表現を返します。 |
すべての要素をクリアします。 |
コレクションのクローンを返します。 |
2 つの配列が等しいかどうかを調べます。 |
実装されていません。呼び出さないでください。 |
実装されていません。呼び出さないでください。 |
特定の要素を返します。 |
2 次元インデックスが存在するかどうかを調べます。 |
要素の値を設定します。 |
配列のサイズを設定します。 |
配列のサイズを返します。 |
配列の各要素を含む |
要素の 2 次元配列を初期化します。
要素の 2 次元配列を初期化します。
例
注意事項
コレクションが空かどうかを調べます。
戻り値
例
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 0, 0} || Check if the array is empty and display an || appropriate message. {if my-array.empty? then {text The array is empty!} else {text The array has elements!} } } |
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Fill the array with elements. set my-array[0, 0] = "Harry" set my-array[1, 0] = "Sally" set my-array[0, 1] = "Tom" set my-array[1, 1] = "Mary" set my-array[0, 2] = "John" set my-array[1, 2] = "Anne" || Check if the array is empty and display an || appropriate message. {if my-array.empty? then {text The array is empty!} else {text The array has elements!} } } |
すべての要素をクリアします。
説明
例
例 | |
![]() | |
|| Create a two-dimensional array of String. {let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3}} || Fill the array with elements. {set my-array[0, 0] = "Harry"} {set my-array[1, 0] = "Sally"} {set my-array[0, 1] = "Tom"} {set my-array[1, 1] = "Mary"} {set my-array[0, 2] = "John"} {set my-array[1, 2] = "Anne"} || Clear the array. {my-array.clear} || Display the value of an element {text The value of the element at (0,0) is... {value my-array[0, 0]}} || Notice that even though the array is clear, || it is not empty. || Check if the array is empty and display an || appropriate message. {if my-array.empty? then {text The array is empty!} else {text The array has elements!} } |
注意事項
コレクションのクローンを返します。
戻り値
説明
例
例 | |
![]() | |
{value || Create a two-dimensional array of String. let array-1:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Fill the array with elements. set array-1[0, 0] = "Harry" set array-1[1, 0] = "Sally" set array-1[0, 1] = "Tom" set array-1[1, 1] = "Mary" set array-1[0, 2] = "John" set array-1[1, 2] = "Anne" || Initialize array-2 with a clone of the contents of || array-1. let array-2:{Array-2-of String} = {array-1.clone} || Use a VBox to display the contents of array-2. || Iterate over the contents of array-2, adding || them to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in array-2 do {message.add each-element} } message } |
注意事項
2 つの配列が等しいかどうかを調べます。
戻り値
説明
例
例 | |
![]() | |
|| Create a two-dimensional array of String. {let array-1:{Array-2-of String} = {new {Array-2-of String}, 2, 3}} || Fill the array with elements. {set array-1[0, 0] = "Harry"} {set array-1[1, 0] = "Sally"} {set array-1[0, 1] = "Tom"} {set array-1[1, 1] = "Mary"} {set array-1[0, 2] = "John"} {set array-1[1, 2] = "Anne"} || Create another two-dimensional array of String. {let array-2:{Array-2-of String} = {new {Array-2-of String}, 2, 2}} || Fill the array with elements. {set array-2[0, 0] = "Harry"} {set array-2[1, 0] = "Sally"} {set array-2[0, 1] = "Tom"} {set array-2[1, 1] = "Mary"} || Determine if the arrays are equal. Originally, the arrays are equal is... {array-1.equal? array-2} || Change the size of array-2 and fill the new || elements. {array-2.set-size 2, 3} {set array-2[0, 2] = "John"} {set array-2[1, 2] = "Anne"} || And test the arrays for equality again. After modification, the arrays are equal is... {array-1.equal? array-2} |
実装されていません。呼び出さないでください。
説明
実装されていません。呼び出さないでください。
説明
特定の要素を返します。
戻り値
説明
例
例 | |
![]() | |
|| Create a two-dimensional array of String. {let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3}} || Fill the array with elements. {set my-array[0, 0] = "Harry"} {set my-array[1, 0] = "Sally"} {set my-array[0, 1] = "Tom"} {set my-array[1, 1] = "Mary"} {set my-array[0, 2] = "John"} {set my-array[1, 2] = "Anne"} || Display the element at index [0, 2]. {my-array.get 0, 2} |
注意事項
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Fill the array with elements. set my-array[0, 0] = "Harry" set my-array[1, 0] = "Sally" set my-array[0, 1] = "Tom" set my-array[1, 1] = "Mary" set my-array[0, 2] = "John" set my-array[1, 2] = "Anne" || Display the element at index [0, 2]. my-array[0, 2] } |
2 次元インデックスが存在するかどうかを調べます。
戻り値
例
例 | |
![]() | |
|| Create a two-dimensional array of String. {let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3}} || Fill the array with elements. {set my-array[0, 0] = "Harry"} {set my-array[1, 0] = "Sally"} {set my-array[0, 1] = "Tom"} {set my-array[1, 1] = "Mary"} {set my-array[0, 2] = "John"} {set my-array[1, 2] = "Anne"} || Check if some indices are valid. [0, 0] is in bounds... {my-array.in-bounds? 0, 0} [0, 2] is in bounds... {my-array.in-bounds? 0, 2} [2, 0] is in bounds... {my-array.in-bounds? 2, 0} [1, 1] is in bounds... {my-array.in-bounds? 1, 1} |
要素の値を設定します。
説明
例
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Fill the array with elements. {my-array.set 0, 0, "Harry"} {my-array.set 1, 0, "Sally"} {my-array.set 0, 1, "Tom"} {my-array.set 1, 1, "Mary"} {my-array.set 0, 2, "John"} {my-array.set 1, 2, "Anne"} || Use a VBox to display the contents of the array. || Iterate over the contents of the array, adding || them to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
注意事項
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Fill the array with elements. set my-array[0, 0] = "Harry" set my-array[1, 0] = "Sally" set my-array[0, 1] = "Tom" set my-array[1, 1] = "Mary" set my-array[0, 2] = "John" set my-array[1, 2] = "Anne" || Use a VBox to display the contents of the array. || Iterate over the contents of the array, adding || them to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-array do {message.add each-element} } message } |
配列のサイズを設定します。
説明
例
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Change the dimensions of the array. {my-array.set-size 6, 9} || Declare two integer variables to hold the || size for each dimension. let x:int let y:int || Assign the return value from a call to size || to the integer variables. set (x, y) = {my-array.size} || Display the two integer values. {text The size is ({value x}, {value y}).} } |
配列のサイズを返します。
戻り値
例
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Assign the return value from a call to size || to integer variables holding its size. let (x:int, y:int) = {my-array.size} || Display the two integer values. {text The size is ({value x}, {value y}).} } |
注意事項
配列の各要素を含む
戻り値
説明
例
例 | |
![]() | |
{value || Create a two-dimensional array of String. let my-array:{Array-2-of String} = {new {Array-2-of String}, 2, 3} || Fill the array with elements. set my-array[0, 0] = "Harry" set my-array[1, 0] = "Sally" set my-array[0, 1] = "Tom" set my-array[1, 1] = "Mary" set my-array[0, 2] = "John" set my-array[1, 2] = "Anne" || Create an Iterator-of from the set. let my-iterator:{Iterator-of String} = {my-array.to-Iterator} || Use a VBox to display the contents of my-iterator. || Iterate over the contents of my-iterator, adding || them to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-iterator do {message.add each-element} } message } |
注意事項