CN109977123A - A kind of mobile terminal table data diff algorithm - Google Patents

A kind of mobile terminal table data diff algorithm Download PDF

Info

Publication number
CN109977123A
CN109977123A CN201910257897.9A CN201910257897A CN109977123A CN 109977123 A CN109977123 A CN 109977123A CN 201910257897 A CN201910257897 A CN 201910257897A CN 109977123 A CN109977123 A CN 109977123A
Authority
CN
China
Prior art keywords
new
data
model
queue
old
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.)
Pending
Application number
CN201910257897.9A
Other languages
Chinese (zh)
Inventor
杨敏
王能玉
倪向东
袁春雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Times Media Polytron Technologies Inc
Original Assignee
Times Media Polytron Technologies Inc
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Times Media Polytron Technologies Inc filed Critical Times Media Polytron Technologies Inc
Priority to CN201910257897.9A priority Critical patent/CN109977123A/en
Publication of CN109977123A publication Critical patent/CN109977123A/en
Pending legal-status Critical Current

Links

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a kind of mobile terminal table data diff algorithms, it follows the steps below to implement: S1: traversal new queue, it calculates the hash value of Model data model in every a line Item object and finds corresponding data model, so that new record number increases by 1, while being stored in new record list;S2: traversal legacy data queue calculates the hash value of Model data model in every a line Item object and finds corresponding data model, so that old record number increases by 1, while current data sequence number is stored in object sequence number storehouse, while being stored in old record list;S3: traversal new record list checks the corresponding object sequence number information of data model;S4: traversing new and old list again, checks the change state of each data model.A kind of mobile terminal table data diff algorithm of the present invention, has accomplished Local hydrodynamic unit for the refreshing of list, will do it Refresh Data or newly-increased for having the data of modification, brings better prospect of the application.

Description

A kind of mobile terminal table data diff algorithm
Technical field
The present invention relates to the field mobile Internet mobile phone A pp, in particular to a kind of mobile terminal table data diff algorithm.
Background technique
It is at present a kind of very common interface type, major part in App commonly used by us for list in mobile phone A pp Interface is made of list, and when the data that newly-increased, modification, deletion etc. occurs for table data update, we are often It is to need manual calculations to need index to be changed, and execute batch refresh, or even global heavily loaded method, behaviour can be called directly It is relatively complicated to make process, reduces working efficiency.
Summary of the invention
The main purpose of the present invention is to provide a kind of mobile terminal table data diff algorithms, when data are changed It waits, will automatically calculate the data of variation front and back, to provide accurate data for subsequent Refresh Data, improve list refreshing Efficiency, can effectively solve the problems in background technique.
To achieve the above object, the technical scheme adopted by the invention is as follows:
A kind of mobile terminal table data diff algorithm, follows the steps below to implement:
S1: traversal new queue calculates the hash value of Model data model in every a line Item object and finds corresponding data Model so that new record number increases by 1, while being stored in new record list;
S2: traversal legacy data queue calculates the hash value of Model data model in every a line Item object and finds corresponding data Current data sequence number so that old record number increases by 1, while being stored in object sequence number storehouse by model, while being stored in old record column Table;
S3: traversal new record list checks the corresponding object sequence number information of data model, if haveing been friends in the past queue serial number in storehouse Value, then it represents that current data model at least corresponds to two objects in new and old queue, that is, so-called data change occurs, is remembered Record, facilitates subsequent Query.It is updated again by checking that new queue existing object and model correspond to the whether identical confirmation of old object State;
S4: traversing new and old list again, checks the change state of each data model, does not change the object of state, in new team It is marked as increasing newly in column, and is then denoted as deleting in old queue, the object for the state that has altered is by comparing new and old Queue serial number and more new state divide table to be expressed as updating deletion and modification.
Preferably, the more new algorithm of the list stores the state of list using new and old hash table respectively.
Preferably, required hash table includes hash value institute in new queue for each entry model in list Record identical number, the same number that hash value is recorded in old queue.
Preferably, required hash table includes hash value in new queue for each entry model in list Identical number is recorded, the model in table also includes the state value for identifying whether stateful modification simultaneously.
Preferably, required hash table includes hash value in new queue for each entry model in list Identical number is recorded, the model in table also includes object sequence number heap corresponding to current hash in old queue simultaneously Stack.
Compared with prior art, the invention has the following beneficial effects:
In the present invention, Local hydrodynamic unit has been accomplished into the refreshing of list by way of a kind of diff algorithm and data-driven, for There are the data of modification just to will do it Refresh Data or newly-increased, while there is lower time complexity, improves efficiency, bring Better prospect of the application.
Detailed description of the invention
Fig. 1 is a kind of algorithm flow chart of mobile terminal table data diff algorithm of the present invention;
Fig. 2 is a kind of interface data frame diagram of mobile terminal table data diff algorithm of the present invention.
Specific embodiment
To be easy to understand the technical means, the creative features, the aims and the efficiencies achieved by the present invention, below with reference to Specific embodiment, the present invention is further explained.
As shown in Figs. 1-2, a kind of mobile terminal table data diff algorithm, follows the steps below to implement:
S1: traversal new queue calculates the hash value of Model data model in every a line Item object and finds corresponding data Model so that new record number increases by 1, while being stored in new record list;
S2: traversal legacy data queue calculates the hash value of Model data model in every a line Item object and finds corresponding data Current data sequence number so that old record number increases by 1, while being stored in object sequence number storehouse by model, while being stored in old record column Table;
S3: traversal new record list checks the corresponding object sequence number information of data model, if haveing been friends in the past queue serial number in storehouse Value, then it represents that current data model at least corresponds to two objects in new and old queue, that is, so-called data change occurs, is remembered Record, facilitates subsequent Query.It is updated again by checking that new queue existing object and model correspond to the whether identical confirmation of old object State;
S4: traversing new and old list again, checks the change state of each data model, does not change the object of state, in new team It is marked as increasing newly in column, and is then denoted as deleting in old queue, the object for the state that has altered is by comparing new and old Queue serial number and more new state divide table to be expressed as updating deletion and modification;
The more new algorithm of list stores the state of list using new and old hash table respectively;Required hash table, in list Each entry model include in new queue hash value record identical number, hash value is recorded in old queue Same number;Required hash table, for each entry model in list include in new queue hash value recorded Identical number, the model in table also include the state value for identifying whether stateful modification simultaneously;Required hash table, it is right Each entry model in list include in new queue hash value record identical number, the model in table is simultaneously Also include object sequence number storehouse corresponding to current hash in old queue.
It should be noted that the present invention is a kind of mobile terminal table data diff algorithm, when in use, new data team is traversed Column, calculate the hash value of Model data model in every a line Item object and find corresponding data model, so that new record number increases Add 1, while being stored in new record list, traverses legacy data queue, calculate the hash of Model data model in every a line Item object It is worth and finds corresponding data model, so that old record number increases by 1.Current data sequence number is stored in object sequence number storehouse simultaneously, It is stored in old record list simultaneously, traverses new record list, the corresponding object sequence number information of data model is checked, if had in storehouse Old queue sequence number value, then it represents that current data model at least corresponds to two objects in new and old queue, that is, so-called data occur Change, is recorded, facilitates subsequent Query.Again by check new queue existing object and model correspond to old object whether phase With confirmation more new state, new and old list is traversed again, the change state of each data model is checked, does not change pair of state As, it is marked as increasing newly in new queue, and be then denoted as deleting in old queue, the object for the state that has altered passes through New and old queue serial number and more new state divide table to be expressed as updating deletion and modification, more practical.
In the description of the present invention, it is to be understood that, term " coaxial ", " bottom ", " one end ", " top ", " middle part ", The orientation or positional relationship of the instructions such as " other end ", "upper", " side ", " top ", "inner", " front ", " center ", " both ends " is It is based on the orientation or positional relationship shown in the drawings, is merely for convenience of description of the present invention and simplification of the description, rather than instruction or dark Show that signified device or element must have a particular orientation, be constructed and operated in a specific orientation, therefore should not be understood as pair Limitation of the invention.
In addition, term " first ", " second ", " third ", " the 4th " are used for description purposes only, and should not be understood as instruction or It implies relative importance or implicitly indicates the quantity of indicated technical characteristic, define " first ", " second ", " the as a result, Three ", the feature of " the 4th " can explicitly or implicitly include at least one of the features.
In the present invention unless specifically defined or limited otherwise, term " installation ", " setting ", " connection ", " fixation ", Terms such as " being screwed on " shall be understood in a broad sense, for example, it may be being fixedly connected, may be a detachable connection, or integral;It can be with It is mechanical connection, is also possible to be electrically connected;It can be directly connected, two can also be can be indirectly connected through an intermediary The interaction relationship of connection or two elements inside a element, unless otherwise restricted clearly, for the common of this field For technical staff, the specific meanings of the above terms in the present invention can be understood according to specific conditions.
It although an embodiment of the present invention has been shown and described, for the ordinary skill in the art, can be with A variety of variations, modification, replacement can be carried out to these embodiments without departing from the principles and spirit of the present invention by understanding And modification, the scope of the present invention is defined by the appended.

Claims (5)

1. a kind of mobile terminal table data diff algorithm, follows the steps below to implement:
S1: traversal new queue calculates the hash value of Model data model in every a line Item object and finds corresponding data Model so that new record number increases by 1, while being stored in new record list;
S2: traversal legacy data queue calculates the hash value of Model data model in every a line Item object and finds corresponding data Current data sequence number so that old record number increases by 1, while being stored in object sequence number storehouse by model, while being stored in old record column Table;
S3: traversal new record list checks the corresponding object sequence number information of data model, if haveing been friends in the past queue serial number in storehouse Value, then it represents that current data model at least corresponds to two objects in new and old queue, that is, so-called data change occurs, is remembered Record facilitates subsequent Query, then is updated by checking that new queue existing object and model correspond to the whether identical confirmation of old object State;
S4: traversing new and old list again, checks the change state of each data model, does not change the object of state, in new team It is marked as increasing newly in column, and is then denoted as deleting in old queue, the object for the state that has altered is by comparing new and old Queue serial number and more new state divide table to be expressed as updating deletion and modification.
2. a kind of mobile terminal table data diff algorithm according to claim 1, it is characterised in that: the update of the list Algorithm stores the state of list using new and old hash table respectively.
3. a kind of mobile terminal table data diff algorithm according to claim 2, it is characterised in that: required hash table, For each entry model in list include in new queue hash value record identical number, hash in old queue The same number that value is recorded.
4. a kind of mobile terminal table data diff algorithm according to claim 3, it is characterised in that: required hash Table, for each entry model in list include in new queue hash value record identical number, the model in table The state value for identifying whether stateful modification is also included simultaneously.
5. a kind of mobile terminal table data diff algorithm according to claim 4, it is characterised in that: required hash Table, for each entry model in list include in new queue hash value record identical number, the model in table Object sequence number storehouse corresponding to current hash in old queue is also included simultaneously.
CN201910257897.9A 2019-04-01 2019-04-01 A kind of mobile terminal table data diff algorithm Pending CN109977123A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910257897.9A CN109977123A (en) 2019-04-01 2019-04-01 A kind of mobile terminal table data diff algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910257897.9A CN109977123A (en) 2019-04-01 2019-04-01 A kind of mobile terminal table data diff algorithm

Publications (1)

Publication Number Publication Date
CN109977123A true CN109977123A (en) 2019-07-05

Family

ID=67082202

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910257897.9A Pending CN109977123A (en) 2019-04-01 2019-04-01 A kind of mobile terminal table data diff algorithm

Country Status (1)

Country Link
CN (1) CN109977123A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110690980A (en) * 2019-09-19 2020-01-14 深圳证券通信有限公司 Sending algorithm of market data
CN112163004A (en) * 2020-10-14 2021-01-01 上海万向区块链股份公司 List processing and updating display system and method based on multi-chain data fusion

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101931944A (en) * 2010-07-23 2010-12-29 华为终端有限公司 Method, device and system for updating terminal patches on line
CN102520918A (en) * 2011-09-27 2012-06-27 深圳市五巨科技有限公司 Method and device for increasing list refreshing frequency
CN103425663A (en) * 2012-05-16 2013-12-04 中兴通讯股份有限公司 Method and device for creating tables, saving records and deleting records for embedded system database
CN105955670A (en) * 2016-05-12 2016-09-21 武汉斗鱼网络科技有限公司 Method and system for checking repeated list data in application
CN106302753A (en) * 2016-08-18 2017-01-04 福建天泉教育科技有限公司 The method and system of client-side program incremental update
CN107484003A (en) * 2017-07-01 2017-12-15 武汉斗鱼网络科技有限公司 Television listing data Local hydrodynamic unit method, storage medium, electronic equipment and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101931944A (en) * 2010-07-23 2010-12-29 华为终端有限公司 Method, device and system for updating terminal patches on line
CN102520918A (en) * 2011-09-27 2012-06-27 深圳市五巨科技有限公司 Method and device for increasing list refreshing frequency
CN103425663A (en) * 2012-05-16 2013-12-04 中兴通讯股份有限公司 Method and device for creating tables, saving records and deleting records for embedded system database
CN105955670A (en) * 2016-05-12 2016-09-21 武汉斗鱼网络科技有限公司 Method and system for checking repeated list data in application
CN106302753A (en) * 2016-08-18 2017-01-04 福建天泉教育科技有限公司 The method and system of client-side program incremental update
CN107484003A (en) * 2017-07-01 2017-12-15 武汉斗鱼网络科技有限公司 Television listing data Local hydrodynamic unit method, storage medium, electronic equipment and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110690980A (en) * 2019-09-19 2020-01-14 深圳证券通信有限公司 Sending algorithm of market data
CN110690980B (en) * 2019-09-19 2022-09-20 深圳证券通信有限公司 Sending method of market data
CN112163004A (en) * 2020-10-14 2021-01-01 上海万向区块链股份公司 List processing and updating display system and method based on multi-chain data fusion

Similar Documents

Publication Publication Date Title
US11277498B2 (en) Method, apparatus and system for processing data
CN109977123A (en) A kind of mobile terminal table data diff algorithm
US20170116321A1 (en) Ability to group multiple container databases as a single container database cluster
US20150161182A1 (en) Updating Database Schemas in a Zero-Downtime Environment
CN106294776A (en) A kind of data processing method and device
EP2990965B1 (en) Versatile data model
CN106802932A (en) A kind of method for routing of database, device and Database Systems
CN106407404A (en) A data storage method, a data management method and system, a database and a client
US10394805B2 (en) Database management for mobile devices
CN105975489A (en) Metadata-based online SQL code completion method
CN107391045A (en) A kind of directory space quota method and system
CN108023932A (en) A kind of implementation method based on Redis general-purpose proxies, storage medium and electronic equipment
CN103064908A (en) Method for rapidly removing repeated list through a memory
CN103077049A (en) Smart method and system for updating desktop navigation bar
CN102236707A (en) Method, device and system for obtaining update data of database
CN108829422A (en) A kind of dynamic deployment method and device
CN108255735A (en) Associated environment test method, electronic device and computer readable storage medium
CN103793401B (en) Set up the method and device of the shared index of multiple database table
CN105069046B (en) A kind of update method of navigation data, loading method and device
CN106503457B (en) Clinical data based on translational medicine analysis platform integrates technical data introduction method
CN104750743A (en) System and method for ticking and rechecking transaction files
CN116340318A (en) Method, device, equipment and storage medium for processing secondary index record
CN110176293A (en) A kind of image loading method, device and computer storage medium
US20160149794A1 (en) Automatic network routing engine agnostic of underlying inventory or network management system
CN112765269B (en) Data processing method, device, equipment and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190705

RJ01 Rejection of invention patent application after publication