Boolean data storage method, device, computer equipment and storage medium
By customizing the number and number of bit fields of data units, creating containers based on configuration tables and using index numbers to store Boolean data, the problems of storage space waste and access performance in traditional Boolean data storage methods are solved, and flexible and efficient Boolean data management is achieved.
Patent Information
- Application Number
- CN202410775414.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-06-14
AI Technical Summary
Traditional Boolean data storage methods cannot flexibly match actual needs when faced with large amounts of data, resulting in wasted storage space or data loss, and affected access performance.
By customizing the number and amount of bit fields of each data unit, based on the amount of Boolean data in the configuration table, a container is created and index numbers are used to store Boolean data, supporting flexible capacity settings and efficient access.
It achieves flexibility and efficiency in Boolean data storage and access, reduces storage space waste, and improves the efficiency and convenience of data operations.
Smart Images

Figure CN118733002B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a Boolean data storage method, device, computer equipment and storage medium. Background Art
[0002] In software development, processing and compressing data is critical, especially when large amounts of data are involved. Boolean data types are often used for storage and judgment, because Boolean data usually only contains two states: true or false. For example, in a project, if you need to know how many subordinate organizations there are in the current superior organization, you only need to make a judgment based on whether the state exists or not.
[0003] The traditional Boolean storage method is that Boolean is stored in one byte with 8 bits. When faced with large amounts of Boolean data, a lot of storage space will be wasted, and performance may be affected when a large amount of Boolean data is accessed. If a bit field storage method based on binary operations is adopted, that is, one Boolean value is stored in each bit, although storage space for Boolean data is saved, the maximum number of Boolean data that can be stored must be determined in advance, which cannot match the number of Boolean data in the configuration table corresponding to the actual superior organization. If the estimated number of Boolean values is too large, unnecessary storage space will be wasted. If the estimated number of Boolean values is insufficient, Boolean data may be lost, which is not flexible enough for project requirements. Summary of the Invention
[0004] In view of this, the present invention provides a Boolean data storage method, apparatus, computer equipment and storage medium to solve the problem that the maximum amount of Boolean data that can be stored is determined in advance and cannot be matched with the amount of Boolean data in the configuration table corresponding to the actual superior organization.
[0005] In a first aspect, the present invention provides a Boolean data storage method, the method comprising: in response to a user's storage instruction for a first configuration table, determining the number of bit field bits that can be stored in each data unit and the target number of data units based on the number of Boolean data in the first configuration table, wherein each bit in the data unit represents a Boolean data in the first configuration table, and the number of Boolean data that can be stored in the target number of data units is greater than the number of Boolean data in the first configuration table; creating a first container corresponding to the first configuration table, assigning a corresponding index number to each data unit, and based on the index number corresponding to the data unit and the index value corresponding to the Boolean data in the first configuration table, storing the Boolean data in the first configuration table in sequence in the corresponding data units, the first container includes the target number of data units.
[0006] The Boolean data storage method provided in this embodiment customizes the number of bit field bits and the number of data units that can be stored in each data unit based on the number of Boolean data in the configuration table, so that the number of Boolean data that can be stored in the created container matches the number of Boolean data in the actual configuration table. This allows the container storage capacity to be flexibly set based on project requirements, and the Boolean data is stored in the data unit based on the index number of the data unit and the index value corresponding to the Boolean data, thereby facilitating subsequent operations such as access to the Boolean data.
[0007] In an optional embodiment, the bit field bit number includes multiple bit numbers, and based on the number of Boolean data in the first configuration table, the bit field bit number that can be stored in each data unit and the target number of data units are determined, including: based on the number of Boolean data in the first configuration table, determining the number of data units corresponding to each bit field bit; calculating the product value of each bit field bit and the number of data units corresponding to it, and calculating the difference between the product value and the number of Boolean data in the first configuration table; selecting the bit field bit number and the number of data units corresponding to the minimum difference as the bit field bit number and the target number of data units that can be stored in each data unit.
[0008] The present invention takes into account that different bit field bits correspond to different numbers of data units, and thus the allocated container capacities are also different. Therefore, under the premise that the container capacity is greater than the number of Boolean data in the configuration table, the bit field bit number and the number of data units with the smallest difference from the number of Boolean data can be selected to ensure that no excessive memory space is wasted.
[0009] In an optional embodiment, the method further includes: responding to a user's operation instruction on the target Boolean data, determining the data unit position of the target Boolean data based on the index value of the target Boolean data and the index number corresponding to each data unit, reading the state of the data unit position of the target Boolean data, and performing a bit operation based on the state of the target Boolean data.
[0010] The present invention determines the position of the data unit where the target Boolean data is located based on the index value of the Boolean data and the index number of the data unit, and performs corresponding bit operations, thereby improving the efficiency of searching and operating the target Boolean data.
[0011] In an optional embodiment, the method further includes: determining whether a first decimal value corresponding to a current data unit in the container is greater than zero; if so, decrementing the first decimal value by one and performing an AND operation with the current data unit to obtain a new data unit; performing an XOR operation on the Boolean data in the new data unit and the Boolean data in the current data unit to obtain an XOR operation result, calculating a second decimal value corresponding to the XOR operation result, and determining the second decimal value as the position of the true Boolean data in the current data unit; calculating the position of the true Boolean data in the first container based on the index number corresponding to the current data unit, the number of bits in the bit field, and the position of the true Boolean data in the current data unit; updating the data unit obtained by decrementing the first decimal value by one as the current data unit, and repeating the step of determining whether the first decimal value corresponding to the current data unit in the container is greater than zero until the first decimal value of the current data unit is equal to zero; and then looping to the next data unit in the container. After traversing all data units in the container, the number of all true Boolean data and their respective positions in the container are determined.
[0012] The present invention can clearly know the state of each Boolean data bit in each data unit by circulating the data units in the same container, and then clearly know the state, location and quantity of each Boolean data bit in the container, i.e., the configuration table.
[0013] In an optional embodiment, index numbers are assigned to data units in each container in a manner that assigns the same data unit index number. The method further includes: obtaining a first data unit in a first container and a second data unit in a second container, performing a bit operation on the Boolean data in the first data unit and the Boolean data in the second data unit, the first data unit and the second data unit corresponding to the same index number, and the number of bits that can be stored in the bit field of the data units in the first container and the second container is the same; if there is no Boolean data at a current position of the first data unit in the first container, but there is Boolean data at the same position of the second data unit in the second container, the Boolean data at the current position of the first data unit is defaulted to a false state, and the bit operation is performed on the Boolean data at the same position of the second data unit.
[0014] In addition to general addition, deletion, modification and query of single Boolean data, the present invention also supports the modification of Boolean values of the entire container, avoiding the tedious call of index values when modifying single Boolean data, and greatly improving the efficiency and convenience of data operations.
[0015] In an optional embodiment, the performing a bitwise operation on the Boolean data in the first data unit and the Boolean data in the second data unit includes: performing a logical OR operation on the Boolean data in the first data unit and the Boolean data in the second data unit, assigning the logical OR operation result to the first data unit, traversing all data units in the first container and all data units in the second container to obtain a new first container; or performing a logical AND operation on the Boolean data in the first data unit and the Boolean data in the second data unit, comparing the logical AND operation result with the Boolean data in the second data unit, determining whether the Boolean data set existing in the first data unit includes the Boolean data set existing in the second data unit, traversing all data units in the first container and all data units in the second container, and determining whether the Boolean data set existing in the first container includes the Boolean data set existing in the second container, wherein the existing Boolean data represents Boolean data in a true state. Alternatively, a logical exclusive OR operation is performed on the Boolean data in the first data unit and the Boolean data in the second data unit, the result of the logical exclusive OR operation is assigned to the first data unit, all data units in the first container and all data units in the second container are traversed, and the first container is updated; a logical exclusive OR operation is performed on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit, the result of the logical exclusive OR operation is assigned to the second data unit, all data units in the first container and all data units in the second container are traversed, and the second container is updated; a logical exclusive OR operation is performed on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit in the updated second container, the result of the logical exclusive OR operation is assigned to the first data unit, all data units in the first container and all data units in the second container are traversed, and the first container is updated again to exchange the Boolean data in the first container with the Boolean data in the second container.
[0016] Based on project requirements, the present invention performs AND operations between containers to realize the function of determining whether a container contains the Boolean data of another container. It performs bit operations between containers to realize the function of a container swallowing up the Boolean data of another container. It performs XOR operations between containers to realize the function of exchanging Boolean data of two containers and reversing Boolean data in containers.
[0017] In an optional embodiment, the method further includes: in response to a container generation instruction operated by a user, determining the number of data units based on the number of Boolean data in the second configuration table in the container generation instruction and the number of bit field bits that can be stored in each data unit; creating a container consisting of a corresponding number of data units in the second configuration table, matching the index value corresponding to the first Boolean data in the second configuration table with the position of the data unit corresponding to the starting index number based on the offset in the container generation instruction, and storing the Boolean data in the second configuration table in sequence; or, in response to a user update instruction for the first configuration table, judging whether the number of Boolean data that can be stored in the current target number of data units is greater than the number of Boolean data updates based on the number of Boolean data updates in the first configuration table in the update instruction; if the number of Boolean data that can be stored in the current target number of data units is not greater than the number of Boolean data updates, redetermining the number of bit field bits that can be stored in each data unit and the number of data units, and storing the Boolean data in the first configuration table in the redetermined data units based on the redetermined number of bit field bits that can be stored in each data unit.
[0018] In order to improve the development efficiency of developers, the present invention provides the function of manually generating or repairing Grids in the editor. Through an intuitive interface display, it can build and repair Boolean data containers corresponding to reasonable memory sizes according to the configuration table during development, reducing the workload of developers and greatly improving the development speed and convenience.
[0019] In a second aspect, the present invention provides a Boolean data storage device, which includes: a storage unit determination module for responding to a user's storage instruction for a first configuration table, and determining the number of bit field bits that can be stored in each data unit and the target number of data units based on the number of Boolean data in the first configuration table, wherein each bit in the data unit represents a Boolean data in the first configuration table, and the number of Boolean data that can be stored in the target number of data units is greater than the number of Boolean data in the first configuration table; a data storage module for assigning a corresponding index number to each data unit, and based on the index number corresponding to the data unit and the index value corresponding to the Boolean data in the first configuration table, storing the Boolean data in the first configuration table in sequence into the corresponding data unit.
[0020] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the Boolean data storage method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0021] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the Boolean data storage method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 is a schematic flow chart of a Boolean data storage method according to an embodiment of the present invention;
[0024] Figure 2 is a flow chart of another Boolean data storage method according to an embodiment of the present invention;
[0025] Figure 3 is an example flow chart of Boolean data processing according to an embodiment of the present invention;
[0026] Figure 4 is an example diagram of an editor interface according to an embodiment of the present invention;
[0027] Figure 5 is a block diagram of a Boolean data storage device according to an embodiment of the present invention;
[0028] Figure 6 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0030] In software development, processing and compressing data is crucial, especially when dealing with large amounts of data. For example, in a project, it's necessary to determine how many subordinate organizations (specific organizational entities) exist within a parent organization (the container array abstraction in this project). In situations where no other information is involved and the only requirement is to determine whether a state exists, this determination is typically made using the Boolean data type. Because Boolean data typically contains only two states: true or false, when faced with a large number of organizational Boolean values, using traditional Boolean storage methods not only wastes a significant amount of space (a Boolean byte is 8 bits) but can also impact performance when accessing large amounts of data. To more efficiently store this Boolean data, a high-performance method for compressing Boolean data is needed.
[0031] To optimize the storage and read access of large amounts of Boolean data, we designed a general composite data structure that combines high performance, development convenience, and code readability. This structure combines the efficient memory efficiency and access speed of bit fields based on binary operations, renumbers arrays with bit fields as elements, and encapsulates them into grids for easy reading and writing. The code data structure is reasonable and easy to read.
[0032] According to an embodiment of the present invention, an embodiment of a Boolean data storage method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0033] In this embodiment, a Boolean data storage method is provided, which can be used in the above-mentioned computer device. Figure 1 is a flow chart of a Boolean data storage method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0034] Step S101 , in response to a user's storage instruction for a first configuration table, determining the number of bit field bits that can be stored in each data unit and the target number of data units based on the number of Boolean data in the first configuration table.
[0035] Each bit in the data unit represents a Boolean data in the first configuration table, and the number of Boolean data that can be stored in the target number of data units is greater than the number of Boolean data in the first configuration table.
[0036] In an embodiment of the present invention, the number of bit fields that can be stored in each data unit can be set in advance to 32 bits or 64 bits. When the Boolean data in the configuration table is subsequently stored, the target number of data units can be fixedly calculated according to the preset number of bit fields. Taking 32 bits as an example, after responding to the user's storage instruction for the first configuration table, the number of Boolean data in the first configuration table can be obtained. For example, there are 70 Boolean data in the first configuration table. Based on the preset number of bit fields that can be stored in each data unit of 32 bits, the target number of data units can be determined to be 70 / 32=3 (rounded up), and the number of data units can be determined to be 3. Generally, the target number of data units is determined so that the number of Boolean data that can be stored in the target number of data units is greater than the minimum number value of the number of Boolean data in the first configuration table, ensuring that the amount of Boolean data that can be stored in the container does not cause too much waste of storage space. The capacity of the created container can be determined to be 3*32=96. This is for example only and is not limiting.
[0037] Step S102: Create a first container corresponding to the first configuration table, assign a corresponding index number to each data unit, and store the Boolean data in the first configuration table in the corresponding data unit in sequence based on the index number corresponding to the data unit and the index value corresponding to the Boolean data in the first configuration table.
[0038] The first container includes a target number of data units.
[0039] In an embodiment of the present invention, a container can be initialized and created based on the first configuration table, which can be represented by Grids and used to manage a determined target number of data units, wherein each data unit can be represented by a Grid, and each data unit can be assigned a corresponding unique Grid index number, such as sequentially assigning numbers item0, item1, item2..., for example, the index values corresponding to all Boolean data in the first configuration table are parsed to ensure that only 32-bit Boolean data can be stored in each data unit, and the index value corresponding to each Boolean data is divided by 32 to obtain the quotient and remainder. The quotient represents the index number of the stored data unit, and the remainder represents the position of the stored data unit, which can facilitate the use of an indexer to read, write, and locate data. For example, if the index value of the Boolean data is 72, 72 / 32≈2, 72%32=8, it can be determined that the index number of the stored data unit is 2, which is the 8th low bit in the bit field of item2. This is for example only and is not limiting.
[0040] The Boolean data storage method provided in this embodiment customizes the number of bit field bits and the number of data units that can be stored in each data unit based on the number of Boolean data in the configuration table, so that the number of Boolean data that can be stored in the created container matches the number of Boolean data in the actual configuration table. This allows the container storage capacity to be flexibly set based on project requirements, and the Boolean data is stored in the data unit based on the index number of the data unit and the index value corresponding to the Boolean data, thereby facilitating subsequent operations such as access to the Boolean data.
[0041] In this embodiment, a Boolean data storage method is provided, which can be used in the above-mentioned computer device. Figure 2 is a flow chart of a Boolean data storage method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0042] Step S201 : In response to a user's storage instruction for a first configuration table, the number of bit field bits that can be stored in each data unit and the target number of data units are determined based on the number of Boolean data in the first configuration table.
[0043] The number of bits in the bit field includes various types of bits. Specifically, the above step S201 includes:
[0044] Step S2011: Determine the number of data units corresponding to each bit field number based on the number of Boolean data in the first configuration table.
[0045] The number of bits of the bit field in the embodiment of the present invention may include 8 bits, 16 bits, 32 bits and 64 bits. This is just an example. It can be updated in real time according to the number of bits of the data type in the existing C#. It is not limited. According to the number of Boolean data in different configuration tables of the project, a suitable bit field can be selected as the basic data storage unit. The number of data units corresponding to different bit field bits will change accordingly. After responding to the storage instruction of the first configuration table, the number of data units corresponding to different bit field bits can be calculated based on the number of Boolean data in the configuration table. For example, if there are 70 Boolean data in the first configuration table, the number of data units corresponding to the 8-bit bit field can be calculated as 9, the number of data units corresponding to the 16-bit bit field is 5, the number of data units corresponding to the 32-bit bit field is 3, and the number of data units corresponding to the 64-bit bit field is 2. This is just an example.
[0046] Step S2012: Calculate the product of the number of bits in each bit field and the number of corresponding data units, and calculate the difference between the product and the number of Boolean data in the first configuration table, wherein the number of data units is the minimum value that makes the product greater than the number of Boolean data in the first configuration table.
[0047] In an embodiment of the present invention, the product value of the number of bits in each bit field and the number of corresponding data units can be calculated. For example, 8*9=72 bits corresponds to a difference of 2 with the number of Boolean data in the first configuration table, 16*5=80 bits corresponds to a difference of 10 with the number of Boolean data in the first configuration table, 32*3=96 bits corresponds to a difference of 26 with the number of Boolean data in the first configuration table, and 64*2=128 bits corresponds to a difference of 58 with the number of Boolean data in the first configuration table. This is just an example.
[0048] Step S2013: Select the number of bit field bits and the number of data units corresponding to the minimum difference value as the number of bit field bits that can be stored in each data unit and the target number of data units.
[0049] In an embodiment of the present invention, the number of bit field bits and the number of data units corresponding to the minimum difference value can be selected as the number of bit field bits that can be stored in each data unit and the target number of data units, that is, 8 fields and 9 data units corresponding to 72 are selected, which is only for example.
[0050] The present invention takes into account that different bit field bits correspond to different numbers of data units, and thus the allocated container capacities are also different. Therefore, under the premise that the container capacity is greater than the number of Boolean data in the configuration table, the bit field bit number and the number of data units with the smallest difference from the number of Boolean data can be selected to ensure that no excessive memory space is wasted.
[0051] Step S202: Create a first container corresponding to the first configuration table, assign a corresponding index number to each data unit, and based on the index number corresponding to the data unit and the index value corresponding to the Boolean data in the first configuration table, store the Boolean data in the first configuration table in the corresponding data unit in sequence. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0052] Step S203, in response to the user's operation instruction on the target Boolean data, based on the index value of the target Boolean data and the index number corresponding to each data unit, determine the data unit position where the target Boolean data is located, read the state of the data unit position where the target Boolean data is located, and perform a bit operation based on the state of the target Boolean data.
[0053] When the embodiment of the present invention performs addition, deletion, modification and query of Boolean data, a series of auxiliary functions can be defined to handle bit logic operations. These functions will accept the size of the Boolean data index value as a parameter and perform corresponding bit operations. There is no limitation on what specific operations the bit operations include, such as reading Boolean values, changing or clearing Booleans. Just as an example, for reading Boolean values, the number of bits in the bit field can be divided according to the index value corresponding to the target Boolean data to calculate the index number of the data unit and the remainder can be calculated to calculate the position in the data unit. Finally, the Boolean state of the position can be directly read to determine the Boolean value of the target Boolean data, that is, the Boolean state.
[0054] like Figure 3 As shown, to modify or clear a Boolean value, the Grid index number and data unit location can be calculated based on the index value corresponding to the target Boolean data. Bitwise operations (such as bitwise AND, bitwise OR, and bitwise inversion) can be used to modify the state of the target Boolean data. For example, if the current organization's planning index value is 120 (data that has been corrected by the Gridid offset), first divide it (data type System.UInt32) to obtain the Grid index 4 (rounded up), and then take the remainder to obtain 24. Therefore, the binary data changes performed on the 24th bit of the 32-bit binary system in Grid index 4 are performed. This is just an example.
[0055] The present invention determines the position of the data unit where the target Boolean data is located based on the index value of the Boolean data and the index number of the data unit, and performs corresponding bit operations, thereby improving the efficiency of searching and operating the target Boolean data.
[0056] In one embodiment, a method is used to determine whether a first decimal value corresponding to a current data unit in a container is greater than zero. If so, the first decimal value is decremented by one and then ANDed with the current data unit to obtain a new data unit. An exclusive-OR operation is performed on the Boolean data in the new data unit and the Boolean data in the current data unit to obtain an exclusive-OR operation result. A second decimal value corresponding to the exclusive-OR operation result is calculated, and the second decimal value is determined as the position of the true Boolean data in the current data unit. The position of the true Boolean data in the first container is calculated based on the index number, the number of bits in the bit field, and the position of the true Boolean data in the current data unit. The data unit obtained by decrementing the first decimal value by one is updated as the current data unit. The step of determining whether the first decimal value corresponding to the current data unit in the container is greater than zero is repeated until the first decimal value of the current data unit is equal to zero. The method then loops to the next data unit in the container. All data units in the container are traversed to determine the number of all true Boolean data and their respective positions in the container.
[0057] In an embodiment of the present invention, the first Grid of the Grids container, i.e., the data unit with index number zero, is obtained. Based on the Boolean data stored in the current data unit, a corresponding decimal value is calculated to determine whether the decimal value is greater than zero. If the decimal value is greater than zero, indicating that the data unit contains Boolean data in a true state, the decimal value corresponding to the current data unit can be subtracted by one for the first time (including the Boolean data after the subtraction) and then ANDed with the current data unit to obtain a new data unit, newGrid. The Boolean data in the new data unit can be XORed with the Boolean data in the current data unit to obtain an XOR result (including the Boolean data after the XOR), and the decimal value corresponding to the XOR result can be calculated. This decimal value can be determined as the position (BitPos) of the Boolean data in the current cycle that is in a true state in the data unit. The index number of the data unit * the number of bit fields + BitPos can also be calculated to determine the position of the Boolean data in the true state in the container.
[0058] The data unit after the first decimal subtraction process can then be subtracted by one twice to obtain a third data unit. It is determined whether the decimal value corresponding to the third data unit after the second subtraction process is greater than zero. If it is still greater than zero, it indicates that there is still Boolean data in the data unit in the true state. An AND operation can be performed on the data unit after the first subtraction process to obtain a fourth data unit. The Boolean data in the fourth data unit can then be XORed with the data unit after the first subtraction process to obtain an XOR operation result. The decimal value corresponding to the XOR result is calculated. The decimal value can be used as the position of the Boolean data in the true state in the current loop in the data unit, and then the position in the container is calculated. For detailed description, please refer to the above embodiment. The loop is continued until the decimal value corresponding to the data unit after the data unit with index number zero is zero after multiple subtraction processes, indicating that there is no Boolean data in the current data unit in the true state. The position of the Boolean data in the true state in each loop and the total number of loops are counted as the number of Boolean data in the true state in the data unit. This is only for example.
[0059] After the loop of the data unit with index number zero ends, the data unit with index number 1 can be obtained to determine the location and number of all Boolean data in the true state in the data unit with index number 1, until all data units in the container are traversed, and the location and number of all Boolean data in the true state in the container are statistically obtained.
[0060] The present invention can clearly know the state of each Boolean data bit in each data unit by circulating the data units in the same container, and then clearly know the state, location and quantity of each Boolean data bit in the container, i.e., the configuration table.
[0061] In one embodiment, a first data unit in a first container and a second data unit in a second container are obtained, and a bitwise operation is performed on the Boolean data in the first data unit and the Boolean data in the second data unit. If there is no Boolean data at a current position of the first data unit in the first container, but there is Boolean data at the same position of the second data unit in the second container, the Boolean data at the current position of the first data unit is assumed to be false, and the bitwise operation is performed on the Boolean data at the same position of the second data unit.
[0062] The data units in each container are assigned index numbers in the same data unit index number assignment manner. The first data unit and the second data unit have the same corresponding index numbers, and the number of bit fields that can be stored in the data units in the first container and the second container is the same.
[0063] In an embodiment of the present invention, a first data unit in a first container and a second data unit in a second container are obtained, and a bit operation can be performed on the Boolean data in the first data unit and the Boolean data in the second data unit to obtain a bit operation result. The bit operation method is not limited and can be an AND operation, an OR operation, or an XOR operation. As an example only, the obtained bit operation result can be used to recreate a container for storing the bit operation result, facilitating subsequent comparison of the relationship between the first container and the second container. The first data unit or the second data unit can also be updated based on the actual required amplitude to implement the data unit update.
[0064] During bitwise operations between data units in an embodiment of the present invention, it may happen that because the Boolean data stored in the first container is less than the Boolean data stored in the second container, there is no Boolean data at a certain position in the first data unit, but there is Boolean data at the same position in the second data unit. In this case, the state of the Boolean data at that position in the first data unit can be defaulted to a false state, and then the bitwise operation is performed on the Boolean data at the same position in the second data unit. This is just an example.
[0065] In addition to general addition, deletion, modification and query of single Boolean data, the present invention also supports the modification of Boolean values of the entire container, avoiding the tedious call of index values when modifying single Boolean data, and greatly improving the efficiency and convenience of data operations.
[0066] Specifically, performing a bit operation on the Boolean data in the first data unit and the Boolean data in the second data unit includes:
[0067] Perform a logical OR operation on the Boolean data in the first data unit and the Boolean data in the second data unit, assign the logical OR operation result to the first data unit, traverse all data units in the first container and all data units in the second container to obtain a new first container, or,
[0068] In the embodiment of the present invention, when organizations (entity organizations of container Grids, the data type is still a container, but the bit field Boolean data has a specific meaning) are merged, one organization swallows all subordinate organizations of another organization, so the Boolean value contained therein is not a single one. In order to reduce the amount of code, the OR operator is overloaded, and the two entity organization Grids (that is, a single Grid / data unit each time) are traversed to perform OR operations and assign values; the overloaded OR operator is automatically called, and the organization realizes the Boolean data change of swallowing the other organization.
[0069] like Figure 3 As shown, a logical OR operation can be performed on the Boolean data in the first data unit of the first container and the Boolean data in the second data unit of the second container, and the result of the logical OR operation is assigned to the first data unit. All data units in the first and second containers are traversed, and the results of the logical OR operation are assigned to the corresponding data units in the first container. This can generate a new first container, realizing the Boolean data change of the first container absorbing the second container.
[0070] For example: for two different entities organized in the same container (such as Grids1 and Grids2), Grids1 needs to merge all meaningful Boolean values in Grids2. First, traverse the size of Grids2 (the data types of Grids1 and Grids2 are the same, and are traversed at the same time). Each time is a Grid (data unit / bit field), and the Grid1 and Grid2 corresponding to the traversal of Grids1 and Grids2 respectively are ORed. At this time, the two bit fields are subjected to general binary operations, and the Boolean value symbolizing possession in Grid2 is set to 1. The OR operation is assigned to Grid1, and the traversal is completed; that is, the function of merging Grids1 into Grids2 is completed.
[0071] Perform a logical AND operation on the Boolean data in the first data unit and the Boolean data in the second data unit, compare the result of the logical AND operation with the Boolean data in the second data unit, determine whether the Boolean data set existing in the first data unit includes the Boolean data set existing in the second data unit, traverse all data units in the first container and all data units in the second container, determine whether the Boolean data set existing in the first container includes the Boolean data set existing in the second container, the existing Boolean data indicates that the state is true Boolean data, or,
[0072] like Figure 3As shown, in an embodiment of the present invention, a logical AND operation can be performed on the Boolean data in the first data unit in the first container and the Boolean data in the second data unit in the second container, and the result of the logical AND operation can be compared with the Boolean data in the second data unit. If the result of the logical AND operation is consistent with the Boolean data in the second data unit, it means that the Boolean data set existing in the first data unit includes the Boolean data set existing in the second data unit. If the Boolean data in any position is inconsistent, it means that the Boolean data set existing in the first data unit does not include the Boolean data set existing in the second data unit. For example, if the Boolean data in the first data unit is 110 and the Boolean data in the second data unit is 100, the first data unit and the second data unit are performed. After the AND operation, the AND operation result is 100. The AND operation result 100 is compared with the second data unit 100. If it is found that the Boolean data are consistent, it means that the Boolean data set existing in the first data unit includes the Boolean data set existing in the second data unit. As an example only, all data units in the first container and all data units in the second container are traversed. If it is determined that each data unit in the first container includes the corresponding data unit in the second container, it means that the Boolean data set existing in the first container includes the Boolean data set existing in the second container. If there is a data unit that is determined not to include the corresponding data unit in the second container, it is determined that the Boolean data set existing in the first container does not include the Boolean data set existing in the second container.
[0073] Perform a logical exclusive OR operation on the Boolean data in the first data unit and the Boolean data in the second data unit, assign the logical exclusive OR operation result to the first data unit, traverse all data units in the first container and all data units in the second container, and update the first container; perform a logical exclusive OR operation on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit, assign the logical exclusive OR operation result to the second data unit, traverse all data units in the first container and all data units in the second container, and update the second container; perform a logical exclusive OR operation on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit in the updated second container, assign the logical exclusive OR operation result to the first data unit, traverse all data units in the first container and all data units in the second container, and update the first container again to exchange the Boolean data in the first container with the Boolean data in the second container.
[0074] like Figure 3As shown, in an embodiment of the present invention, an XOR operation can be performed on the Boolean data in the first data unit in the first container and the Boolean data in the second data unit in the second container, and the XOR result can be assigned to the first data unit. After traversing all data units in the first container and all data units in the second container, an updated first container can be obtained. An XOR operation can be performed on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit in the second container, and the XOR result can be assigned to the second data unit. After traversing all data units in the first container and all data units in the second container, the second container can be updated. At this time, the Boolean data in the second container is the same as the Boolean data in the initial first container.
[0075] An exclusive OR operation is performed on the Boolean data of the updated first data unit in the first container and the Boolean data of the updated second data unit in the second container, and the exclusive OR operation result is assigned to the first data unit again. After traversing all data units in the first container and all data units in the second container, the first container is updated again. At this time, the Boolean data in the first container is the same as the Boolean data in the initial second container, realizing the interaction of the contents of the two containers without using an additional container for storage, thereby improving the efficiency of Boolean data operations.
[0076] In one embodiment, if it is necessary to reverse the Boolean data of the second and third bits in the first container, an empty container may be created, and then the second and third bits of the empty container may be assigned a value of 1. Then, an XOR operation may be performed on the empty container and the Boolean data in the first container to flip the Boolean data of the second and third bits in the first container, that is, to change the original Boolean data from 0 to 1 and from 1 to 0. This is for example only and is not intended to be limiting.
[0077] Based on project requirements, the present invention performs AND operations between containers to realize the function of determining whether a container contains the Boolean data of another container. It performs bit operations between containers to realize the function of a container swallowing up the Boolean data of another container. It performs XOR operations between containers to realize the function of exchanging Boolean data of two containers and reversing Boolean data in containers.
[0078] In one embodiment, in response to a container generation instruction executed by a user, the number of data units is determined based on the number of Boolean data in a second configuration table in the container generation instruction and the number of bits of a bit field that can be stored in each data unit; a container consisting of a corresponding number of data units in the second configuration table is created; an index value corresponding to the first Boolean data in the second configuration table is matched with a position of a data unit corresponding to a starting index number based on an offset in the container generation instruction, and the Boolean data in the second configuration table are stored sequentially; or,
[0079] like Figure 4As shown, the container generation instruction of the embodiment of the present invention may include the container script name, the number of Boolean data input according to the project configuration table (i.e., the capacity requirement for BitGrid), and because the position sequence numbers corresponding to the 32-bit data units in a general container are 0-31, or the position sequence numbers corresponding to the 64-bit data units are 0-65, if the sequence numbers of the Boolean data stored in the project configuration table are 5-40, the Gridid offset can be set, for example, set to 5, so that the sequence number represented by the first bit of the Boolean data matches the position of the data unit.
[0080] In response to the number of bits of the bit field set by the user (i.e., the data type of the bit field), the number of Boolean data and the offset, the number of data units can be determined based on the number of Boolean data and the number of bit field bits that can be stored in each data unit, and a container consisting of the corresponding number of data units in the configuration table can be created. Based on the offset, the index value corresponding to the first Boolean data in the second configuration table is matched with the position of the data unit corresponding to the starting index number, and the Boolean data in the second configuration table is stored in sequence.
[0081] In response to a user's update instruction for the first configuration table, based on the number of Boolean data updates in the first configuration table in the update instruction, determine whether the number of Boolean data that can be stored in the current target number of data units is greater than the number of Boolean data updates; if the number of Boolean data that can be stored in the current target number of data units is not greater than the number of Boolean data updates, redetermine the number of bit field bits that can be stored in each data unit and the number of data units, and based on the redetermined number of bit field bits that can be stored in each data unit, store the Boolean data in the first configuration table in the redetermined data unit.
[0082] An embodiment of the present invention responds to a user's update instruction for a configuration table, wherein the update instruction includes a script name of a container selected by the user for storage. Based on the updated number of Boolean data in the configuration table in the update instruction, it can be determined whether the number of Boolean data that can be stored in the container corresponding to the script name is greater than the updated number of Boolean data. If it is greater than the updated number of Boolean data, the updated Boolean data can be directly stored in the container. If it is not greater than the updated number of Boolean data, it is necessary to re-determine the number of bit field bits that can be stored in each data unit and the number of data units based on the number of Boolean data. For detailed description, please refer to the above embodiment and will not be repeated here. The Boolean data in the first configuration table can be stored in the re-determined data unit based on the re-determined number of bit field bits that can be stored in each data unit. This is only an example.
[0083] In order to improve the development efficiency of developers, the present invention provides the function of manually generating or repairing Grids in the editor. Through an intuitive interface display, it can build and repair Boolean data containers corresponding to reasonable memory sizes according to the configuration table during development, reducing the workload of developers and greatly improving the development speed and convenience.
[0084] In this embodiment, a Boolean data storage device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0085] This embodiment provides a Boolean data storage device, such as Figure 5 Shown, including:
[0086] The storage unit determination module 501 is used to respond to the user's storage instruction for the first configuration table and determine the number of bit field bits that can be stored in each data unit and the target number of data units based on the number of Boolean data in the first configuration table, wherein each bit in the data unit represents a Boolean data in the first configuration table, and the number of Boolean data that can be stored in the target number of data units is greater than the number of Boolean data in the first configuration table; the data storage module 502 is used to assign a corresponding index number to each data unit, and based on the index number corresponding to the data unit and the index value corresponding to the Boolean data in the first configuration table, store the Boolean data in the first configuration table in the corresponding data unit in sequence.
[0087] In some optional embodiments, the number of bit field bits includes multiple types of bit bits, and the storage unit determination module 501 includes: a quantity calculation unit, used to determine the number of data units corresponding to each bit field bit based on the number of Boolean data in the first configuration table; a product value calculation unit, used to calculate the product value of each bit field bit and the number of corresponding data units, and calculate the difference between the product value and the number of Boolean data in the first configuration table; wherein the number of data units is a minimum value such that the product value is greater than the number of Boolean data in the first configuration table; a storage unit determination unit, used to select the number of bit field bits and the number of data units corresponding to the minimum difference as the number of bit field bits that can be stored in each data unit and the target number of data units.
[0088] In some optional embodiments, the Boolean data storage device also includes: a bit operation module, which is used to respond to the user's operation instructions on the target Boolean data, determine the data unit position of the target Boolean data based on the index value of the target Boolean data and the index number corresponding to each data unit, read the state of the data unit position where the target Boolean data is located, and perform bit operations based on the state of the target Boolean data.
[0089] In some optional embodiments, the Boolean data storage device further includes: a data unit processing module, used to determine whether the first decimal value corresponding to the current data unit in the container is greater than zero, and if it is greater than zero, the first decimal value is subtracted by one and then an AND operation is performed on the current data unit to obtain a new data unit; an XOR operation module, used to perform an XOR operation on the Boolean data in the new data unit and the Boolean data in the current data unit to obtain an XOR operation result, and calculate a second decimal value corresponding to the XOR operation result, and determine the second decimal value as the position of the Boolean data in the true state in the current data unit; a position determination module, used to determine the position of the Boolean data in the true state based on the current data unit; The method includes a step of calculating the position of the true-state Boolean data in the first container based on the index number corresponding to the unit, the number of bits in the bit field, and the position of the true-state Boolean data in the current data unit; a loop position determination module, which is used to update the data unit after the first decimal value is subtracted by one as the current data unit, and repeatedly perform the step of determining whether the first decimal value corresponding to the current data unit in the container is greater than zero until the first decimal value of the current data unit is equal to zero; then looping to the next data unit in the container; and a container traversal module, which is used to traverse all data units in the container and determine the number of all true-state Boolean data and their respective positions in the container.
[0090] In some optional embodiments, index numbers are assigned to data units in each container in a manner that assigns the same data unit index number, and the Boolean data storage device further includes: an inter-container bit operation module, used to obtain a first data unit in a first container and a second data unit in a second container, and perform bit operations on the Boolean data in the first data unit and the Boolean data in the second data unit, the first data unit and the second data unit corresponding to the same index number, and the number of bit fields that can be stored in the data units in the first container and the second container is the same; a data bit operation module, used to, if there is no Boolean data at the current position of the first data unit in the first container, but there is Boolean data at the same position of the second data unit in the second container, then the Boolean data at the current position of the first data unit is defaulted to a false state, and perform bit operations on the Boolean data at the same position of the second data unit.
[0091] In some optional embodiments, the data bit operation module includes: an OR operation unit, configured to perform a logical OR operation on the Boolean data in the first data unit and the Boolean data in the second data unit, assign the logical OR operation result to the first data unit, traverse all data units in the first container and all data units in the second container to obtain a new first container, or,
[0092] An AND operation unit is used to perform a logical AND operation on the Boolean data in the first data unit and the Boolean data in the second data unit, compare the logical AND operation result with the Boolean data in the second data unit, determine whether the Boolean data set existing in the first data unit includes the Boolean data set existing in the second data unit, traverse all data units in the first container and all data units in the second container, determine whether the Boolean data set existing in the first container includes the Boolean data set existing in the second container, and the existing Boolean data indicates that the state is true Boolean data, or,
[0093] The first XOR unit is used to perform a logical XOR operation on the Boolean data in the first data unit and the Boolean data in the second data unit, assign the result of the logical XOR operation to the first data unit, traverse all data units in the first container and all data units in the second container, and update the first container; the result assignment unit is used to perform a logical XOR operation on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit, assign the result of the logical XOR operation to the second data unit, traverse all data units in the first container and all data units in the second container, and update the second container; the container traversal unit is used to perform a logical XOR operation on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit in the updated second container, assign the result of the logical XOR operation to the first data unit, traverse all data units in the first container and all data units in the second container, and update the first container again to exchange the Boolean data in the first container with the Boolean data in the second container.
[0094] In some optional embodiments, the Boolean data storage device further includes: a container generation module for determining, in response to a container generation instruction issued by a user, the number of data units based on the number of Boolean data in the second configuration table and the number of bit field bits that can be stored in each data unit in the container generation instruction; creating a container consisting of a corresponding number of data units in the second configuration table, matching, based on an offset in the container generation instruction, an index value corresponding to the first Boolean data in the second configuration table with a position of the data unit corresponding to the starting index number, and sequentially storing the Boolean data in the second configuration table; or a container repair module for determining, in response to a user update instruction for the first configuration table, whether the number of Boolean data that can be stored in the current target number of data units is greater than the number of Boolean data updates based on the number of Boolean data updates in the first configuration table in the update instruction; if the number of Boolean data that can be stored in the current target number of data units is not greater than the number of Boolean data updates, re-determining the number of bit field bits that can be stored in each data unit and the number of data units, and storing the Boolean data in the first configuration table in the re-determined data units based on the re-determined number of bit field bits that can be stored in each data unit.
[0095] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0096] The Boolean data storage device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0097] The embodiment of the present invention also provides a computer device having the above Figure 5 Boolean data storage device shown.
[0098] See also Figure 6 , Figure 6 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 6As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0099] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.
[0100] The memory 20 stores instructions that can be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0101] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0102] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0103] The computer device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The bus connection is taken as an example.
[0104] The input device 30 can receive input digital or character information and generate signal input related to user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touch pad, a pointer, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display, and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0105] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0106] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A Boolean data storage method, characterized in that: The method comprises: In response to a user's instruction to store the first configuration table, determining the number of bit field bits that can be stored in each data unit and a target number of data units based on the number of Boolean data in the first configuration table, wherein each bit in the data unit represents one Boolean data in the first configuration table, and the number of Boolean data that can be stored in the target number of data units is greater than the number of Boolean data in the first configuration table; A corresponding index number is assigned to each data unit, and based on the index number corresponding to the data unit and the index value corresponding to the Boolean data in the first configuration table, the Boolean data in the first configuration table is sequentially stored in the corresponding data unit.
2. The method according to claim 1, characterized in that The number of bit field bits includes multiple types of bit bits. Based on the number of Boolean data in the first configuration table, determining the number of bit field bits that can be stored in each data unit and the target number of data units includes: Determine the number of data units corresponding to each bit field number based on the number of Boolean data in the first configuration table; Calculating the product of the number of bits in each bit field and the number of corresponding data units, and calculating the difference between the product value and the number of Boolean data in the first configuration table, wherein the number of data units is a minimum value that makes the product value greater than the number of Boolean data in the first configuration table; The number of bit field bits and the number of data units corresponding to the minimum difference value are selected as the number of bit field bits that can be stored in each data unit and the target number of data units.
3. The method according to claim 1 or 2, characterized in that The method further comprises: In response to a user's operation instruction on the target Boolean data, the data unit position of the target Boolean data is determined based on the index value of the target Boolean data and the index number corresponding to each data unit, the state of the data unit position of the target Boolean data is read, and a bit operation is performed based on the state of the target Boolean data.
4. The method according to claim 1, wherein The method further comprises: Determine whether the first decimal value corresponding to the current data unit in the container is greater than zero. If so, decrement the first decimal value by one and perform an AND operation on the first decimal value and the current data unit to obtain a new data unit. Performing an XOR operation on the Boolean data in the new data unit and the Boolean data in the current data unit to obtain an XOR operation result, calculating a second decimal value corresponding to the XOR operation result, and determining the second decimal value as the position of the true Boolean data in the current data unit; Calculate the position of the true-state Boolean data in the first container based on the index number corresponding to the current data unit, the number of bits in the bit field, and the position of the true-state Boolean data in the current data unit; The data unit obtained by decrementing the first decimal value by one is updated as the current data unit, and the step of determining whether the first decimal value corresponding to the current data unit in the container is greater than zero is repeatedly performed until the first decimal value of the current data unit is equal to zero; then the loop is repeated to the next data unit in the container; Traverse all data units in the container and determine the number of all true-state Boolean data and their respective positions in the container.
5. The method according to claim 1, wherein Assigning index numbers to the data units in each container in the same data unit index number assignment manner, the method further comprising: Obtaining a first data unit in a first container and a second data unit in a second container, performing a bitwise operation on Boolean data in the first data unit and Boolean data in the second data unit, wherein the first data unit and the second data unit have the same index number, and the data units in the first container and the second container have the same number of storable bit fields; If there is no Boolean data at the current position of the first data unit in the first container, but there is Boolean data at the same position of the second data unit in the second container, the Boolean data at the current position of the first data unit is assumed to be false, and a bit operation is performed on the Boolean data at the same position of the second data unit.
6. The method according to claim 5, characterized in that The performing a bit operation on the Boolean data in the first data unit and the Boolean data in the second data unit includes: Performing a logical OR operation on the Boolean data in the first data unit and the Boolean data in the second data unit, assigning the logical OR operation result to the first data unit, traversing all data units in the first container and all data units in the second container to obtain a new first container, or, Perform a logical AND operation on the Boolean data in the first data unit and the Boolean data in the second data unit, compare the logical AND operation result with the Boolean data in the second data unit, determine whether the Boolean data set existing in the first data unit includes the Boolean data set existing in the second data unit, traverse all data units in the first container and all data units in the second container, determine whether the Boolean data set existing in the first container includes the Boolean data set existing in the second container, the existing Boolean data represents Boolean data whose state is true, or, Performing a logical exclusive OR operation on the Boolean data in the first data unit and the Boolean data in the second data unit, assigning the logical exclusive OR operation result to the first data unit, traversing all data units in the first container and all data units in the second container, and updating the first container; Performing a logical exclusive OR operation on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit, assigning the logical exclusive OR operation result to the second data unit, traversing all data units in the first container and all data units in the second container, and updating the second container; Perform a logical exclusive OR operation on the Boolean data of the first data unit in the updated first container and the Boolean data of the second data unit in the updated second container, assign the logical exclusive OR operation result to the first data unit, traverse all data units in the first container and all data units in the second container, and update the first container again to exchange the Boolean data in the first container with the Boolean data in the second container.
7. The method according to claim 1, characterized in that The method further comprises: In response to a container generation instruction executed by a user, determining the number of data units based on the number of Boolean data in the second configuration table in the container generation instruction and the number of bit fields that can be stored in each data unit; Create a container consisting of a corresponding number of data units in the second configuration table, match the index value corresponding to the first Boolean data in the second configuration table with the position of the data unit corresponding to the starting index number based on the offset in the container generation instruction, and store the Boolean data in the second configuration table in sequence, or, In response to a user's update instruction for the first configuration table, based on the number of Boolean data updates in the first configuration table in the update instruction, determining whether the number of Boolean data that can be stored in the current target number of data units is greater than the number of Boolean data updates; If the number of Boolean data that can be stored in the current target number of data units is not greater than the number of Boolean data updates, the number of bit field bits that can be stored in each data unit and the number of data units are redetermined, and based on the redetermined number of bit field bits that can be stored in each data unit, the Boolean data in the first configuration table is stored in the redetermined data unit.
8. A Boolean data storage device, characterized in that The device comprises: a storage unit determination module, configured to determine, in response to a user's storage instruction for the first configuration table, the number of bit field bits that can be stored in each data unit and a target number of data units based on the number of Boolean data in the first configuration table, wherein each bit in the data unit represents one Boolean data in the first configuration table, and the number of Boolean data that can be stored in the target number of data units is greater than the number of Boolean data in the first configuration table; The data storage module is used to assign a corresponding index number to each data unit, and based on the index number corresponding to the data unit and the index value corresponding to the Boolean data in the first configuration table, store the Boolean data in the first configuration table in the corresponding data unit in sequence.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the Boolean data storage method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the Boolean data storage method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Boolean expression storage and matching method and system based on bitmap
CN106469218A
Data processing method and device, storage medium and processor
CN109582295A