Sortable hash table
A method for providing symbolic access to a plurality of objects stored in a data storage is provided. An associative array comprising a plurality of associative array keys and a plurality of associative array values may be generated. A data array comprising a plurality of data array elements may be generated, such that each object stores a sortable property value of the object and an original offset of the object. A mapping table to map original offsets to modified offsets is generated. The mapping table includes a plurality of mapping table elements, and each associative array value is used as an offset into the mapping table, and each mapping table element storing a modified offset, each modified offset is a numeric value used as an offset into the data array.
1. A method comprising:
providing an associative array comprising a plurality of entries corresponding to a plurality of symbolic properties, each entry in the plurality of entries associating a corresponding symbolic property in the plurality of symbolic properties with a value;
providing a data array comprising a plurality of data array elements, each element in the data array storing a symbolic property from the plurality of symbolic properties and a sortable property value;
storing a mapping table comprising a plurality of mapping table elements, each mapping table element storing an offset value, wherein, for each entry in the associative array associating a symbolic property with a value, the value identifies a mapping table element in the mapping table corresponding to the entry and the offset value stored by the corresponding mapping table element is indicative of a data array element storing the symbolic property; and
for a first symbolic property from the plurality of symbolic properties, accessing a first data array element of the plurality of data array elements storing the first symbolic property using the associative array and the mapping table.
2. The method of claim 1 , further comprising:
sorting data array elements based upon the sortable property value stored by each data array element.
3. The method of claim 2 , further comprising:
determining a modified offset value indicative of a changed position of the first data array element within the data array after the sorting; and
updating an offset value stored by a first mapping table element for the first data array element with the modified offset value.
4. The method of claim 3 , wherein the updating further comprises:
locating the first mapping table element in the mapping table; and
changing the offset value stored by the first mapping table element to the modified offset.
5. The method of claim 4 , wherein the locating the first mapping table element includes using the first associative array value.
6. The method of claim 1 , wherein accessing the first data array element further includes:
determining a first entry in the associative array using the first symbolic property;
determining a first value associated with the first entry in the associative array;
determining a first mapping table element in the mapping table using the first value; and
accessing the first data array element in the data array using a first offset value stored by the first mapping table element.
7. The method of claim 1 , further comprising:
accessing the data array element using a numeric property.
8. The method of claim 7 , wherein accessing the first data array element further includes:
determining a first mapping table element in the mapping table using a first numeric property; and
accessing the second data array element in the data array using a first offset value stored by the first mapping table element.
9. The method of claim 1 , further comprising:
accessing the sortable property value of each data array element in sorted order using at least one of a numeric property and a symbolic property.
10. The method of claim 1 , further comprising:
determining a first entry in the associative array for removal using the first symbolic property;
determining a first value associated with the first entry in the associative array;
determining a first mapping table element in the mapping table using the first value;
accessing the first data array element in the data array using a first offset value stored by the first mapping table element;
removing the first data array element from the data array; and
removing the first mapping table element from the mapping table.
11. A system comprising:
a memory; and
a processor configured to:
cause an associative array to be stored in the memory, the associative array comprising a plurality of entries corresponding symbolic properties, each entry in the plurality of entries associating a corresponding symbolic property in the plurality of symbolic properties with a value;
cause a data array to be stored in the memory, the data array comprising a plurality of data array elements, each element in the data array storing a symbolic property from the plurality of symbolic properties and a sortable property value;
cause a mapping table to be stored in the memory, the mapping table comprising a plurality of mapping table elements, each mapping table element storing an offset value, wherein, for each entry in the associative array associating a symbolic property with a value, the value identifies a mapping table element in the mapping table corresponding to the entry and the offset value stored by corresponding mapping table element is indicative of a data array element storing the symbolic property.
12. The system of claim 11 , wherein the data array elements are sorted based upon the sortable property value stored by each data array element.
13. A non-transitory computer-readable medium storing a computer program product executed by a processor, the computer program product comprising:
code for providing an associative array comprising a plurality of entries corresponding to a plurality of symbolic properties, each entry in the plurality of entries associating a corresponding symbolic property in the plurality of symbolic properties with a value;
code for providing a data array comprising a plurality of data array elements, each element in the data array storing a symbolic property from the plurality of symbolic properties and a sortable property value; and
code for storing a mapping table comprising a plurality of mapping table elements, each mapping table element storing an offset value, wherein, for each entry in the associative array associating a symbolic property with a value, the value identifies a mapping table element in the mapping table corresponding to the entry and the offset value stored by the corresponding mapping table element is indicative of a data array element storing the symbolic property.
14. The non-transitory computer-readable medium of claim 13 , wherein the computer program product further comprising:
code for sorting the data array elements based upon the sortable property value stored by each data array element.
15. The non-transitory computer-readable medium of claim 14 , wherein the computer program product further comprising:
code for determining a modified offset value indicative of a changed position of the first data array element within the data array after the sorting; and
code for updating an offset value stored by a first mapping table element for the first data array element with the modified offset value.
16. The non-transitory computer-readable medium of claim 15 , wherein the computer program product further comprising:
code for locating the first mapping table element in the mapping table; and
code for changing the offset value stored by the first mapping table element to the modified offset.