Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in attached drawingExemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth hereIt is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosureCompletely it is communicated to those skilled in the art.
The sort method of a kind of array object provided in an embodiment of the present invention, as shown in Figure 1, this method includes:
101st, each array element in array object is split respectively according to preset at least one attribute classification.
Further so that at least there are the cutting parts of a same alike result classification in each array element after segmentationPoint.The attribute classification can be length, age, weight etc..
Wherein, the array can be integer array, size noting, character array etc., and be included in the array objectArray element quantity do not limit in embodiments of the present invention.
Specifically, the step 101 can be:The different array elements in array object are carried out respectively by separatorSegmentation.For example, array object be { 1 length 50cm of desk, 2 length 75cm of desk }, by separator ";" in array objectArray element is split, and obtains { desk 1;Length 50cm, desk 2;Length 75cm }.
102nd, basis is the preconfigured ordering rule of the array object, when determining to be ranked up the array objectIt attribute classification needed to be considered and puts in order.
Wherein, the ordering rule can be according to the descending sequence of a certain attribute classification, ascending sequence, by heightTo it is low sequence etc., the embodiment of the present invention does not limit.
For example, the preconfigured ordering rule of certain array object { 55 yuan of cap, 220 yuan of shirt, 180 yuan of jeans } isPrice is from high to low, it is determined that the attribute classification needed to refer to when being ranked up to the array object be price, the arrangement of priceSequence is from high to low.Can obtain later partitioning portion corresponding with attribute classification price be respectively 55 yuan, 220 yuan, 180Member is ranked up according to the corresponding numerical value of price partitioning portion is descending, i.e., 220 yuan, 180 yuan, 55 yuan.
103rd, it puts in order according to, the array object is ranked up.
For example, the preconfigured ordering rule of certain array object { 55 yuan of cap, 220 yuan of shirt, 180 yuan of jeans } isFrom high to low, partitioning portion corresponding with attribute classification price is 55 yuan, 220 yuan, 180 yuan to price, according to these three cutting partsPoint corresponding numerical value is descending is ranked up, and array object is ranked up so that the array object after sequence is { shirt220 yuan, 180 yuan of jeans, 55 yuan of cap }.
Further, after being ranked up to array object, the array object to sort according to predetermined ordering rule is exported,In order to which user uses the array object by sequence.
A kind of sort method of array object provided by the invention first distinguishes each array element in array objectIt is split according to preset at least one attribute classification so that at least identical there are one in each array element after segmentationThe other partitioning portion of Attribute class;Then it according to being the preconfigured ordering rule of the array object, determines to the array pairIt attribute classification needed to be considered and puts in order during as being ranked up.Compared with prior art, the present invention is by array pairAs being split to obtain the partitioning portion of different attribute classification, and according to the attribute classification of partitioning portion and put in order to arrayObject is ranked up, and without constructing object, avoids and array object is written to the troublesome operation in object properties after constructing object,So as to improve the efficiency of array object sequence.
Specifically, an embodiment of the present invention provides the sort method of another array object, as shown in Fig. 2, this method packetIt includes:
201st, the array object is input in pending pipeline using pre-set commands row tool Powershell pipelines.
Wherein, the command-line tool Powershell is a kind of command-line shell program and script environment, makes order lineUser and script edit person can utilize the function of .NET Framework.
202nd, in the pending pipeline, to each array element in array object respectively according to preset at least oneA attribute classification is split.
Specifically, the step 202 includes:In the pending pipeline, by the way that predetermined separator is configured, to array pairEach array element as in is split respectively according to preset at least one attribute classification.Wherein, the predetermined separatorCan be the punctuation marks such as comma, colon, branch, for example, by separator ":" to array element different in array object intoRow segmentation.
For the embodiment of the present invention, by the way that the array object for needing to sort is input in Powershell pipelines, and lead toIt crosses after Powershell pipelines are split array object and sorts, the efficiency of array object sequence can be improved.
Whether each partitioning portion for the 203rd, detecting the array element meets preset form.
Wherein, the preset form is for each array element, the position of partitioning portion corresponding with each attribute classificationIt puts identical.For example, array object is { 1 gender of age, 1 educational background 1, academic 2 genders 2 of age 2 }, preset form can be for everyA array element, with each attribute classification, i.e. age, educational background, gender, the position of corresponding partitioning portion is identical.
If the 204, not meeting preset form, according to the preset form to each partitioning portion of the array element intoRow adjustment.
For example, the array object { 1 gender of age, 1 educational background 1, academic 2 genders 2 of age 2 } described in step 203 is carried out{ 1/ gender of age, 1/ educational background 1, academic 2/ gender 2 of age 2/ } after segmentation, is obtained, detects the two array elements after segmentationEach partitioning portion do not meet preset form, then according to preset form { age, educational background, gender } to each point of array elementIt cuts part to be adjusted, obtain { academic 1/ gender 1 of age 1/, academic 2/ gender 2 of age 2/ }.
If the 205, meeting preset form, according to being the preconfigured ordering rule of the array object, determine to describedThe attribute classification that is needed to refer to when array object is ranked up and with the other partitioning portion pair of the Attribute class needed to refer toThat answers puts in order.
Wherein, the concept explanation of the ordering rule can be referred to and accordingly be described in step 102, and details are not described herein.
For example, to 8 DEG C of array element Shenyang, Beijing 19 in array object { 8 DEG C of Shenyang, 19 DEG C of Beijing, 22 DEG C of Shanghai }DEG C, 22 DEG C of Shanghai, be split respectively using separator "/", obtain Shenyang/8 DEG C, Beijing/19 DEG C, Shanghai/22 DEG C, these pointsCut part correspond to two attribute classifications, that is, include Shenyang, Beijing, Shanghai city name part and include 8 DEG C, 19 DEG C,22 DEG C of temperature section, when array object ordering rule for temperature from high to low when, it is determined that the array object is arrangedThe attribute classification needed to refer to during sequence is temperature, and determines that the partitioning portion of attribute category temperature is corresponding and put in order as numberIt is descending.
For the embodiment of the present invention, attribute classification that by determining and being ranked up to array object first when needs to refer to,So as to be ranked up when being ranked up to array object according to one of which attribute classification, avoid and obscure different attributeThe partitioning portion of classification and can not sort, so as to improve array object sequence accuracy.
206th, according to clooating sequence corresponding with the other partitioning portion of the Attribute class needed to refer to, to the array pairEach array element as in is ranked up.
For example, the preconfigured row of certain array object { 25 years old master of Zhang San, 21 years old undergraduate course of Li Si, 5 30 years old doctor of king }Sequence rule for the age from high to low, it is determined that the attribute classification needed to refer to when being ranked up to the array object be the age, withAnd partitioning portion corresponding with the age be 25 years old, 21 years old, 30 years old, then according to the corresponding numerical value of these three partitioning portions by height toLow is ranked up so that the array object after sequence is { 5 30 years old doctor of king, 25 years old master of Zhang San, 21 years old undergraduate course of Li Si }.
It further, at this time can be by phase if there are the identical partitioning portions of numerical value in the attribute classification needed to refer toPartitioning portion progress with numerical value is randomly ordered, can also be ranked up according to the second attribute classification.Such as array object { wide day30 years old, Han Song 26 years old, one intelligence of king 30 years old } be split after obtain { wide day/30 year old, Han Song/26 year old, Wang Yizhi/30 year old }, determineIt is right if being ranked up according to age ascending sequence to array object comprising name attribute classification and age attribute classificationIt in age identical wide day and Wang Yizhi, can carry out randomly ordered, can also be further ranked up according to initials,It can be ranked up herein according to initials, array object is { Han Song 26 years old, wide day 30 years old, Wang Yizhi after being sorted30 years old }.
The sort method of another kind array object provided by the invention, first by each array element in array object pointIt is not split according to preset at least one attribute classification so that at least there are a phases in each array element after segmentationWith the partitioning portion of attribute classification;Then it according to being the preconfigured ordering rule of the array object, determines to the arrayIt attribute classification needed to be considered and puts in order when object is ranked up.Compared with prior art, the present invention is by arrayObject is split to obtain the other partitioning portion of each Attribute class, and the attribute classification according to partitioning portion and the logarithm that puts in orderGroup objects is ranked up, and without constructing object, array object is written to the cumbersome behaviour in object properties after avoiding construction objectMake, so as to improve the efficiency of array object sequence.
Further, the specific implementation as method shown in Fig. 1, an embodiment of the present invention provides a kind of rows of array objectSequence device, as shown in figure 3, described device includes:Cutting unit 31, determination unit 32, sequencing unit 33.
The cutting unit 31 can be used for each array element in array object respectively according to preset at least oneA attribute classification is split so that at least there are the cutting parts of a same alike result classification in each array element after segmentationPoint.
The determination unit 32 can be used for, according to being the preconfigured ordering rule of the array object, determining to instituteIt states attribute classification needed to be considered when array object is ranked up and puts in order.
The sequencing unit 33 can be used for putting in order according to, the array object be ranked up.
It should be noted that each functional unit involved by a kind of collator of array object provided in an embodiment of the present inventionOther it is corresponding describe, can be described with the corresponding of reference chart 1, details are not described herein.
A kind of collator of array object provided by the invention first distinguishes each array element in array objectIt is split according to preset at least one attribute classification so that at least identical there are one in each array element after segmentationThe other partitioning portion of Attribute class;Then it according to being the preconfigured ordering rule of the array object, determines to the array pairIt attribute classification needed to be considered and puts in order during as being ranked up.Compared with prior art, the present invention is by array pairAs being split to obtain the partitioning portion of different attribute classification, and according to the attribute classification of partitioning portion and put in order to arrayObject is ranked up, and without constructing object, avoids and array object is written to the troublesome operation in object properties after constructing object,So as to improve the efficiency of array object sequence.
Further, the specific implementation as method shown in Fig. 2, an embodiment of the present invention provides another array objectsCollator, as shown in figure 4, described device includes:Cutting unit 41, determination unit 42, sequencing unit 43.
The cutting unit 41 can be used for each array element in array object respectively according to preset at least oneA attribute classification is split so that at least there are the cutting parts of a same alike result classification in each array element after segmentationPoint.
The determination unit 42 can be used for, according to being the preconfigured ordering rule of the array object, determining to instituteIt states attribute classification needed to be considered when array object is ranked up and puts in order.
The sequencing unit 43 can be used for putting in order according to, the array object be ranked up.
Further, described device further includes:Output unit 44.
The output unit 44 can be used for utilizing pre-set commands row tool Powershell pipelines by the array objectIt is input in pending pipeline.
Further,
The cutting unit 41 specifically can be used in the pending pipeline, to each array in array objectElement is split respectively according to preset at least one attribute classification.
The cutting unit 41 specifically can be also used in the pending pipeline, right by the way that predetermined separator is configuredEach array element in array object is split respectively according to preset at least one attribute classification.
Further, described device further includes:
Whether detection unit 45, each partitioning portion that can be used for detecting the array element meet preset form.
Further, described device further includes:
Adjustment unit 46, if can be used for not meeting preset form, according to the preset form to the array elementEach partitioning portion be adjusted.
The determination unit 42 if specifically can be used for meeting preset form, is matched in advance according to for the array objectThe ordering rule put determines the attribute classification needed to refer to when being ranked up to the array object and needs to join with describedThe other partitioning portion of Attribute class examined is corresponding to put in order.
The sequencing unit 43 specifically can be used for according to corresponding with the other partitioning portion of the Attribute class needed to refer toClooating sequence, each array element in the array object is ranked up.
It should be noted that each function list involved by the collator of another kind array object provided in an embodiment of the present inventionOther corresponding descriptions of member, can be described, details are not described herein with the corresponding of reference chart 2.
The collator of another kind array object provided by the invention, first by each array element in array object pointIt is not split according to preset at least one attribute classification so that at least there are a phases in each array element after segmentationWith the partitioning portion of attribute classification;Then it according to being the preconfigured ordering rule of the array object, determines to the arrayIt attribute classification needed to be considered and puts in order when object is ranked up.Compared with prior art, the present invention is by arrayObject is split to obtain the other partitioning portion of each Attribute class, and the attribute classification according to partitioning portion and the logarithm that puts in orderGroup objects is ranked up, and without constructing object, array object is written to the cumbersome behaviour in object properties after avoiding construction objectMake, so as to improve the efficiency of array object sequence.
The display device of the label text includes processor and memory, and above-mentioned cutting unit, determination unit, sequence are singleMember etc. in memory, above procedure unit stored in memory is performed Lai real by processor as program unit storageNow corresponding function.
Comprising kernel in processor, gone in memory to transfer corresponding program unit by kernel.Kernel can set oneOr more, by adjusting kernel parameter come solve in the prior art can limit service development and can to the layout of full page,The problem of typesetting impacts.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM), memory includes at least one depositStore up chip.
Present invention also provides a kind of computer program products, first when being performed on data processing equipment, being adapted for carrying outThe program code of beginningization there are as below methods step:By each array element in array object respectively according to preset at least oneAttribute classification is split so that at least there are the cutting parts of a same alike result classification in each array element after segmentationPoint;According to for the preconfigured ordering rule of the array object, determining to need to consider when being ranked up the array objectAttribute classification and put in order;It is put in order according to described, the array object is ranked up.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or computer programProduct.Therefore, the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware can be used in the applicationApply the form of example.Moreover, the computer for wherein including computer usable program code in one or more can be used in the applicationThe computer program production that usable storage medium is implemented on (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)The form of product.
The application is with reference to the flow according to the method for the embodiment of the present application, equipment (system) and computer program productFigure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagramThe combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be providedThe processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produceA raw machine so that the instruction performed by computer or the processor of other programmable data processing devices is generated for realThe device of function specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spyDetermine in the computer-readable memory that mode works so that the instruction generation being stored in the computer-readable memory includes referring toEnable the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram orThe function of being specified in multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that countedSeries of operation steps are performed on calculation machine or other programmable devices to generate computer implemented processing, so as in computer orThe instruction offer performed on other programmable devices is used to implement in one flow of flow chart or multiple flows and/or block diagram oneThe step of function of being specified in a box or multiple boxes.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, netNetwork interface and memory.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable JieThe example of matter.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any methodOr technology come realize information store.Information can be computer-readable instruction, data structure, the module of program or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), movesState random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasableProgrammable read only memory (EEPROM), fast flash memory bank or other memory techniques, CD-ROM read-only memory (CD-ROM),Digital versatile disc (DVD) or other optical storages, magnetic tape cassette, the storage of tape magnetic rigid disk or other magnetic storage apparatusOr any other non-transmission medium, available for storing the information that can be accessed by a computing device.It defines, calculates according to hereinMachine readable medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It these are only embodiments herein, be not limited to the application.To those skilled in the art,The application can have various modifications and variations.All any modifications made within spirit herein and principle, equivalent replacement,Improve etc., it should be included within the scope of claims hereof.