Skip to content

Commit 0e68dcf

Browse files
authored
Update README.md
1 parent 07b57ec commit 0e68dcf

File tree

1 file changed

+109
-154
lines changed

1 file changed

+109
-154
lines changed

README.md

Lines changed: 109 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,204 +1,159 @@
1-
# Dictionary in Classic ASP
1+
# Dynamic array in Classic ASP
22

3-
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/aadc6762a5a64808a2887afea2969e1d)](https://app.codacy.com/gh/R0mb0/Dictionary_classic_asp/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
3+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5fb4b710ca5c4dfd88a883944af2dac3)](https://app.codacy.com/gh/R0mb0/Dynamic_array_classic_asp/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
44

5-
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/R0mb0/Dictionary_classic_asp)
6-
[![Open Source Love svg3](https://badges.frapsoft.com/os/v3/open-source.svg?v=103)](https://github.com/R0mb0/Dictionary_classic_asp)
5+
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/R0mb0/Dynamic_array_classic_asp)
6+
[![Open Source Love svg3](https://badges.frapsoft.com/os/v3/open-source.svg?v=103)](https://github.com/R0mb0/Dynamic_array_classic_asp)
77
[![MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit)
88

99
[![Donate](https://img.shields.io/badge/PayPal-Donate%20to%20Author-blue.svg)](http://paypal.me/R0mb0)
1010

11-
## Backgroud structure
12-
13-
### Arrays structure.
14-
The dictionary is implemented as a multidimensional array, where the first dynamic array contains on every cell a fixed array of two cells.
15-
The first fixed array cell contains the unique key and the second one contains the value.
16-
17-
#### Chart
18-
```mermaid
19-
flowchart LR;
20-
A[/0/] ==> B[/1/]
21-
B ==> C[/2/]
22-
C ==> D[/.../]
23-
A --> E[0: Unique Key]
24-
E --> F[1: Value]
25-
B --> G[0: Unique Key]
26-
G --> H[1: Value]
27-
C --> I[0: Unique Key]
28-
I --> J[1: Value]
29-
D --> K[0: Unique Key]
30-
K --> L[1: Value]
31-
```
3211

3312
<details>
3413
<summary>
3514

36-
## `Dictionary.asp`'s avaible Functions
15+
## `Dynamic_array.asp`'s avaible Functions
3716

38-
</summary>
39-
40-
- **Initialize an array as a dictionary** -> `get_initialized_dictionary()`
41-
- **Add an element into a dictionary** -> `add_element_to_dictionary(key,value)`
42-
- **Get value from key** -> `get_dictionary_value_from_key(key)`
43-
- **Set value from key** -> `set_dictionary_value_from_key(key,value)`
44-
- **Change a key into dictionary** -> `change_dictionary_key(old_key,new_key)`
45-
- **Remove dictionary element from key** -> `remove_dictionary_element_from_index(idx)`
46-
- **Remove dictionary element from index** -> `remove_dictionary_element_from_index(idx)`
47-
- **Remove last element from dictionary** -> `remove_last_element_from_dictionary()`
48-
- **Remove elements from dictionary using indices (pass to function an array with the indices)** -> `remove_dictionary_elements_from_indices(indices)`
49-
- **Remove all elements with the same value from dictionary** -> `remove_dictionary_elements_from_value(value)`
50-
- **Replace all value occurrences with a new value in dictionary** -> `replace_all_value_occurrences(old_value,new_value)`
51-
- **Get key index from dictionary** -> `get_key_index_from_dictionary(key)`
52-
- **Reset a dictionary** -> `get_initialized_dictionary()`
53-
- **Get dictionary key from index** -> `get_dictionary_key_from_index(idx)`
54-
- **Get first value index occurrence** -> `get_first_value_index_occurrence(value)`
55-
- **Get all indices of a value** -> `get_all_value_indices(value)`
56-
- **Check if a key has been used into dictionary** -> `check_if_key_has_been_used(key)`
57-
- **Check if a value is present in the dictionary** -> `check_if_value_is_present(value)`
58-
- **Get dictionary value from index** -> `get_dictionary_value_from_index(idx)`
59-
- **Get dictionary dimension** -> `get_dictionary_dimension()`
60-
- **Write a dictionary** -> `write_dictionary()`
61-
62-
## How to use:
63-
64-
> From `Test.asp`
65-
66-
1. Create array and initialize it as dictionary
17+
</summary>
18+
19+
- **Initialize the array** -> `initialize_array()`
20+
- **Check if the array is initializated** -> `is_array_initializated()`
21+
- **Add an element into the array** -> `add_element_to_array(element)`
22+
- **Get element from index** -> `get_element_from_array(idx)`
23+
- **Remove last element from array** -> `remove_last_element_from_array()`
24+
- **Remove an element from array** -> `remove_all_occurences_from_array(element)`
25+
- **Remove the first element occurence from array** -> `remove_first_occurence_from_array(element)`
26+
- **Remove element from index** -> `remove_this_elements_from_array(idx)`
27+
- **Remove elements from indices** -> `remove_these_elements_from_array(indices_array)`
28+
- **Reset the array** -> `initialize_array()`
29+
- **Check if an element is in the array** -> `array_contains(element)`
30+
- **Retrieve the first index of an element in the array** -> `from_array_get_first_index_occurence_of(element)`
31+
- **Retrieve all indeces of an element inside the array (return an array)** -> `from_array_get_all_indeces_occurence_of(element)`
32+
- **Retrieve the entire array** -> `get_array()`
33+
- **Retrieve the array dimension** -> `get_array_dimension()`
34+
- **Write the entire array** -> `write_array()`
35+
36+
## How to use
37+
38+
> From `Test1.asp`
39+
40+
1. Initialize the array and check it's status
6741
```asp
68-
<!--#include file="Dictionaries.asp"-->
42+
<%@LANGUAGE="VBSCRIPT"%>
43+
<!--#include file="Dynamic_array.asp"-->
6944
<%
70-
Dim dictionary
71-
dictionary = Array()
72-
dictionary = get_initialized_dictionary()
45+
initialize_array()
46+
Response.Write("Array status: ")
47+
Response.Write(is_array_initializated() & "<br>")
7348
```
74-
2. Pass the dictionary to functions for manage
49+
2. Use the functions to manage the array
7550
```asp
76-
add_element_to_dictionary_array "0001","Ice ice baby"
77-
add_element_to_dictionary_array "0002","Dove lo vuoi tu"
78-
add_element_to_dictionary_array "0003","Hot shot"
79-
write_dictionary
51+
add_element_to_array("A")
52+
add_element_to_array("B")
53+
add_element_to_array("C")
54+
add_element_to_array("D")
55+
Response.Write("Elements inside: ")
56+
write_array()
8057
%>
8158
```
59+
8260
</details>
8361

8462
<details>
8563
<summary>
8664

87-
## `Dictionaries.asp`'s avaible Functions
65+
## `Dynamic_arrays.asp`'s avaible Functions
8866

89-
</summary>
90-
91-
- **Initialize an array as a dictionary** -> `get_initialized_dictionary()`
92-
- **Add an element into a dictionary** -> `add_element_to_dictionary(dictionary,key,value)`
93-
- **Get value from key** -> `get_dictionary_value_from_key(dictionary,key)`
94-
- **Set value from key** -> `set_dictionary_value_from_key(dictionary,key,value)`
95-
- **Change a key into dictionary** -> `change_dictionary_key(dictionary,old_key,new_key)`
96-
- **Remove dictionary element from key** -> `remove_dictionary_element_from_index(dictionary,idx)`
97-
- **Remove dictionary element from index** -> `remove_dictionary_element_from_index(dictionary,idx)`
98-
- **Remove last element from dictionary** -> `remove_last_element_from_dictionary(dictionary)`
99-
- **Remove elements from dictionary using indices (pass to function an array with the indices)** -> `remove_dictionary_elements_from_indices(dictionary,indices)`
100-
- **Remove all elements with the same value from dictionary** -> `remove_dictionary_elements_from_value(dictionary,value)`
101-
- **Replace all value occurrences with a new value in dictionary** -> `replace_all_value_occurrences(dictionary,old_value,new_value)`
102-
- **Get key index from dictionary** -> `get_key_index_from_dictionary(dictionary,key)`
103-
- **Reset a dictionary** -> `get_initialized_dictionary()`
104-
- **Get dictionary key from index** -> `get_dictionary_key_from_index(dictionary,idx)`
105-
- **Get first value index occurrence** -> `get_first_value_index_occurrence(dictionary,value)`
106-
- **Get all indices of a value** -> `get_all_value_indices(dictionary,value)`
107-
- **Check if a key has been used into dictionary** -> `check_if_key_has_been_used(dictionary,key)`
108-
- **Check if a value is present in the dictionary** -> `check_if_value_is_present(dictionary,value)`
109-
- **Get dictionary value from index** -> `get_dictionary_value_from_index(dictionary,idx)`
110-
- **Get dictionary dimension** -> `get_dictionary_dimension(dictionary)`
111-
- **Write a dictionary** -> `write_dictionary(dictionary)`
112-
113-
## How to use:
67+
</summary>
68+
69+
- **Initialize a dynamic array** -> `get_initializated_dynamic_array()`
70+
- **Add an element into a dynamic array** -> `add_element_to_dynamic_array(my_array,element)`
71+
- **Get element from index** -> `get_element_from_dynamic_array(my_array,idx)`
72+
- **Remove last element from a dynamic array** -> `remove_last_element_from_dynamic_array(my_array)`
73+
- **Remove all element occurences from a dyamic array** -> `remove_all_occurences_from_dynamic_array(my_array,element)`
74+
- **Remove first element occurence from a dynamic array** -> `remove_first_occurence_from_dynamic_array(my_array,element)`
75+
- **Remove element from index** -> `remove_this_elements_from_dynamic_array(my_array,idx)`
76+
- **Remove elements from indices** -> `remove_these_elements_from_dynamic_array(my_array,indices_array)`
77+
- **Reset a dynamic array** -> `get_initializated_dynamic_array()`
78+
- **Check if an element is in the dynamic array** -> `dynamic_array_contains(my_array,element)`
79+
- **Retrieve the first index of an element inside a dynamic array** -> `from_dynamic_array_get_first_index_occurence_of(my_array,element)`
80+
- **Retrieve all indeces of an element inside the dynamic array (return an array)** -> `from_dynamic_array_get_all_indeces_occurence_of(my_array,element)`
81+
- **Retrieve the dynamic array dimension** -> `get_dynamic_array_dimension(my_array)`
82+
- **Write an entire dynamic array** -> `write_dynamic_array(my_array)`
83+
84+
## How to use
11485

11586
> From `Test.asp`
11687
117-
1. Create array and initialize it as dictionary
88+
1. Create array and initialize it
11889
```asp
119-
<!--#include file="Dictionary.asp"-->
90+
<%@LANGUAGE="VBSCRIPT"%>
91+
<!--#include file="Dynamic_arrays.asp"-->
12092
<%
121-
Dim dictionary
122-
dictionary = Array()
123-
dictionary = get_initialized_dictionary()
93+
Dim test_array
94+
test_array = Array()
95+
test_array = get_initializated_dynamic_array()
12496
```
125-
2. Pass the dictionary to functions for manage
97+
2. Pass the array to functions for manage
12698
```asp
127-
add_element_to_dictionary_array dictionary,"0001","Ice ice baby"
128-
add_element_to_dictionary_array dictionary,"0002","Dove lo vuoi tu"
129-
add_element_to_dictionary_array dictionary,"0003","Hot shot"
130-
write_dictionary dictionary
99+
add_element_to_dynamic_array test_array,"A"
100+
add_element_to_dynamic_array test_array,"B"
101+
add_element_to_dynamic_array test_array,"C"
102+
write_dynamic_array(test_array)
131103
%>
132104
```
133-
</details>
105+
106+
</details>
134107

135108
<details>
136109
<summary>
137110

138-
## `dictionary.class.asp`'s avaible Functions
111+
## `dArray.class.asp`'s avaible Functions
139112

140-
</summary>
141-
142-
- **Add an element into a dictionary** -> `add_element(key,value)`
143-
- **Get value from key** -> `get_value_from_key(key)`
144-
- **Set value from key** -> `set_value_from_key(key,value)`
145-
- **Change a key into dictionary** -> `change_key(old_key,new_key)`
146-
- **Remove dictionary element from key** -> `remove_element_from_index(idx)`
147-
- **Remove dictionary element from index** -> `remove_element_from_index(idx)`
148-
- **Remove last element from dictionary** -> `remove_last_element(dictionary)`
149-
- **Remove elements from dictionary using indices (pass to function an array with the indices)** -> `remove_elements_from_indices(indices)`
150-
- **Remove all elements with the same value from dictionary** -> `remove_elements_from_value(value)`
151-
- **Replace all value occurrences with a new value in dictionary** -> `replace_all_value_occurrences(old_value,new_value)`
152-
- **Get key index from dictionary** -> `get_key_index(key)`
153-
- **Reset a dictionary** -> Re-initialize the object
154-
- **Get dictionary key from index** -> `get_key_from_index(idx)`
155-
- **Get first value index occurrence** -> `get_first_value_index_occurrence(value)`
156-
- **Get all indices of a value** -> `get_all_value_indices(value)`
157-
- **Check if a key has been used into dictionary** -> `check_if_key_has_been_used(key)`
158-
- **Check if a value is present in the dictionary** -> `check_if_value_is_present(value)`
159-
- **Get dictionary value from index** -> `get_value_from_index(idx)`
160-
- **Get dictionary dimension** -> `get_dimension()`
161-
- **Write a dictionary** -> `write()`
162-
163-
## How to use:
113+
</summary>
114+
115+
- **Initialize class** -> `sub class_initialize()`
116+
- **Terminate class** -> `sub class_terminate()`
117+
- **Add an element** -> `Public Function add_element(element)`
118+
- **Get element from index** -> `Public Function get_element(idx)`
119+
- **Get array dimension** -> `Public Function get_dimension()`
120+
- **Remove last element** -> `Public Function remove_last_element()`
121+
- **Remove all element occurences** -> `Public Function remove_all_occurences(element)`
122+
- **Remove first element occurence** -> `Public Function remove_first_occurence(element)`
123+
- **Remove element from index** -> `Public Function remove_this_element(idx)`
124+
- **Remove elements from indices** -> `Public Function remove_these_elements(indices_array)`
125+
- **Reset** -> Re-initialize the class
126+
- **Check if an element is present** -> `Public Function contains(element)`
127+
- **Retrieve the first index of an element** -> `Public Function get_first_index_occurence_of(element)`
128+
- **Retrieve all indeces of an element (return an array)** -> `Public Function get_all_indeces_occurence_of(element)`
129+
- **Write the entire array** -> `Public Function write_array()`
130+
131+
## How to use
164132

165133
> From `Test.asp`
166134
167135
1. Initialize the class
168136
```asp
169137
<%@LANGUAGE="VBSCRIPT"%>
170-
<!--#include file="dictionary.class.asp"-->
138+
<!--#include file="dArray.class.asp"-->
171139
<%
172-
Dim dic
173-
Set dic = new dictionary
140+
Dim da
141+
Set da = new dArray
174142
```
175143
2. Use the class
176144
```asp
177-
dic.add_element "0001","Ice ice baby"
178-
dic.add_element "0002","Dove lo vuoi tu"
179-
dic.add_element "0003","Hot shot"
180-
dic.add_element "0004","7 minuti in paradiso"
181-
dic.add_element "0005","Dimmi dove e quando"
182-
dic.add_element "0006","Balla per me"
183-
dic.add_element "0007","Nudi e crudi"
184-
dic.add_element "0008","Obbligo o verita'"
185-
dic.add_element "0009","Sotto il vestito, niente"
186-
dic.add_element "0010","Colazione a letto "
187-
dic.add_element "0011","Luce dei miei occhi"
188-
dic.add_element "0012","Comprami un giocattolo"
189-
dic.add_element "0013","Facciamo pace"
190-
dic.add_element "0014","Less is more"
191-
dic.add_element "0015","call me baby"
192-
dic.add_element "0016","Pensaci tu"
193-
dic.add_element "0017","Souvenir d'amour"
194-
dic.add_element "0018","Proca a prendermi"
195-
dic.add_element "0019","Meet me at the hotel"
196-
dic.add_element "0020","Sexy movie night"
197-
dic.add_element "0021","Doccia bollente"
198-
dic.add_element "0022","Blind date"
199-
dic.add_element "0023","Oggi voglio..."
200-
dic.add_element "0024","Nuovo blocchetto"
201-
dic.write()
145+
da.add_element("A")
146+
da.add_element("B")
147+
da.add_element("C")
148+
da.add_element("D")
149+
da.add_element("A")
150+
da.add_element("B")
151+
da.add_element("C")
152+
da.add_element("D")
153+
da.add_element("A")
154+
Response.Write("Elements inside: ")
155+
da.write_array()
202156
%>
203157
```
158+
204159
</details>

0 commit comments

Comments
 (0)