TNumArray2: Razlika med redakcijama

Iz SDMS
Jump to navigationJump to search
m
m
 
Vrstica 1: Vrstica 1:
{{Work}}
 
 
Razred '''TNumArray2''' je namenjen dvodimenzionalni tabeli numeričnih vrednosti.
 
Razred '''TNumArray2''' je namenjen dvodimenzionalni tabeli numeričnih vrednosti.
 +
 +
==Lastnosti==
 +
Razred se naredi s funkcijo {{EL|Rutine|CreateNumArray2}}.
 +
<source>Dim NA As TNumArray2
 +
NA = CreateNumArray2 (3, 2) // Alocira tabelo s 3x2 elementi
 +
NA.Items(0,0) = 1          // Nastavi element 
 +
NA.Items(1,0) = 3          // Nastavi element
 +
NA.Items(2,0) = 2          // Nastavi element
 +
NA.Items(2,1) = 1          // Nastavi element
 +
If NA.Items(1,0) = 3 Then  // Uporabi vrednost elementa
 +
  NA.Count1 = 2            // Spremeni velikost tabele v 2x2
 +
  NA.Count2 = 3            // Spremeni velikost tabele v 2x3
 +
EndIf
 +
Destroy (NA)                // Dealocira tabelo</source>
  
 
===Count1===
 
===Count1===
Lastnost '''Count1''' .
+
Lastnost '''Count1''' spremeni velikost prve dimenzije tabele. Vrednosti v tabeli se ohranijo.
 
<declaration>
 
<declaration>
 
Property|TNumArray2.Count1
 
Property|TNumArray2.Count1
Result|Long|.
+
Result|Long|Nova velikost tabele.
 
</declaration>
 
</declaration>
<source></source>
 
  
 
===Count2===
 
===Count2===
Lastnost '''Count2''' .
+
Lastnost '''Count2''' spremeni velikost druge dimenzije tabele. Vrednosti v tabeli se ohranijo.
 
<declaration>
 
<declaration>
 
Property|TNumArray2.Count2
 
Property|TNumArray2.Count2
Result|Long|.
+
Result|Long|Nova velikost tabele.
</declaration>
 
<source></source>
 
 
 
===Destroy===
 
Metoda '''Destroy''' .
 
<declaration>
 
Method|TNumArray2.Destroy
 
 
</declaration>
 
</declaration>
<source></source>
 
  
 
===Items===
 
===Items===
Lastnost '''Items''' .
+
Lastnost '''Items''' dostopa posamezni vrednosti v tabeli.
 
<declaration>
 
<declaration>
 
Property|TNumArray2.Items
 
Property|TNumArray2.Items
Index1|Long|.
+
Index1|Long|Prvi indeks celice. Prvi element ima indeks 0.
Index2|Long|.
+
Index2|Long|Drugi indeks celice. Prvi element ima indeks 0.
Result|Float|.
+
Result|Float|Vrednost celice.
 
</declaration>
 
</declaration>
<source></source>
 
  
 
===Sort===
 
===Sort===
Metoda '''Sort''' .
+
Metoda '''Sort''' uredi celice po vrsti po prvi dimenziji. Za drugo dimenzijo se uporabi indeks 0. Torej sortira glede na vrednosti (0,0), (1,0), (2,0),...
 
<declaration>
 
<declaration>
 
Method|TNumArray2.Sort
 
Method|TNumArray2.Sort
 
</declaration>
 
</declaration>
<source></source>
+
{| border="1"
 +
!colspan="2"|Nesortirano!!colspan="2"|Sortirano
 +
|-
 +
|1||2||1||2
 +
|-
 +
|5||1||3||4
 +
|-
 +
|3||4||5||1
 +
|}
 +
 
 +
==Opuščeno==
 +
 
 +
===Destroy===
 +
Metoda '''Destroy''' dealocira razred. Metoda je opuščena in se priporoča uporaba funkcije {{EL|Rutine|Destroy}}.
 +
<declaration>
 +
Method|TNumArray2.Destroy
 +
</declaration>
  
 
[[Category:Razredi tabel|NumArr2]]
 
[[Category:Razredi tabel|NumArr2]]
 
[[Category:Razredi|NumArr2]]
 
[[Category:Razredi|NumArr2]]
 
[[Category:SDMS Basic|NumArr2]]
 
[[Category:SDMS Basic|NumArr2]]

Trenutna redakcija s časom 00:19, 22. januar 2011

Razred TNumArray2 je namenjen dvodimenzionalni tabeli numeričnih vrednosti.

Lastnosti

Razred se naredi s funkcijo Rutine.CreateNumArray2.

Dim NA As TNumArray2
NA = CreateNumArray2 (3, 2) // Alocira tabelo s 3x2 elementi
NA.Items(0,0) = 1           // Nastavi element   
NA.Items(1,0) = 3           // Nastavi element
NA.Items(2,0) = 2           // Nastavi element 
NA.Items(2,1) = 1           // Nastavi element 
If NA.Items(1,0) = 3 Then   // Uporabi vrednost elementa
  NA.Count1 = 2             // Spremeni velikost tabele v 2x2
  NA.Count2 = 3             // Spremeni velikost tabele v 2x3
EndIf
Destroy (NA)                // Dealocira tabelo

Count1

Lastnost Count1 spremeni velikost prve dimenzije tabele. Vrednosti v tabeli se ohranijo.

Property TNumArray2.Count1 As Long
ResultLongNova velikost tabele.

Count2

Lastnost Count2 spremeni velikost druge dimenzije tabele. Vrednosti v tabeli se ohranijo.

Property TNumArray2.Count2 As Long
ResultLongNova velikost tabele.

Items

Lastnost Items dostopa posamezni vrednosti v tabeli.

Property TNumArray2.Items (Index1, Index2 As Long) As Float
Index1LongPrvi indeks celice. Prvi element ima indeks 0.
Index2LongDrugi indeks celice. Prvi element ima indeks 0.
ResultFloatVrednost celice.

Sort

Metoda Sort uredi celice po vrsti po prvi dimenziji. Za drugo dimenzijo se uporabi indeks 0. Torej sortira glede na vrednosti (0,0), (1,0), (2,0),...

Method TNumArray2.Sort
Nesortirano Sortirano
1 2 1 2
5 1 3 4
3 4 5 1

Opuščeno

Destroy

Metoda Destroy dealocira razred. Metoda je opuščena in se priporoča uporaba funkcije Rutine.Destroy.

Method TNumArray2.Destroy