Terminal equipment and object sorting method
1. A terminal device, comprising:
the receiving component is used for receiving a sequencing instruction of the target attribute information;
the memory is used for storing program codes and data information generated when the terminal equipment runs;
a processor for executing the program code to implement the following processes: responding to a sorting instruction of the target attribute information, and determining an object under a corresponding directory of the sorting instruction; the ordering instruction is used for indicating that the objects are ordered according to the target attribute information; according to the determined object path corresponding to the object, searching target attribute information corresponding to the sorting instruction from the attribute information of the object included in a data information table, wherein at least one attribute information and object path corresponding to the object are stored in the data information table; the at least one attribute information is stored in the data information table when the object operation is carried out; ranking the determined objects based on the target attribute information.
2. The terminal device of claim 1, wherein the processor is specifically configured to:
according to the determined object path corresponding to the object, searching attribute information having a binding relationship with the object path in a data information table;
and determining target attribute information in the searched attribute information, wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
3. The terminal device of claim 1, wherein prior to said sorting the determined objects based on the target attribute information, the processor is further configured to:
if the target attribute information cannot be found from the data information table, accessing an object under the directory through a packaging interface, reading at least one attribute information corresponding to the object, and storing the at least one attribute information and an object path corresponding to the object into the data information table; and
and determining target attribute information corresponding to the object according to the sorting instruction.
4. The terminal device of claim 1, wherein the object is one of a subdirectory and a file.
5. The terminal device according to any one of claims 1 to 4, wherein the performing the object operation includes:
one of a view operation on the object, a sort operation on the object, and an edit operation on the object.
6. A method of object ranking, the method comprising:
responding to a sorting instruction of the target attribute information, and determining an object under a corresponding directory of the sorting instruction; the ordering instruction is used for indicating that the objects are ordered according to the target attribute information;
according to the determined object path corresponding to the object, searching target attribute information corresponding to the sorting instruction from the attribute information of the object included in a data information table, wherein at least one attribute information and object path corresponding to the object are stored in the data information table; the at least one attribute information is stored in the data information table when the object operation is carried out;
ranking the determined objects based on the target attribute information.
7. The method according to claim 6, wherein the searching for the target attribute information corresponding to the sorting instruction from the attribute information of the object included in the data information table according to the determined object path corresponding to the object includes:
according to the determined object path corresponding to the object, searching attribute information having a binding relationship with the object path in a data information table;
and determining target attribute information in the searched attribute information, wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
8. The method of claim 6, wherein prior to said sorting the determined objects based on the target attribute information, the method further comprises:
if the target attribute information cannot be found from the data information table, accessing an object under the directory through a packaging interface, reading at least one attribute information corresponding to the object, and storing the at least one attribute information and an object path corresponding to the object into the data information table; and
and determining target attribute information corresponding to the object according to the sorting instruction.
9. The method of claim 6, wherein the object is one of a subdirectory and a file.
10. A computer-readable storage medium having a computer program stored therein, the computer program characterized by: the computer program, when executed by a processor, implements the method of any of claims 6-9.
Background
The current file management application usually adopts a sorting method of directly reading the attribute of a file through an interface and judging the sequence of the file according to the attribute of the file, however, the sorting method needs to read the attribute of the file, such as the size of the file, the time of the file and the like, in each judgment; if 100 files are provided, each sorting needs to be performed 100 × 1 to 100 × 100 times of comparison, the number of times of comparison is increased by the square, and when there are many files, if the file system is slow at this time, the sorting speed is abnormally slow, and further the problem that the file system is jammed in sorting due to pressure increase is caused.
Disclosure of Invention
In order to solve the existing technical problem, embodiments of the present application provide a terminal device and an object sorting method, which can improve sorting speed and reduce pressure on a file system.
In order to achieve the above purpose, the technical solution of the embodiment of the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a terminal device, including:
the receiving component is used for receiving a sequencing instruction of the target attribute information;
the memory is used for storing program codes and data information generated when the terminal equipment runs;
a processor for executing the program code to implement the following processes: responding to a sorting instruction of the target attribute information, and determining an object under a corresponding directory of the sorting instruction; the ordering instruction is used for indicating that the objects are ordered according to the target attribute information; according to the determined object path corresponding to the object, searching target attribute information corresponding to the sorting instruction from the attribute information of the object included in a data information table, wherein at least one attribute information and object path corresponding to the object are stored in the data information table; the at least one attribute information is stored in the data information table when the object operation is carried out; ranking the determined objects based on the target attribute information.
The terminal device provided in the embodiment of the application, in response to the sorting instruction for the target attribute information, may determine an object in a directory corresponding to the sorting instruction, and search for the target attribute information corresponding to the sorting instruction from the attribute information of the object included in the data information table according to the object path corresponding to the determined object, where at least one attribute information and the object path corresponding to the object are stored in the data information table, and the at least one attribute information is stored in the data information table when the object operation is performed, and finally sort the determined object based on the target attribute information. When objects are sorted according to the target attribute information, the target attribute information is searched from the data information table instead of directly reading the target attribute information corresponding to the objects through the interface, so that the sorting speed of sorting the objects can be improved.
In one possible implementation, the processor is specifically configured to:
according to the determined object path corresponding to the object, searching attribute information having a binding relationship with the object path in a data information table;
and determining target attribute information in the searched attribute information, wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
The terminal device may search, according to the object path corresponding to the determined object, the attribute information having a binding relationship with the object path in the data information table, and determine the target attribute information from the searched attribute information, where the attribute type of the target attribute information is the attribute type indicated by the sorting instruction. Therefore, the attribute type of the searched target attribute information is the attribute type indicated by the sequencing instruction, and the searching accuracy is ensured.
In one possible implementation, before the sorting the determined objects based on the target attribute information, the processor is further configured to:
if the target attribute information cannot be found from the data information table, accessing an object under the directory through a packaging interface, reading at least one attribute information corresponding to the object, and storing the at least one attribute information and an object path corresponding to the object into the data information table; and
and determining target attribute information corresponding to the object according to the sorting instruction.
Before sequencing the determined objects based on the target attribute information, if the target attribute information cannot be found from the data information table, the terminal device may access the objects in the directory through the encapsulation interface, read at least one attribute information corresponding to the objects, store the at least one attribute information and the object path corresponding to the objects in the data information table, and may determine the target attribute information corresponding to the objects according to the sequencing instruction. Therefore, the sorting efficiency of sorting the objects can be improved, and the sorting time can be reduced.
In one possible implementation, the object is one of a subdirectory and a file.
The terminal equipment can only sort the subdirectories under the directory, can also sort the files under the directory, and can also sort the subdirectories and the files under the directory together.
In one possible implementation manner, the performing the object operation includes:
one of a view operation on the object, a sort operation on the object, and an edit operation on the object.
The terminal device may store at least one attribute information corresponding to the object in the data information table when performing a viewing operation on the object in the directory, may store at least one attribute information corresponding to the object in the data information table when performing a sorting operation on the object in the directory, and may store at least one attribute information corresponding to the object in the data information table when performing an editing operation on the object in the directory.
In a second aspect, an embodiment of the present application provides an object sorting method, including:
responding to a sorting instruction of the target attribute information, and determining an object under a corresponding directory of the sorting instruction; the ordering instruction is used for indicating that the objects are ordered according to the target attribute information;
according to the determined object path corresponding to the object, searching target attribute information corresponding to the sorting instruction from the attribute information of the object included in a data information table, wherein at least one attribute information and object path corresponding to the object are stored in the data information table; the at least one attribute information is stored in the data information table when the object operation is carried out;
ranking the determined objects based on the target attribute information.
In a possible implementation manner, the searching, according to the determined object path corresponding to the object, for the target attribute information corresponding to the sorting instruction from the attribute information of the object included in the data information table includes:
according to the determined object path corresponding to the object, searching attribute information having a binding relationship with the object path in a data information table;
and determining target attribute information in the searched attribute information, wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
In a possible implementation manner, before the sorting the determined objects based on the target attribute information, the method further includes:
if the target attribute information cannot be found from the data information table, accessing an object under the directory through a packaging interface, reading at least one attribute information corresponding to the object, and storing the at least one attribute information and an object path corresponding to the object into the data information table; and
and determining target attribute information corresponding to the object according to the sorting instruction.
In one possible implementation, the object is one of a subdirectory and a file.
In one possible implementation, the performing the object operation includes:
one of a view operation on the object, a sort operation on the object, and an edit operation on the object.
In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the object sorting method of the second aspect is implemented.
In a fourth aspect, an embodiment of the present application further provides an object sorting apparatus, where the apparatus includes:
the object determining unit is used for responding to a sorting instruction of the target attribute information and determining an object under a corresponding directory of the sorting instruction; the ordering instruction is used for indicating that the objects are ordered according to the target attribute information;
the attribute searching unit is used for searching target attribute information corresponding to the sorting instruction from the attribute information of the objects included in a data information table according to the determined object path corresponding to the object, wherein at least one attribute information and object path corresponding to the object are stored in the data information table; the at least one attribute information is stored in the data information table when the object operation is carried out;
and the object sorting unit is used for sorting the determined objects based on the target attribute information.
In a possible implementation manner, the attribute searching unit is specifically configured to:
according to the determined object path corresponding to the object, searching attribute information having a binding relationship with the object path in a data information table;
and determining target attribute information in the searched attribute information, wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
In a possible implementation manner, the attribute searching unit is further configured to:
if the target attribute information cannot be found from the data information table, accessing an object under the directory through a packaging interface, reading at least one attribute information corresponding to the object, and storing the at least one attribute information and an object path corresponding to the object into the data information table; and
and determining target attribute information corresponding to the object according to the sorting instruction.
In one possible implementation, the object is one of a subdirectory and a file.
In one possible implementation, the performing the object operation includes:
one of a view operation on the object, a sort operation on the object, and an edit operation on the object.
For technical effects brought by any one implementation manner of the second aspect, the third aspect, or the fourth aspect, reference may be made to technical effects brought by the implementation manner of the first aspect, and details are not described here.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of another terminal device provided in an embodiment of the present application;
fig. 3 is a schematic flowchart of an object sorting method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another object sorting method according to an embodiment of the present application;
fig. 5 is a schematic interface diagram of a terminal device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an object sorting apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be described in further detail with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all embodiments. 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 application.
Fig. 1 schematically illustrates a structural diagram of a terminal device provided in an embodiment of the present application. As shown in fig. 1, the terminal device provided in the embodiment of the present application includes a processor 103, a memory 102, and a receiving component 101.
The receiving component 101 is configured to receive a sorting instruction for the target attribute information.
A memory 102, configured to store data information generated by the terminal device during operation and program code used by the processor 103 during operation, such as the program code of the object sorting method provided in the embodiment of the present application, where the program code may be executed by the processor 103.
The processor 103 may include one or more Central Processing Units (CPUs), or digital processing units, etc. A processor 103 for calling the program code stored in the memory 102 to implement the following processes: responding to a sorting instruction of the target attribute information, and determining an object under a corresponding directory of the sorting instruction; the ordering instruction is used for indicating that the objects are ordered according to the target attribute information; according to the determined object path corresponding to the object, searching target attribute information corresponding to the sequencing instruction from the attribute information of the object included in the data information table, wherein at least one attribute information and object path corresponding to the object are stored in the data information table; at least one attribute information is stored in the data information table when the object operation is carried out; the determined objects are sorted based on the target attribute information.
The specific connection medium among the receiving component 101, the memory 102 and the processor 103 is not limited in the embodiments of the present application. In the embodiment of the present application, in fig. 1, the receiving component 101, the memory 102, and the processor 103 are connected by a bus 104, and the connection manner among other components is only schematically illustrated and is not limited to this. The bus 104 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 1, but it is not intended that there be only one bus or one type of bus.
In one embodiment, the terminal device may be a smart device, such as a mobile phone, a tablet computer, a notebook computer, and the like. As shown in fig. 2, the terminal device includes: a Radio Frequency (RF) circuit 210, a memory 220, an input unit 230, a display unit 240, a sensor 250, an audio circuit 260, a wireless fidelity (WiFi) module 270, a processor 280, and the like. Those skilled in the art will appreciate that the terminal device configuration shown in fig. 2 is not intended to be limiting of terminal devices and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following specifically describes each constituent component of the terminal device with reference to fig. 2:
the RF circuit 210 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 280; in addition, the data for designing uplink is transmitted to the base station.
The memory 220 may be configured to store software programs and modules, such as program instructions corresponding to the object sorting method in the embodiment of the present application, and the processor 280 executes various functional applications and data processing of the terminal device, such as the object sorting method provided in the embodiment of the present application, by executing the software programs stored in the memory 220. The memory 220 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program of at least one application, and the like; the storage data area may store data created according to the use of the terminal device, and the like. Further, the memory 220 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 230 may be used to receive numeric or character information input by a user and generate key signal inputs related to user settings and function control of the terminal.
Alternatively, the input unit 230 may include a touch panel 231 and other input devices 232.
The touch panel 231, also referred to as a touch screen, may collect touch operations of a user on or near the touch panel 231 (for example, operations of the user on or near the touch panel 231 using any suitable object or accessory such as a finger or a stylus pen), and implement corresponding operations according to a preset program, for example, operations of the user clicking a shortcut identifier of a function module, and the like. Alternatively, the touch panel 231 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and then provides the touch point coordinates to the processor 280, and can receive and execute commands from the processor 280. In addition, the touch panel 231 may be implemented in various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave.
Alternatively, other input devices 232 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 240 may be used to display information input by a user or interface information presented to the user, and various menus of the terminal device. The display unit 240 is a display system of the terminal device, and is configured to present an interface, such as a display desktop, an operation interface of an application, or an operation interface of a live application.
The display unit 240 may include a display panel 241. Alternatively, the Display panel 241 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
Further, the touch panel 231 may cover the display panel 241, and when the touch panel 231 detects a touch operation thereon or nearby, the touch panel is transmitted to the processor 280 to determine the type of the touch event, and then the processor 280 provides a corresponding interface output on the display panel 241 according to the type of the touch event.
Although in fig. 2, the touch panel 231 and the display panel 241 are two separate components to implement the input and output functions of the terminal device, in some embodiments, the touch panel 231 and the display panel 241 may be integrated to implement the input and output functions of the terminal.
The terminal device may also include at least one sensor 250, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 241 according to the brightness of ambient light, and a proximity sensor that turns off the backlight of the display panel 241 when the terminal device is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of the electronic device, vibration recognition related functions (such as pedometer, tapping) and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal device, detailed description is omitted here.
Audio circuitry 260, speaker 261, and microphone 262 may provide an audio interface between the user and the terminal device. The audio circuit 260 may transmit the electrical signal converted from the received audio data to the speaker 261, and convert the electrical signal into a sound signal by the speaker 261 and output the sound signal; on the other hand, the microphone 262 converts the collected sound signal into an electric signal, which is received by the audio circuit 260 and converted into audio data, which is then processed by the audio data output processor 280, and then transmitted to, for example, another terminal device via the RF circuit 210, or output to the memory 220 for further processing.
WiFi belongs to a short-distance wireless transmission technology, and the terminal device can help a user send and receive e-mails, browse webpages, access streaming media and the like through the WiFi module 270, and provides wireless broadband internet access for the user. Although fig. 2 shows the WiFi module 270, it is understood that it does not belong to the essential constitution of the terminal device, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 280 is a control center of the terminal device, connects various parts of the entire terminal device using various interfaces and lines, and performs various functions of the terminal device and processes data by operating or executing software programs and/or modules stored in the memory 220 and calling data stored in the memory 220, thereby integrally monitoring the terminal device. Alternatively, processor 280 may include one or more processing units; optionally, the processor 280 may integrate an application processor and a modem processor, wherein the application processor mainly processes software programs such as an operating system, applications, and functional modules inside the applications, for example, the object sorting method provided in the embodiment of the present application. The modem processor handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 280.
It will be appreciated that the configuration shown in fig. 2 is merely illustrative and that the terminal device may include more or fewer components than shown in fig. 2 or may have a different configuration than shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
The present sorting method commonly used by file management applications is to judge which file is in front of which file is in back by judging the attributes of two files, and each time judging whether the attribute of the file needs to be read, such as whether the file is a file, the size of the file, the time of the file, etc.; if 100 files are provided, each sorting needs to be performed 100 × 1 to 100 × 100 times of comparison, the number of times of comparison is increased by the square, and when there are many files, if the file system is slow at this time, the sorting speed is abnormally slow, which greatly affects the user experience.
In order to improve the sorting speed, an embodiment of the present application provides an object sorting method, which may determine an object in a directory corresponding to a sorting instruction, search, according to an object path corresponding to the determined object, target attribute information corresponding to the sorting instruction from attribute information of the object included in a data information table, and then sort the determined object based on the target attribute information.
In some embodiments, a flowchart of the object sorting method executed by the terminal device may be shown in fig. 3, and includes the following steps:
step S301, responding to the sorting instruction of the target attribute information, and determining the object under the directory corresponding to the sorting instruction.
Wherein the sorting instruction is used for indicating that the objects are sorted according to the target attribute information. The object may be a subdirectory under the directory, or may be a file under the directory. For example, the directory may be a folder, and the folder may include only files, only subfolders, and also subfolders and files.
Step S302, according to the determined object path corresponding to the object, searching for target attribute information corresponding to the sorting instruction from the attribute information of the object included in the data information table.
The data information table may store at least one attribute information and an object path corresponding to the object, where the at least one attribute information is stored in the data information table when the object operation is performed. The object operation may be one of a view operation on the object, a sort operation on the object, and an edit operation on the object.
The attribute information of the object may be a name of the object, a size of the object, a type of the object, a time of the object, and the like, which is not limited in this embodiment of the application.
According to the determined object path corresponding to the object, the attribute information having a binding relationship with the object path can be searched in the data information table, and the target attribute information can be determined in the searched attribute information. Wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
Step S303, the determined objects are sorted based on the target attribute information.
After the target attribute information corresponding to the objects in the directory is found, the determined objects can be sorted according to the target attribute information.
When the determined objects are sorted, the objects can be compared pairwise according to the target attribute information corresponding to the objects, and which object is in front of the object is judged, and which object is behind the object. For example, a directory contains 5 objects, namely an object a, an object B, an object C, an object D, and an object E, and the objects need to be sorted according to their sizes from large to small. Assuming that the size of object A is 2.1M, the size of object B is 1.3M, the size of object C is 3.2M, the size of object D is 2.3M, and the size of object E is 1.5M, object A and object B may be compared first, and since 2.1M is greater than 1.3M, object A should be ranked in front of object B, which is ranked ABCDE. Object a can then be compared to object C, which should be ranked ahead of object a since 2.1M is less than 3.2M, this time ranked as CABDE. Object D may then be compared to object C, which should be placed in front of object D since 2.3M is less than 3.2M, and then object D may also be compared to object a since 2.3M is greater than 2.1M, which should be placed in front of object a, this time in the order CDABE. Then object E can be compared to object C, since 1.5M is less than 3.2M, object C should be placed in front of object E, then object E should also be compared to object D, since 1.5M is less than 2.3M, object D should be placed in front of object E, then object E should also be compared to object a, since 1.5M is less than 2.1M, object a should be placed in front of object E, then object E should also be compared to object B, since 1.5M is greater than 1.3M, object E should be placed in front of object B, this time the ranking is CDAEB. Therefore, the sorting process of sorting the object A, the object B, the object C, the object D and the object E according to the sizes of the objects from large to small can be completed, and the obtained final sorting is CDAEB.
In an embodiment, before the determined objects are sorted based on the target attribute information, if the target attribute information cannot be found from the data information table, the objects under the directory may be accessed through the encapsulation interface, at least one attribute information corresponding to the objects is read, the at least one attribute information and the object path corresponding to the objects are stored in the data information table, and the target attribute information corresponding to the objects is determined according to the sorting instruction.
The object sorting method provided in the embodiment of the application, in response to a sorting instruction for the object attribute information, may determine an object in a directory corresponding to the sorting instruction, and search for the object attribute information corresponding to the sorting instruction from the attribute information of the object included in the data information table according to a determined object path corresponding to the object, where at least one attribute information and an object path corresponding to the object are stored in the data information table, and the at least one attribute information is stored in the data information table when the object operation is performed, and finally sort the determined object based on the object attribute information. When objects are sorted according to the target attribute information, the target attribute information is searched from the data information table instead of directly reading the target attribute information corresponding to the objects through the interface, so that the sorting speed of sorting the objects can be improved.
In other embodiments, a flowchart of the object sorting method executed by the terminal device may be shown in fig. 4, and includes the following steps:
step S401, responding to the ordering instruction of the target attribute information, and determining the object under the directory corresponding to the ordering instruction.
Wherein the sorting instruction is used for indicating that the objects are sorted according to the target attribute information.
Step S402, according to the determined object path corresponding to the object, searching the object attribute information corresponding to the sorting instruction from the object attribute information included in the data information table.
The data information table may store at least one attribute information and an object path corresponding to the object, where the at least one attribute information is stored in the data information table when the object operation is performed.
The data information table may be a hash table (HashMap) or a database, which is not limited in the embodiment of the present application.
HashMap is a data mapping structure for finding value according to key code, and said structure can find place for storing value by means of key code mapping position, i.e. can utilize key code value to map into a position in the table to access record so as to quicken search speed.
According to the determined object path corresponding to the object, the attribute information having the binding relationship with the object path can be searched in the data information table, and the target attribute information can be determined in the searched attribute information. Wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
Step S403, determining whether the target attribute information is found from the data information table; if not, executing step S404; if so, step S5405 is performed.
Step S404, accessing the object in the directory through the packaging interface, reading at least one attribute information corresponding to the object, storing the at least one attribute information and the object path corresponding to the object into a data information table, and determining the target attribute information corresponding to the object according to the sorting instruction.
Step S405, sorts the determined objects based on the target attribute information.
The method includes the steps of judging whether target attribute information can be found from a data information table or not, if the target attribute information cannot be found, accessing an object under a directory through a packaging interface, reading at least one attribute information corresponding to the object, storing the at least one attribute information and an object path corresponding to the object into the data information table, and determining the target attribute information corresponding to the object according to a sorting instruction. After the target attribute information corresponding to the object is determined, all the objects in the directory can be sorted according to the target attribute information.
If the target attribute information can be found, all objects under the directory can be sorted directly by the target attribute information.
For example, 100 files are contained under one folder, the sorting instruction is to sort the 100 files under the folder from large to small, the size information of the files can be searched from all the file attributes included in the HashMap according to the paths corresponding to the 100 files respectively, and if the size information of the 50 th file cannot be searched from the HashMap, the 50 th file under the folder can be accessed through the encapsulation interface, all the file attributes corresponding to the 50 th file are read, all the file attributes corresponding to the 50 th file and the path corresponding to the 50 th file are stored in the HashMap, and the file size information corresponding to the 50 th file is determined. After the file size information corresponding to the 100 files in the folder is found, the 100 files can be sorted in the descending order.
In one embodiment, a new set of File interfaces may be packaged based on HashMap or a database, for example: when a user views, edits and the like a file, the user can access the file through the packaging interface, read all file attribute information corresponding to the file, and store all file attribute information corresponding to the file and a path corresponding to the file into a HashMap or a database.
When a user clicks a file management application in the terminal device and enters a folder, the terminal device may list all files in the folder in a list file manner. For example, after clicking on a file management class application in the terminal device, the user may present a terminal device interface as shown in fig. 5, and as can be seen from fig. 5, the application may include an ABC folder, and after clicking into the ABC folder, the user may present all files under the folder. The terminal device may receive a sorting instruction sent by the user to sort the target file attribute information of all files in the folder. For example, as shown in FIG. 5, the user may select a ranking manner for ranking the files, including by name, by type, from small to large, from large to small, from old to new, and from new to old, etc.
In response to the sorting instruction, the terminal device may search, according to paths corresponding to all files in the folder, file attributes having a binding relationship with the paths in a HashMap or a database, and determine target file attribute information in the file attributes. If the target File attribute information cannot be found in the HashMap or the database, accessing the File corresponding to the target File attribute information which cannot be found in the folder through a File interface of a platform standard, reading all File attribute information corresponding to the File, storing all File attribute information corresponding to the File and a path corresponding to the File into the HashMap or the database, and obtaining the target File attribute information corresponding to the File according to a sorting instruction. And finally, sequencing all files in the folder according to the determined attribute information of the target file.
The encapsulation interface can be used as a platform general service, for data stored in the encapsulation interface, other applications can also use the encapsulation interface to read file attribute information, and a plurality of applications in the terminal equipment can continuously maintain the set of HashMap or the database, so that the speed of reading the file attribute information becomes faster and faster along with the enrichment of the data, and the integrity and the accuracy of the HashMap and the database can also be ensured. Meanwhile, the embodiment of the application queries the File attribute information of the File through a brand-new packaged interface, has strong operability of modification and transplantation, can be realized only by replacing the original files with HmctFastfiles in batches, and can be adapted more quickly.
According to the object sorting method provided by the embodiment of the application, when objects are sorted according to the target attribute information, the target attribute information is searched from the data information table instead of directly reading the target attribute information corresponding to the objects through the interface, so that the problem that when the objects in a platform with poor performance are sorted, the file management application sorting is stuck due to slow file system can be solved, the sorting efficiency can be greatly improved, and the sorting time can be reduced. For example, when a platform with poor performance does not adopt the sorting method to sort 1000 files, about 50s of time is consumed, and when the sorting method is adopted, only 3-5s of time is consumed, so that the sorting efficiency is greatly improved.
The object sorting method shown in fig. 3 is based on the same inventive concept, and an embodiment of the present application further provides an object sorting apparatus, which may be arranged in a terminal device. Because the device is a device corresponding to the object sorting method of the application and the principle of solving the problem of the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and repeated details are not repeated.
Fig. 6 shows a schematic structural diagram of an object sorting apparatus provided in an embodiment of the present application, and as shown in fig. 6, the object sorting apparatus includes an object determining unit 601, an attribute searching unit 602, and an object sorting unit 603.
The object determining unit 601 is configured to determine, in response to a sorting instruction for the target attribute information, an object in a directory corresponding to the sorting instruction; the ordering instruction is used for indicating that the objects are ordered according to the target attribute information;
the attribute searching unit 602 is configured to search, according to a determined object path corresponding to the object, target attribute information corresponding to the sorting instruction from attribute information of the object included in the data information table, where at least one attribute information and object path corresponding to the object are stored in the data information table; at least one attribute information is stored in the data information table when the object operation is carried out;
an object sorting unit 603 configured to sort the determined objects based on the target attribute information.
In a possible implementation manner, the attribute lookup unit 602 is specifically configured to:
according to the determined object path corresponding to the object, searching attribute information having a binding relationship with the object path in a data information table;
and determining target attribute information in the searched attribute information, wherein the attribute type of the target attribute information is the attribute type indicated by the sorting instruction.
In a possible implementation manner, the attribute lookup unit 602 is further configured to:
if the target attribute information cannot be found from the data information table, accessing the object under the directory through the packaging interface, reading at least one attribute information corresponding to the object, and storing the at least one attribute information and the object path corresponding to the object into the data information table; and
and determining target attribute information corresponding to the object according to the sequencing instruction.
In one possible implementation, the object is one of a subdirectory and a file.
In one possible implementation, performing object operations includes:
one of a view operation on the object, a sort operation on the object, and an edit operation on the object.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. 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.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种数据处理方法、装置和系统