CN109359111B - Android view access method and device - Google Patents
Android view access method and device Download PDFInfo
- Publication number
- CN109359111B CN109359111B CN201811153542.7A CN201811153542A CN109359111B CN 109359111 B CN109359111 B CN 109359111B CN 201811153542 A CN201811153542 A CN 201811153542A CN 109359111 B CN109359111 B CN 109359111B
- Authority
- CN
- China
- Prior art keywords
- android
- android view
- view
- processed
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephone Function (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides an access method and device of an android view, and the method comprises the following steps: constructing a storage base type of an android view set based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed; obtaining an expected value of each android view to be processed, wherein the expected value is used for pre-judging the expected query degree of the android view; sequentially storing the android views to be processed into the android view sets from high to low according to the expected numerical values; and when an instruction for inquiring the target android view is received, searching the target android view in the android view set by adopting a sequential searching method. By improving the storage structure of the android view set, the problem that the number of android views stored in the android view set is limited is solved, and the application scene of the android view set is expanded.
Description
Technical Field
The invention relates to the technical field of computers, in particular to an android view access method and device.
Background
In the Android system, an Android view is a super class, which is a basic component unit for Android system application layer interface visualization. While the android view set (LVS) may be used to store tall-wide and content-like android views, the layout direction may be horizontal or vertical. And because the android view set does not have a resource recycling and multiplexing mechanism, the method is very practical in some scenes in which the height and the width of the view need to be dynamically changed.
However, since the android view set stores a limited number of android views, generally less than 12, the application scenarios of the android view set are greatly limited.
Disclosure of Invention
The invention provides an android view access method and device, which solve the problem that the number of android views stored in an android view set is limited by improving the storage structure of the android view set and expand the application scene of the android view set.
In a first aspect, an embodiment of the present invention provides an access method for an android view, where the method includes:
constructing a storage base type of an android view set based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed;
obtaining an expected value of each android view to be processed, wherein the expected value is used for pre-judging the expected query degree of the android view;
sequentially storing the android views to be processed into the android view sets from high to low according to the expected numerical values;
and when an instruction for inquiring the target android view is received, searching the target android view in the android view set by adopting a sequential searching method.
Optionally, the obtaining an expected numerical value of each to-be-processed android view includes:
calculating an expected value of each of the to-be-processed android views according to the following formula:
wherein, the expected value of the android view for which the expected value is currently calculated in the android views to be processed is obtained, n is the total number of times of querying the android view set, and P isThe value of C is 0 or 1, where 0 represents that the currently calculated android view of the expected value is not queried in the ith query, and 1 represents that the currently calculated android view of the expected value is queried in the ith query.
Optionally, the sequentially storing the to-be-processed android views into the android view set according to the expected numerical values from high to low includes:
calculating the Hash address of each android view to be processed;
sequentially storing the hash addresses of the android views to be processed into the android view sets from high to low according to the expected numerical values;
and sequentially storing the key and the value of each android view to be processed into the position corresponding to the corresponding hash address according to the sequence of the expected numerical value from high to low.
Optionally, the searching for the target android view in the android view set by using a sequential search method includes:
calculating a hash address of the target android view;
sequentially comparing the keys stored at the positions corresponding to the Hash addresses of the target android view with the keys of the target android view;
taking a first key matched with a key of the target android view as a target key;
and taking the value corresponding to the target key as the value of the target android view.
Optionally, the Hash function of the first dimension of the two-dimensional HashMap uses a HashCode function built in the generalized HashMap, and the Hash function of the second dimension of the two-dimensional HashMap uses an SDBM function.
Optionally, the two-dimensional HashMap supports dynamic growth.
In a second aspect, an embodiment of the present invention provides an access apparatus for an android view, where the apparatus includes:
the device comprises a construction unit and a processing unit, wherein the construction unit is used for constructing a storage base type of an android view set based on a two-dimensional HashMap, the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed;
the obtaining unit is used for obtaining an expected value of each android view to be processed, and the expected value is used for pre-judging the degree to which the android view is expected to be queried;
the storage unit is used for sequentially storing the android views to be processed into the android view set from high to low according to the expected numerical values;
and the searching unit is used for searching the target android view in the android view set by adopting a sequential searching method when receiving an instruction for searching the target android view.
Optionally, the obtaining unit is specifically configured to:
calculating an expected value of each of the to-be-processed android views according to the following formula:
wherein, the expected value of the android view for which the expected value is currently calculated in the android views to be processed is obtained, n is the total number of times of querying the android view set, and P isThe value of C is 0 or 1, where 0 represents that the currently calculated android view of the expected value is not queried in the ith query, and 1 represents that the currently calculated android view of the expected value is queried in the ith query.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored, and when executed by a processor, the computer program implements any implementation of the above method for accessing an android view.
In a fourth aspect, an embodiment of the present invention provides a computer device, including a processor, a memory, and a computer program stored on the memory and executable on the processor, where the processor implements any implementation of the above method for accessing an android view when executing the computer program.
In the android view access method provided by the embodiment of the invention, a storage base type of an android view set is constructed based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed; obtaining an expected value of each android view to be processed, wherein the expected value is used for pre-judging the expected query degree of the android view; sequentially storing the android views to be processed into the android view sets from high to low according to the expected numerical values; and when an instruction for inquiring the target android view is received, searching the target android view in the android view set by adopting a sequential searching method. The storage base type of the android view set is constructed by adopting the two-dimensional HashMap, the storage structure of the android view set is improved, the problem that the number of android views stored in the android view set is limited is solved, and the application scene of the android view set is expanded.
Furthermore, the two-dimensional HashMap adopts the two-dimensional array as a basic structure of data storage, so that various types of to-be-processed android views can be stored conveniently, and on the other hand, the size of the two-dimensional array is fixed, the access speed is high, the structure is simple, and extra loss can not be caused.
Furthermore, an expected numerical value of the android view to be processed is introduced, the android view to be processed is sequentially stored into the android view set from high to low according to the expected numerical value, when an instruction for inquiring the target android view is received, the target android view is searched in the android view set by adopting a sequential searching method, and the target android view expected to be inquired can be searched more quickly.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a flowchart illustrating an access method for an android view in an embodiment of the present application;
FIG. 2 is a schematic structural diagram of an access device for an android view in an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a computer device in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer-readable storage medium in an embodiment of the present application.
Detailed Description
The embodiment of the invention provides an android view access method and device, and solves the problem that the number of android views stored in an android view set is limited by improving the storage structure of the android view set, and expands the application scene of the android view set.
The technical scheme in the embodiment of the invention has the following general idea:
constructing a storage base type of an android view set based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed; obtaining an expected value of each android view to be processed, wherein the expected value is used for pre-judging the expected query degree of the android view; sequentially storing the android views to be processed into the android view sets from high to low according to the expected numerical values; and when an instruction for inquiring the target android view is received, searching the target android view in the android view set by adopting a sequential searching method.
Therefore, the storage base type of the android view set is constructed by adopting the two-dimensional HashMap, the storage structure of the android view set is improved, the problem that the number of android views stored in the android view set is limited is solved, and the application scene of the android view set is expanded.
Furthermore, the two-dimensional HashMap adopts the two-dimensional array as a basic structure of data storage, so that various types of to-be-processed android views can be stored conveniently, and on the other hand, the size of the two-dimensional array is fixed, the access speed is high, the structure is simple, and extra loss can not be caused.
Furthermore, an expected numerical value of the android view to be processed is introduced, the android view to be processed is sequentially stored into the android view set from high to low according to the expected numerical value, when an instruction for inquiring the target android view is received, the target android view is searched in the android view set by adopting a sequential searching method, and the target android view expected to be inquired can be searched more quickly.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship. Further, the names of the variables or functions used herein may also be used in other implementations to indicate the same meaning, and are not limited herein.
Example one
An embodiment of the present invention provides an access method for an android view, please refer to fig. 1, where the method includes:
s101, constructing a storage base type of an android view set based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing to-be-processed android views.
In particular, HashMap is an important member of the Java Collection Framework (Java Collection Framework) and is also one of the most common frameworks in the Map family. In short, HashMap is an implementation of a Map interface based on a hash table, and a stored object contains both a Key and a Value. In HashMap, the key and value storage locations are computed and accessed quickly according to the hash algorithm. Two important parameters that affect the performance of HashMap include: initial capacity and loading factor. The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity of the hash table at the time of creation. The load factor is a measure of how full the hash table can be before its capacity is automatically increased. When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table can be expanded to have about twice the number of buckets as long as the hash table is subjected to a rehash operation for reconstructing the internal data structure. Because the capacity of the HashMap can be set to be much larger than the capacity of the storage structure adopted by the android view set in the prior art, the embodiment constructs the storage base type of the android view set based on the two-dimensional HashMap, and can solve the problem that the number of android views stored in the android view set in the prior art is limited. And the two-dimensional HashMap supports dynamic growth, and the storage capacity of the android view set can be expanded in subsequent use.
In addition, the two-dimensional HashMap adopted in the implementation is different from the two-dimensional HashMap in the broad sense, and in the data structure of the two-dimensional HashMap in the broad sense, only the HashMap is used as value, namely the HashMap is nested inside the HashMap, and the internal data structure of the HashMap is not revolutionarily changed, so that the situation that the one-dimensional linear structure is still maintained by the multi-dimensional HashMap is determined, and the storage performance and the failure rate of the multi-dimensional HashMap are not improved. Therefore, the two-dimensional array is used as a basic structure of the two-dimensional HashMap data storage in the embodiment, and compared with the ArrayList adopted by the multi-dimensional HashMap in the broad sense, the two-dimensional array can store various types of android views to be processed.
It should be noted that the to-be-processed android view may be an existing android view acquired from an android view set in the prior art, or a received new android view, or a new android view generated by the system itself, and the like, which is not limited herein.
S102, obtaining an expected numerical value of each android view to be processed, wherein the expected numerical value is used for pre-judging the expected query degree of the android view.
The higher the expected value is, the higher the extent to which the android view is expected to be queried, and specifically, the obtaining of the expected value of each to-be-processed android view includes, but is not limited to, the following ways:
in a first mode, the expected value of each to-be-processed android view is calculated according to the following formula:
wherein, the expected value of the android view for which the expected value is currently calculated in the android views to be processed is obtained, n is the total number of times of querying the android view set, and P isThe value of C is 0 or 1, where 0 represents that the currently calculated android view of the expected value is not queried in the ith query, and 1 represents that the currently calculated android view of the expected value is queried in the ith query.
And secondly, calculating the number of times of being queried of each android view to be processed in a preset time period, and taking the number of times as an expected value of the android view to be processed.
And thirdly, calculating the queried probability of each android view to be processed in a preset time period, and taking the probability as an expected value of the android view to be processed.
And calculating the inquired times of each android view to be processed in a preset time period, and multiplying the times by a time coefficient to obtain an expected value of the android view to be processed, wherein the time coefficient is in positive correlation with the inquired time of each android view to be processed. For example, the time coefficient may be an average value of values corresponding to the time when the android view to be processed is queried each time. For example, a pending android view is queried 2 times within a preset time period, the first time being at time 18: 30, this time corresponds to a value of 1830, the second time is time 19: 16, the value at this time is 1916, the average value is 1873, and the expected value of the to-be-processed android view is 3746 of 2 × 1873. It can be understood that, in the fourth embodiment, the value corresponding to the time within the preset time period is incremented.
And calculating the queried probability of each android view to be processed in a preset time period, and multiplying the probability by the value of a time coefficient to serve as an expected numerical value of the android view to be processed, wherein the time coefficient is in positive correlation with the queried time of each android view to be processed. The fifth mode is similar to the fourth mode and is not described again.
And a sixth mode, directly receiving the expected numerical value of each to-be-processed android view set by the staff.
The above-mentioned several ways, or the combination of the above-mentioned several ways, do not limit this embodiment, and in practical application, there may be other ways to obtain the expected value of each to-be-processed android view, and no limitation is made here.
Furthermore, the expected value of each to-be-processed android view can be updated according to a preset time interval, so that the expected value of each to-be-processed android view is dynamically managed.
S103, sequentially storing the android views to be processed into the android view set from high to low according to the expected numerical values.
Specifically, the sequentially storing the to-be-processed android views into the android view set according to the expected numerical values from high to low includes:
calculating a hash address of each android view to be processed, specifically, calculating the hash address of each android view to be processed according to a key and a hash function of each android view to be processed, wherein the hash addresses can be calculated after the android views to be processed are sorted according to expected values from high to low, or the hash addresses can be calculated and then the android views to be processed are sorted according to expected values from high to low, which is not limited herein;
sequentially storing the hash addresses of the android views to be processed into the android view set according to the sequence of the expected values from high to low, wherein if the android views to be processed are sequenced on the basis of the sequence of the expected values from high to low, the sorted hash addresses of the android views to be processed are sequentially stored into the android view set; if the android views to be processed are not sorted in advance based on the expected numerical values from high to low, a comparison method such as a bubbling method can be used, the android view to be processed corresponding to the highest expected numerical value is screened out each time, and then the hash addresses of the android views to be processed are stored in the android view set until all the hash addresses of the android views to be processed are stored in the android view set;
sequentially storing the keys and the values of each android view to be processed into the positions corresponding to the corresponding hash addresses according to the sequence of the expected values from high to low, and similarly, if the android views to be processed are sorted based on the sequence of the expected values from high to low, sequentially storing the keys and the values of the sorted android views to be processed into the positions corresponding to the corresponding hash addresses; if the android views to be processed are not sorted in advance based on the expected numerical values from high to low, a comparison method such as a bubble method can be used, the android view to be processed corresponding to the highest expected numerical value is screened out each time, and then the keys and the values of the android view to be processed are stored in the positions corresponding to the corresponding hash addresses until all the keys and the values of the android view to be processed are stored in the android view set.
In addition, the Hash function of the first dimension of the two-dimensional HashMap may use a HashCode function built in the generalized HashMap, and the Hash function of the second dimension may use an SDBM function. Specifically, the Hash value H in SDBM is calculated as follows:
H=(H<<6)+(H<<6)-H+ch
where ch is the ASCII code value for each character, H is initialized to 0, and < < is a left shift operator.
And S104, when an instruction for inquiring the target android view is received, searching the target android view in the android view set by adopting a sequential searching method.
Generally, the hash lookup method is fast and is a commonly used lookup method for hash tables. However, the android view set constructed in this embodiment is not limited in capacity, and if the stored android views exceed a certain number, for example, 1K, the efficiency will be low if the hash lookup method is continuously used, so that in this embodiment, the android views to be processed are sequentially stored in the android view set according to the expected numerical value from high to low, and then the target android view is searched in the android view set by using the sequential lookup method, so that the speed of searching the target android view can be increased with a high probability, and the lookup efficiency can be improved. Specifically, when an instruction for querying a target android view is received, a sequential lookup method is adopted to lookup the target android view in the android view set, and the method specifically includes:
calculating the hash address of the target android view, specifically, calculating the hash address of the target android view according to the key and the hash function of the target android view;
sequentially comparing the keys stored at the positions corresponding to the Hash addresses of the target android view with the keys of the target android view;
taking a first key matched with a key of the target android view as a target key;
and taking the value corresponding to the target key as the value of the target android view, wherein the found value of the target android view is the found value of the target android view.
Further, if the target key matched with the key of the target android view is not found, prompting that the android view corresponding to the key of the target android view cannot be found.
It should be further noted that the embodiment may be applied to devices with built-in android systems, including but not limited to devices such as an android television box, an android television, an android phone, and an android tablet computer.
In the embodiment, a storage base type of an android view set is constructed based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed; obtaining an expected value of each android view to be processed, wherein the expected value is used for pre-judging the expected query degree of the android view; sequentially storing the android views to be processed into the android view sets from high to low according to the expected numerical values; and when an instruction for inquiring the target android view is received, searching the target android view in the android view set by adopting a sequential searching method. The storage base type of the android view set is constructed by adopting the two-dimensional HashMap, the storage structure of the android view set is improved, the problem that the number of android views stored in the android view set is limited is solved, and the application scene of the android view set is expanded.
Furthermore, the two-dimensional HashMap in the embodiment adopts the two-dimensional array as a basic structure of data storage, so that various types of android views to be processed can be stored conveniently, and on the other hand, the two-dimensional array is fixed in size, high in access speed and simple in structure, and extra loss can not be caused.
Furthermore, according to the embodiment, an expected numerical value of the android view to be processed is introduced, the android view to be processed is sequentially stored into the android view set according to the sequence of the expected numerical value from high to low, when an instruction for querying a target android view is received, the target android view is searched in the android view set by adopting a sequential searching method, and the target android view to be queried can be searched more quickly.
Based on the same inventive concept, the embodiment of the invention also provides a device corresponding to the method in the first embodiment, which is shown in the second embodiment.
Example two
An embodiment of the present invention provides an access device for an android view, please refer to fig. 2, where the access device includes:
the device comprises a construction unit 201, a processing unit and a processing unit, wherein the construction unit is used for constructing a storage base type of an android view set based on a two-dimensional HashMap, the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed;
an obtaining unit 202, configured to obtain an expected value of each to-be-processed android view, where the expected value is used to pre-judge a degree to which the android view is expected to be queried;
the storage unit 203 is used for sequentially storing the android views to be processed into the android view set from high to low according to the expected numerical values;
the searching unit 204 is configured to, when receiving an instruction for querying a target android view, search the target android view in the android view set by using a sequential searching method.
In this embodiment, a storage base type of an android view set is constructed by a construction unit 201 based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed; obtaining an expected value of each to-be-processed android view through an obtaining unit 202, where the expected value is used for predicting a degree to which the android view is expected to be queried; sequentially storing the android views to be processed into the android view set from high to low according to the expected numerical values through a storage unit 203; when an instruction for querying a target android view is received, the target android view is searched in the android view set by a sequential searching method through the searching unit 204. Therefore, in the embodiment, the storage base type of the android view set is constructed by adopting the two-dimensional HashMap, the storage structure of the android view set is improved, the problem that the number of android views stored in the android view set is limited is solved, and the application scene of the android view set is expanded.
Furthermore, the two-dimensional HashMap of the embodiment adopts the two-dimensional array as a basic structure of data storage, so that various types of android views to be processed can be stored conveniently, and on the other hand, the size of the two-dimensional array is fixed, the access speed is high, the structure is simple, and extra loss can not be caused.
Furthermore, according to the embodiment, an expected numerical value of the android view to be processed is introduced, the android view to be processed is sequentially stored into the android view set according to the sequence of the expected numerical value from high to low, when an instruction for querying a target android view is received, the target android view is searched in the android view set by adopting a sequential searching method, and the target android view to be queried can be searched more quickly.
Since the apparatus described in the second embodiment of the present invention is an apparatus used for implementing the first embodiment of the present invention, based on the method described in the first embodiment of the present invention, those skilled in the art can understand the specific structure and the variation of the apparatus, and thus the details are not described herein. All the devices adopted in the method of the first embodiment of the present invention belong to the protection scope of the present invention.
EXAMPLE III
Based on the same inventive concept, the present embodiment provides a computer apparatus 300, as shown in fig. 3, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and capable of running on the processor 320, where when the processor 320 executes the computer program 311, all steps of the first embodiment can be implemented, and thus are not described herein again.
Example four
Based on the same inventive concept, the present embodiment provides a computer-readable storage medium 400, as shown in fig. 4, on which a computer program 411 is stored, and when the computer program 411 is executed by a processor, all steps of the first embodiment can be implemented, so that the detailed description is omitted here.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.
Claims (6)
1. An access method of an android view, the method comprising:
constructing a storage base type of an android view set based on a two-dimensional HashMap, wherein the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed;
obtaining an expected value of each android view to be processed, wherein the expected value is used for pre-judging the expected query degree of the android view;
sequentially storing the android views to be processed into the android view sets from high to low according to the expected numerical values;
when an instruction for inquiring a target android view is received, searching the target android view in the android view set by adopting a sequential searching method;
the obtaining the expected numerical value of each to-be-processed android view comprises:
calculating an expected value of each of the to-be-processed android views according to the following formula:
wherein, the expected value of the android view for which the expected value is currently calculated in the android views to be processed is obtained, n is the total number of times of querying the android view set, and P isThe value of C is 0 or 1, 0 represents that the android view currently calculating the expected value is not queried in the ith query, and 1 represents that the android view currently calculating the expected value is queried in the ith query;
the step of sequentially storing the android views to be processed into the android view set from high to low according to the expected numerical values comprises the following steps:
calculating the Hash address of each android view to be processed;
sequentially storing the hash addresses of the android views to be processed into the android view sets from high to low according to the expected numerical values;
sequentially storing the key and the value of each android view to be processed into the position corresponding to the corresponding hash address according to the sequence of the expected numerical value from high to low;
the searching the target android view in the android view set by adopting a sequential searching method comprises the following steps:
calculating a hash address of the target android view;
sequentially comparing the keys stored at the positions corresponding to the Hash addresses of the target android view with the keys of the target android view;
taking a first key matched with a key of the target android view as a target key;
and taking the value corresponding to the target key as the value of the target android view.
2. The method as claimed in claim 1, wherein the Hash function of the first dimension of the two-dimensional HashMap uses a HashCode function built in the generalized HashMap, and the Hash function of the second dimension of the two-dimensional HashMap uses an SDBM function.
3. The method of any one of claims 1-2, wherein the two-dimensional HashMap supports dynamic growth.
4. An access device for android views, the device comprising:
the device comprises a construction unit and a processing unit, wherein the construction unit is used for constructing a storage base type of an android view set based on a two-dimensional HashMap, the two-dimensional HashMap adopts a two-dimensional array as a basic structure of data storage, and the android view set is used for storing an android view to be processed;
the obtaining unit is used for obtaining an expected value of each android view to be processed, and the expected value is used for pre-judging the degree to which the android view is expected to be queried;
the storage unit is used for sequentially storing the android views to be processed into the android view set from high to low according to the expected numerical values;
the device comprises a searching unit, a searching unit and a searching unit, wherein the searching unit is used for searching a target android view in the android view set by adopting a sequential searching method when receiving an instruction for searching the target android view;
the obtaining unit is specifically configured to:
calculating an expected value of each of the to-be-processed android views according to the following formula:
wherein, the expected value of the android view for which the expected value is currently calculated in the android views to be processed is obtained, n is the total number of times of querying the android view set, and P isThe value of C is 0 or 1, 0 represents that the android view currently calculating the expected value is not queried in the ith query, and 1 represents that the android view currently calculating the expected value is queried in the ith query;
the step of sequentially storing the android views to be processed into the android view set from high to low according to the expected numerical values comprises the following steps:
calculating the Hash address of each android view to be processed;
sequentially storing the hash addresses of the android views to be processed into the android view sets from high to low according to the expected numerical values;
sequentially storing the key and the value of each android view to be processed into the position corresponding to the corresponding hash address according to the sequence of the expected numerical value from high to low;
the searching the target android view in the android view set by adopting a sequential searching method comprises the following steps:
calculating a hash address of the target android view;
sequentially comparing the keys stored at the positions corresponding to the Hash addresses of the target android view with the keys of the target android view;
taking a first key matched with a key of the target android view as a target key;
and taking the value corresponding to the target key as the value of the target android view.
5. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-3.
6. A computer device comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any one of claims 1-3 when executing the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811153542.7A CN109359111B (en) | 2018-09-30 | 2018-09-30 | Android view access method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811153542.7A CN109359111B (en) | 2018-09-30 | 2018-09-30 | Android view access method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109359111A CN109359111A (en) | 2019-02-19 |
CN109359111B true CN109359111B (en) | 2021-01-01 |
Family
ID=65348362
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811153542.7A Active CN109359111B (en) | 2018-09-30 | 2018-09-30 | Android view access method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109359111B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103455355A (en) * | 2013-09-05 | 2013-12-18 | 南京朗睿软件科技有限公司 | Android equipment, and asynchronous data uploading method and device for AdapterView of Android equipment |
CN106648708A (en) * | 2017-01-10 | 2017-05-10 | 深圳铂睿智恒科技有限公司 | Control method and system of Android system network view |
CN106662983A (en) * | 2015-12-31 | 2017-05-10 | 华为技术有限公司 | Method, apparatus and system for data reconstruction in distributed storage system |
CN107040422A (en) * | 2017-04-25 | 2017-08-11 | 浙江工业大学 | A kind of network big data method for visualizing cached based on materialization |
CN107291806A (en) * | 2017-05-16 | 2017-10-24 | 浙江工业大学 | A kind of Data View copy alternative manner in Web visible environments |
CN108089985A (en) * | 2017-12-14 | 2018-05-29 | 中国平安人寿保险股份有限公司 | Method of calibration, device, equipment and the readable storage medium storing program for executing of interface return parameters |
CN108293182A (en) * | 2015-11-27 | 2018-07-17 | 华为技术有限公司 | Mobile device and method |
CN108549534A (en) * | 2018-03-02 | 2018-09-18 | 惠州Tcl移动通信有限公司 | Graphic user interface redraws method, terminal device and computer readable storage medium |
-
2018
- 2018-09-30 CN CN201811153542.7A patent/CN109359111B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103455355A (en) * | 2013-09-05 | 2013-12-18 | 南京朗睿软件科技有限公司 | Android equipment, and asynchronous data uploading method and device for AdapterView of Android equipment |
CN108293182A (en) * | 2015-11-27 | 2018-07-17 | 华为技术有限公司 | Mobile device and method |
CN106662983A (en) * | 2015-12-31 | 2017-05-10 | 华为技术有限公司 | Method, apparatus and system for data reconstruction in distributed storage system |
CN106648708A (en) * | 2017-01-10 | 2017-05-10 | 深圳铂睿智恒科技有限公司 | Control method and system of Android system network view |
CN107040422A (en) * | 2017-04-25 | 2017-08-11 | 浙江工业大学 | A kind of network big data method for visualizing cached based on materialization |
CN107291806A (en) * | 2017-05-16 | 2017-10-24 | 浙江工业大学 | A kind of Data View copy alternative manner in Web visible environments |
CN108089985A (en) * | 2017-12-14 | 2018-05-29 | 中国平安人寿保险股份有限公司 | Method of calibration, device, equipment and the readable storage medium storing program for executing of interface return parameters |
CN108549534A (en) * | 2018-03-02 | 2018-09-18 | 惠州Tcl移动通信有限公司 | Graphic user interface redraws method, terminal device and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109359111A (en) | 2019-02-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107015985B (en) | Data storage and acquisition method and device | |
CN108205577B (en) | Array construction method, array query method, device and electronic equipment | |
US10068033B2 (en) | Graph data query method and apparatus | |
US20130046767A1 (en) | Apparatus and method for managing bucket range of locality sensitive hash | |
CN102129425B (en) | The access method of big object set table and device in data warehouse | |
CN108268476B (en) | Data query method and device | |
US20150370838A1 (en) | Index structure to accelerate graph traversal | |
US20160328445A1 (en) | Data Query Method and Apparatus | |
CN108304460B (en) | Improved database positioning method and system | |
JP2014528627A (en) | Data classification | |
US10810458B2 (en) | Incremental automatic update of ranked neighbor lists based on k-th nearest neighbors | |
CN106599091B (en) | RDF graph structure storage and index method based on key value storage | |
US20130159347A1 (en) | Automatic and dynamic design of cache groups | |
CN107203532A (en) | Construction method, the implementation method of search and the device of directory system | |
CN104598652B (en) | A kind of data base query method and device | |
CN105468644A (en) | Method and device for performing query in database | |
CN107203418B (en) | Method and device for selecting resources according to system configuration | |
WO2017095439A1 (en) | Incremental clustering of a data stream via an orthogonal transform based indexing | |
US11361195B2 (en) | Incremental update of a neighbor graph via an orthogonal transform based indexing | |
CN109359111B (en) | Android view access method and device | |
CN110659286B (en) | Dynamic space index method based on weakly balanced space tree and storage medium and device thereof | |
CN109213972A (en) | Determine the method, apparatus, equipment and computer storage medium of Documents Similarity | |
Arefin et al. | A Spatial Skyline Query for a Group of Users. | |
Liu et al. | GB-Tree: An efficient LBS location data indexing method | |
WO2017095421A1 (en) | Automatic selection of neighbor lists to be incrementally updated |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |