Data Class Bank in Decal SDL-Delphi - Universal Data Structure and Algorithm (1)

zhaozj2021-02-08  359

1. DECAL SDL Universal Data Structure and Algorithm Category Library I personally think is a data structural library for current class structure construction.

Introduction DECAL is SDL, a business general data structure and algorithm class library. DECAL deletes the code about the garbage collection section, and the other parts are open from the source, which is a good news for everyone. The full name of DECAL is Delphi Container and Algorithm Library, that is, the Delphi Data Container and Algorithm Category. Decal is a data structural class library based on Mozilla Open Source Protocol, which is Soletta. Some of DECAL is from Stepanov and Lee C STL (Standard Template Library) and ObjectSpace's JGL (Java Generic Library).

DECAL offers a number of functions that are not available in many other Delphi libraries: * Based on a mature STL system, powerful underlying process. * Decal is based on generic computer algorithms and data structures. * Provide a variety of data types to provide easy usage. Such as Integers, Strings, Extended Values. * DECAL uses the array constant Array of Const function of Delphi 4, which greatly reduces the burden of programmers. * DECAL provides more than 60 common algorithms. * Decal Integrated SuperStream provides solutions for data storage to stream. * Complete data structure class library. DECAL includes: array arrays, two-way linked table Double-Linked Lists, mapping Maps, and Collection SETS. The mapping structure includes two forms of binary trees and hashes.

DECAL term: Item (data item) is in Decal, data item (Items) is the following basic data type: integer, string, currency, or character (char) type, etc.. An object (Object) is also a data item.

The Container container is used to save the data item. It is a data structure. Different types of containers (data structures) have different capabilities. According to an example, some type of container may have fast deletion capabilities, but add slower, and another container supports fast random access, but slower deletion. When you need a container to save your data item, select the appropriate container type will make your program efficiency multiply, and vice versa. The pros and cons of each container will be detailed later.

Iterator is the data item pointer, which points to a particular data item in the container. The data item pointer can move before, and the access data item is implemented via the Iterator (data item pointer). Using the Iterator (Data Item Pointer) Access Data allows you to change the processing of data items after changing the container type. We often see the following code: item: = container.start; item: = container.finish; first line of code is the first data of the container, and the second line is the ATEND end data item of the container (last The latter position of a data item, the flag is ended)

Comparers compare the comparison function (Comparer) is used to compare the size of the two data townships. If the first item is less than the second item, the function should return a value of less than zero; if it returns a value 0 if it is equal; if the first item is greater than the second item, the function should return a value greater than 0. The following is the definition of comparison functions: DComparator = function (const Obj1, obj2: dobject): integer of object;

AtendDecal uses a data item pointer (Iterators) maintenance of the data item location in the container. There is a special data item pointer (Iterator) called: adend. The ATEND data item pointer indication has reached the end of the container, and there is no data available. Take data from this position is illegal! Sometimes write to this location is legal. A container adds an object to the Atend Being Written to The end of the contact, but not all containers do, especially mapping containers. Atend is very important that they will return Atend when the algorithm cannot advance to the next data item.

Range range is two data item pointers, labeled the start position and end position of the data item. For example: data items between Container.Start and Container.finish are a range.

PAIR (data pair) a data pair is two data items (two DOBJECTS, stored in a DPAIR). The data stored in the mapping container is data pair, and the stored data is composed of a keyword key (first field) and data value value (second field).

Sequence (Sequence Type Container) Sequence Type Container has a certain order. The sequence type container takes the data items to be taken one by one. Sequence type containers are: linked lists, arrays, etc.

Vector (vector type container) vector type container is derived from the sequence type container. Unlike the sequence type container, each data item of the vector type container has a numeric addressable address. In other words, you can take the first item to take the first item, I want to take the fifth item. When the sequence needs to return the data item of the specified location, the vector type container is a valid implementation. A useful implementation of vector type containers is an array.

MAP (Map Type Container) mapping type container is used to store key-value data pairs. You should pay special attention to this class because 90% of the container applications are based on the application of mapping type containers. The mapping type container can save associated data. For example, when you want to save a range of employee data, follow the employee ID, you can use the mapping type container, use the employee ID as a key, employee data class as data value: map.putpair ([1001, jimsmithobject]) ;

When you want to take out the employee ID of the employee ID 1001: Employee: = getObject (map.locate ([1001])) AS TEMPLOYEE; mapping type container is very valid for the lookup keyword! DECAL has two basic mapping type containers: Sort Map Type Containers (An Ordered Map: Red-Black Tree Red-Black Trees) Chaotic Mapping Type Container (AN Unordered Map). Based on Hash Hash Structures). Mapping Type Container Basic variant: MultiMap mapping type container. Their difference is that Multimaps can store multiple objects on the same keyword. Conventional mapping type containers can store different objects on the same keyword. Set (Set Type Container) Collection Type Container Stores data items. Similar to Delphi's collection concept, used to make you quickly confirm whether the collection contains or does not contain a specific data item. Unlike Delphi's collection type, you can use any atomic data type as a collection of elements such as numbers, strings, objects, and more. Similar to mapping type containers, the collection type container also has basic variants: MultiSets. MultiSet Collection Type Containers can allow multiple identical objects within a collection. There are two basic types of collection type containers: red-black binary tree and hash based.

Hashing has a data item or object into a number indicated by the data item or object.

转载请注明原文地址:https://www.9cbs.com/read-791.html

New Post(0)