CN109344230A - Code library file generation, code search, connection, optimization and transplantation method - Google Patents
Code library file generation, code search, connection, optimization and transplantation method Download PDFInfo
- Publication number
- CN109344230A CN109344230A CN201811285105.0A CN201811285105A CN109344230A CN 109344230 A CN109344230 A CN 109344230A CN 201811285105 A CN201811285105 A CN 201811285105A CN 109344230 A CN109344230 A CN 109344230A
- Authority
- CN
- China
- Prior art keywords
- file
- code
- library file
- library
- user
- 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.)
- Granted
Links
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of generations of code library file, code search, it is coupled, optimization and transplantation method, firstly generate the library file of each metacode section, the characteristic information of each metacode section is stored by library file, and it is stored in Summary file together with library file address after coming out feature information extraction in library file, the code segment of library file can be obtained by retrieving Summary file in user, realize the recommendation of code, then the source code that user writes is added to according to the code segment that user is selected in the setting of user, realize the connection of code, it can also be achieved the Automatic Optimal of code on this basis, the application of auxiliary program transplanting.The Summary file for direction its library file that the present invention obtains only saves the simplified characteristic information of metacode section, so only to the input of code segment output parameter type and output result etc. analyze, without carrying out full text lexical analysis to code segment, the calculation amount of feature is reduced while summarising metacode section content.
Description
Technical field
The present invention relates to computer field, in particular to a kind of code library file generation, code search, connection, optimization with
And transplantation method.
Background technique
Programming is that computer is allowed to be to solve the problems, such as some, and use certain programming languages' program code, and most
The process of result is obtained eventually.Auxiliary development personnel program in a specific way, and the method for reducing developer's development time is called auxiliary
Help programmed method.
Current aided programming method majority is that special key word highlights, sentence association inputs, miscue.It is related
Technology can only assist user to generate single sentence, and developer usually still needs to be converted to code statement with reality from being about to a certain process
It is existing, and must write to sentence one by one, workload is many and diverse and often still repeats to write existing code.
Code search part in aided programming method, majority is retrieved based on natural language description, and code
Cause time-consuming long so that can only often retrieve outmoded code segment by manually including, is retrieved based on natural language description
Also obstacle is caused for the typing of code and the search of developer, natural language is also difficult in existing search technique accurate same
When be briefly outlined the method for operation and logic of code segment, the result simultaneously scanned for, which still needs to imagineering, gets off and manually repairs again
Change the code that sentence is added to user.
How auxiliary development personnel reduce developer's workload, and efficiently assisting user to add code segment is this technology neck
Domain problem to be solved.
Summary of the invention
The first object of the present invention is the shortcomings that overcoming the prior art and deficiency, provides a kind of code library file method,
This method library file produced reduces the calculation amount for generating code characteristic while capable of summarizing code segment content.
The second object of the present invention is to provide a kind of based on the generation realized on the basis of above-mentioned code library file generation method
Code searching method, the searching method have the advantages that code search speed is fast and accurate.
The third object of the present invention is to provide a kind of based on the generation realized on the basis of above-mentioned code library file generation method
The automatic connecting method of code, it is defeated that the code segment that this method makes user that can select user after simple operations is added to user
In the source code entered.
The fourth object of the present invention is to provide a kind of based on the generation realized on the basis of above-mentioned code library file generation method
Code optimization method, the code segment that this method can select user, which replaces with, executes the faster code segment of speed, improves code
Quality and runnability.
The fifth object of the present invention is to provide a kind of based on the generation realized on the basis of above-mentioned code library file generation method
Code householder method, this method can reduce analysis of the user to labyrinth code segment, and user only needs shirtsleeve operation
The transplanting for realizing code, effectively saves the programming time of user.
The first object of the present invention is achieved through the following technical solutions: a kind of code library file generation method, steps are as follows:
Step S1, the programming language for getting source code first mentions environmental information;
Step S2, the slice rule file that environmental information is loaded into corresponding language is mentioned according to the programming language of source code, then
Source code is divided into each independent code section with complete function according to slice rule file;Be directed to it is above-mentioned get it is each
Independent code section, whether retrieval wherein has called external code, if so, then external code is added in metacode section,
It ultimately generates without each metacode section for calling external code;
Step S3, it is directed to each metacode section, a library file is generated respectively first, by each metacode section and each metacode section
Corresponding source code address and language and environmental information storage are into the corresponding library file of each metacode section;
Meanwhile it being directed to each metacode section, the entrance of metacode section is retrieved, by entrance in metacode section to function call portion
The sentence divided generates corresponding call statement;Above-mentioned generation call statement is added in library file;
Meanwhile it being directed to each metacode section, amplification is carried out to it and generates test code, while generating includes that each group tests number
According to test data list, then each group test data in test code in input test data list, passes through test generation
Corresponding each group test result is obtained after code operation, above-mentioned each group test result is added to the corresponding library file of each metacode section
In;
Meanwhile be directed to each metacode section, according to grammer obtain it is therein input output statement, mark the sentence be into
Mouth/outlet, extracted from inputoutput statement input output parameter type and function name, then said extracted is arrived
The input of each metacode section output parameter type and function name storage into the corresponding library file of each metacode section;And it obtains
Label in metacode section stores the label in metacode section into library file;
Step S4, be directed to each library file that step S3 is got, extract respectively the language wherein stored and environmental information,
Input output parameter type, function name, each group test result and label;
For each library file, the Summary file for being directed toward it is generated respectively, the content of each library file said extracted is made
It is stored in the Summary file for being directed toward it for clip Text, and the address of each library file is added to the Summary file for being directed toward it
In.
Preferably, further include following steps:
Step S5, each Summary file, the library file address that regular visit wherein stores, it is determined whether can be accessed are directed to
It extracts in the library file and the library file being accessed for whether the data as clip Text to have update;
If the library file is not accessed, the new address of the library file is inquired, if the new address of the library file cannot be found,
It deletes Summary file and the address in Summary file is replaced with into the new of the library file if inquiring the new address of the library file
Address;
If the library file, which is extracted, has update for the data as clip Text, library file storage is extracted again
For data as clip Text, the clip Text in Summary file being directed toward replaces with above-mentioned to be extracted again
Data.
It is preferred: to further include following steps: carrying out duplicate checking and merging treatment, tool for the library file that step S3 is got
Body are as follows:
Step S31, the identical Summary file of stored input type, output type, test result is filtered out first;
Step S32, the Summary file filtered out for S31 adds amplification assay data wherein, then it is called to refer to
To library file in test code, by above-mentioned each group amplification assay data be sequentially inputted to test code in tested after point
Each group amplification assay is not got successively as a result, the group number for the amplification assay result that above-mentioned ought be got reaches certain value, then is stopped
It only tests, and above-mentioned each group amplification assay result is added to Summary file;
Step S33, it for each Summary file of the S32 each library file of direction got, matches each in each Summary file
Group amplification assay extracts as a result, being screened out from it each group amplification assay result and corresponding to identical Summary file;
Step S34, it is directed to the Summary file that step S33 is filtered out, each library file of its direction is obtained, according to the meaning of one's words
With metacode section in above-mentioned each library file, the library file that semantic similarity after matching is greater than certain value is considered as repetition library file;
Step S35, for the terminal of preservation library file: being directed to the repetition library file that step S34 is got, retain and call
The library file that time is minimum and attribute is does not allow to delete;Then in the case where terminal allows to carry out label addition by other libraries
The label of file is added in retained library file, the address of retained library file is added to other library files, and delete
Except other contents repeated in library file in addition to retained library file address, so that other library files that repeat contain only retained library
File address;
Wherein, the above-mentioned other preservations for repeating library file and the Summary file for being directed toward it for containing only retained library file address
Time is persistence or temporarily saves;Wherein, when temporarily to save, the time temporarily saved is accessed regularly for library file
Maximum duration interval, be more than above-mentioned time interval after, it is other repeat library files will be deleted;In above-mentioned time interval,
When accessing other repetition library files by being directed toward other Summary files for repeating library file, retained library text can only be retrieved
The address of part, the library file address in the other Summary files for repeating library file of the direction is substituted for retained library file at this time
Address, to realize the update for the Summary file that other library files of the direction are directed toward;
Wherein, it is directed to retained library file, when the Summary file by being directed toward it accesses the library file, if learning
Label in the library file increases, then is added to the label increased in the Summary file for being directed toward it;
Wherein, in library file access process, if library file can not be accessed by the library file address in Summary file
When, then search request is issued to terminal, terminal is searched summary info other Summary files identical with the Summary file, found
The library file address in the Summary file is replaced with into above-mentioned find in the Summary file met after the Summary file met
Library file address.
Preferably, the programming language that each source code is got in step S1 mentions environmental information detailed process is as follows:
Step S11, be directed to source code, retrieve the annotation of source code first, determine in whether there is or not record instructions and environment to believe
The character string of breath, if so, then therefrom directly reading language and environmental information;If nothing enters step S12;
Step S12, it is read since source code starting, reads character string one by one;
Step S13, it is directed to the character string currently got, environment is searched and judges each language in library/environment judgement text
Part judges whether there is language/environment and judges that file includes the character string;If so, entering step S14;If it is not, then entering step
S15;
Step S14, judge to read language and environment letter in file from language/environment where the character string currently read
Breath, and feed back the language and environmental information;Then judge whether to meet in all language and environmental information of current feedback with
Lower first condition and second condition, first condition: certain language message is anti-in all language and environmental information of current feedback
The number of feedback is more than y times, second condition, time that certain environmental information is fed back in all language and environmental information of current feedback
Number is more than q times;
If being all satisfied first condition and second condition, the language of source code is judged as this kind of language message, by source generation
The environment of code is judged as this kind of environmental information;
If only meeting first condition, and do not meet second condition, then the language of source code be determined as this kind of language message,
And the acquisition for terminating language source code information, subsequently into step S15;
If only meeting second condition, and it is to meet first condition, then the environment of source code is judged as this kind of environmental information,
And the acquisition for terminating source code environmental information, subsequently into step S15;
If first condition and second condition is not satisfied;Then enter step S15;
Step S15, whether the character string that judgement is currently read is source code last character string, if so, into
Step S17;If it is not, then entering step S16;
Step S16, the character late string in source code is read, as the character string currently read, subsequently into step
Rapid S13;
Step S17, all language and environmental information of obtaining step S14 feedback;When source code language message also not by
When judging, then using by the most language message of Times of Feedback as the language message of source code;When the environmental information of source code
When not being judged out also, then using by the most environmental information of Times of Feedback as the environmental information of source code.
Further, the step S3 is directed to each metacode section, and the method that amplification generates test code is carried out to it
Using template additive process, scalping method or supplement method, in which:
The step of obtaining test code using template additive process is as follows:
Step 1. is according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;
Step 2: retrieval metacode section identifies the inlet/outlet and mark of metacode section by keyword and lexical analysis
Note;
Step 3: labeled sentence being split as character string, by the character string splitted out to the template of above-mentioned screening
Inlet/outlet keyword is matched, and the most template of occurrence is selected, and matching template is completed;
Metacode section is added to template elected, obtains test code, and be deposited into corresponding library file;
The step of obtaining test code using scalping method is as follows:
The metacode section that correspondence will generate test code is defined as object code section by the copy for firstly generating source code;
In the copy of source code, by above-mentioned object code section sentence labeled as reservation sentence, and other metacode sections are deleted, together
When delete call other metacode sections sentence;
Searched targets code segment call statement obtains input variable therein, is retained in target by input variable name retrieval
Make the associated sentence of input variable in code segment call statement before calling main body function and defines the sentence of input variable, mark
It is denoted as reservation sentence, deletes remaining sentence comprising input variable name;Remaining unrelated sentence is deleted simultaneously;
It is deleted using side in the copy for becoming the method deletion source code of debug and is not labeled as the sentence retained, obtained last
The sentence arrived is minimum and complete code is as test code, and is deposited into corresponding library file;
The step of obtaining test code using supplement method is as follows:
Step S3a, according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;
Step S3b, 1 is operated: according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;
Operation 2: retrieval metacode section identifies the inlet/outlet and label of metacode section by keyword and lexical analysis;Operation 3:
Labeled sentence is split as character string, inlet/outlet of the character string splitted out to the template of above-mentioned screening is crucial
Word is matched, and the most template of occurrence is selected, and matching template is completed;
Step S3c, metacode section is added to the template that step S3b is selected, obtains test code;
Step S3d, the test code obtained using step S3c tests the test data of input, if test can not
Pass through;Then execute following steps:
Step S3d1, the metacode section that correspondence will generate test code is defined as target generation by the copy for generating source code
Code section;In the copy of source code, by above-mentioned object code section sentence labeled as reservation sentence, and other metacode sections are deleted
It removes, while deleting the sentence for calling other metacode sections;
Step S3d2, searched targets code segment call statement obtains input variable therein, is retrieved by input variable name
Being retained in object code segment call sentence before calling main body function becomes the associated sentence of input variable and definition input
The sentence of amount deletes remaining sentence comprising input variable name labeled as sentence is retained;Remaining unrelated sentence is deleted simultaneously;
Step S3d3, not retained sentence is directed in the copy of source code, and the analysis of being associated property will be interrelated
Sentence conclude to together, as a partial code;
Step S3d4, it is directed to various pieces code obtained above, chooses one of partial code first, as working as
Preceding partial code;
Step S3d5, current portions code is added in the template that step S3b is filtered out, then adds metacode section
Into the above-mentioned template got, test code is obtained;It is directed to above-mentioned test code, input test data are once surveyed
Examination enters step S3d6 if test does not pass through using above-mentioned test code as final test code if test passes through;
Step S3d6, next partial code is chosen as current portions code, step S3d5 is then executed, until obtaining
Test code input test data can pass through after once testing, and will be deposited above by the test code after test
Enter into corresponding library file;
In the step S3, it is directed to each metacode, when generating call statement, first determines whether wherein function call sentence
Whether data correlation sentence is had;If so, adding the data correlation before the function call sentence in metacode section first
Then sentence retrieves the entrance of metacode section, the sentence of entrance in Optimized code section to function call part is generated corresponding adjust
Use sentence;If it is not, then directly retrieving the entrance of metacode section, the sentence of entrance in metacode section to function call part is generated
Corresponding call statement
Of the invention and purpose is achieved through the following technical solutions: a kind of code search method, steps are as follows:
Step X1, code library file generation method described in any one of claims 1 to 5 is obtained first generate library file
And it is directed toward the Summary file of library file;
Step X2, after receiving the code segment searching request of user:
Step X21, the code segment input type that user needs is obtained, the defeated of input type and the code segment is then filtered out
Enter the identical Summary file of type;
Step X22, the code segment output type that user needs is obtained, from the Summary file filtered out in step X21 again
It is secondary to filter out output type Summary file identical with the output type of the code segment;
Step X23, it is generated according to the input type of user's input and is formed by multiple groups test data according to certain sequential arrangement
Test data list, corresponding test data is selected for user by the test data list, it is selected according to its by user
Test data inputs corresponding output valve;It is directed to each group output valve that user inputs its selected each group test data, it will
Each group output result in the Summary file filtered out in each group output valve and step X22 is matched, and each group is screened out from it
Result is exported with user to the identical Summary file of its selected each group output valve of each group test data input;
Step X24, the first label that the needs that user selectes retain is obtained, the abstract text that step X23 is filtered out is directed to
Part compares label therein and the first label, screens outgoing label and the identical Summary file of the first label again, obtains
The second label that the needs that user selectes are deleted screens outgoing label and the second label from the above-mentioned Summary file filtered out again
Identical Summary file, and deleted;
Step X25, the step X24 Summary file finally retained is recommended into user, gets corresponding library text for user
Part is tested and is selected.
The third object of the present invention is achieved through the following technical solutions: a kind of automatic connecting method of code, steps are as follows:
Step Y1, code library file generation method described in any one of claims 1 to 5 is obtained first to generate for user
The Summary file of selected library file and direction library file;
Step Y2, customized user function name is obtained, the library file that user selectes is directed to, reads and is directed toward the library file
Summary file function name, and be defined as library file function name;It is fixed to extract corresponding function in the library file metacode
Adopted content simultaneously makes following modification: function being defined library file function name in content and replaces with user function name, is then repaired above-mentioned
Function after changing defines content and is added in the source code of user's input;
Obtain customized user function name;It is directed to the library file that user selectes, reads the abstract for being directed toward the library file
The function name of file, and it is defined as library file function name;Header file is created simultaneously and is named with user function name, is then mentioned
It gets corresponding function in the library file metacode to define content and make following modification: function is defined into library file function in content
Name replaces with user function name, and above-mentioned modified function is defined content and is added in newly-built header file, finally exists
The sentence of the header file is called in addition in the source code of user's input;
Step Y3 is directed to the library file that user selectes, and the tune in the library file is obtained after user selects incoming variable
With sentence, above-mentioned call statement is added to user's specified function calling station in the source code of user's input, and will wherein
Variable be revised as the variable name that user is passed to.
The fourth object of the present invention is achieved through the following technical solutions: a kind of code optimization method, steps are as follows:
Step Z1, code library file generation method described in any one of claims 1 to 5 is obtained first generate library file
And it is directed toward the Summary file of library file, it is defined as the first library file and the first Summary file;
It is directed to the source code fragment that user selectes, firstly generates second library file, while obtaining the source code fragment
Entrance and exit, from entrance and exit extract input output parameter type and function name, then by the source code fragment and its mention
The input of taking-up output parameter type and function name be added to the second library file;
It is directed to the source code fragment that user selectes simultaneously, amplification is carried out to it and generates test code, and is stored to second
In library file, while test data list is generated, then each group in test code in input test data list tests number
According to by obtaining corresponding each group output after test code operation as a result, above-mentioned each group output result is added to the second library text
Part;
Meanwhile amplification assay data are added in the second library file;
Step Z2, it is directed to the second library file of step Z1 generation, second Summary file for being directed toward it is generated, extracts
The input stored in second library file output parameter type, function name, each group output result and amplification assay data, and
It stores the result of said extracted as clip Text into the second Summary file, while the storage of the address of the second library file being arrived
In second Summary file;
Step Z3, the finger that will be got in the second Summary file of the second library file of direction that step Z2 is obtained and step Z1
It is matched to each first Summary file of each first library file, specific matching process is as follows:
Step Z31, the input type in the second Summary file is obtained, is then selected from each first Summary file defeated
Enter type the first Summary file identical with the input type in the second Summary file;
Step Z32, the output type in the second Summary file is obtained, each first abstract text filtered out from step Z31
Output type the first Summary file identical with the output type in the second Summary file is filtered out in part again;
Step Z33, each group obtained in the second Summary file exports as a result, each first filtered out from step Z32 is plucked
It wants to filter out each group output result again in file and exports result corresponding identical first with each group in the second Summary file and pluck
Want file;
Step Z34, it is directed to each first Summary file that step Z33 is filtered out, adds amplification assay data wherein, together
When obtain its direction each first library file;It is directed in above-mentioned every one first library file got, it is defeated in test code
Enter to be directed toward each group amplification assay data in its first Summary file, be faced by obtaining corresponding each group after test code operation
When output as a result, above-mentioned each group is temporarily exported that result is added to according to the sequence of corresponding each group amplification assay data this first
It library file and is directed toward in the first Summary file of first library file;
It is directed to the second library file simultaneously, calls test code therein, then inputs second respectively in test code
Each group amplification assay data in Summary file are temporarily exported by obtaining corresponding each group after test code operation as a result, will
Above-mentioned each group temporarily exports in second library file and the first Summary file that result is added to;
Step Z35, each group obtained in the first Summary file temporarily exports as a result, each first got from step Z34
Each group is filtered out in Summary file temporarily to export result with each group in the second Summary file temporarily to export result corresponding identical
First Summary file;
Step Z36, each first Summary file filtered out for step Z35, is looked by the library file address wherein stored
Each first library file is found, the runing time for testing code in above-mentioned each first library file is got;Then step Z35 is screened
The runing time that code is tested in each first Summary file and its each first library file being directed toward out shows user, for
User selects, finally by the first library text pointed by the library file address stored in the first Summary file that user selects
Metacode section in part replaces the source code fragment that user selectes with Optimized code section as Optimized code section.
Preferably, in the step Z36, the detailed process for the code segment that user selectes is replaced such as using Optimized code section
Under:
Step Z361, the first Summary file of the first library file where Optimized code section is directed toward in retrieval and direction optimised generation
Second Summary file of code section, reads the function name in first Summary file and the second Summary file, respectively corresponds and be defined as
Library file function name and user function name;Corresponding function in the first library file metacode is extracted to define content and do as follows
Modification: function is defined into the library file function name in content and replaces with user function name;Then above-mentioned modified function is determined
Adopted content is added in the source code of user's input;
Or retrieval is directed toward the first Summary file of the first library file of Optimized code section place and is directed toward optimised code segment
The second Summary file, read the function name in first Summary file and the second Summary file, respectively correspond and be defined as library text
Part function name and user function name;It creates header file and is named with user function name, extract the first library file metacode
In corresponding function define content and make following modification: library file function name function defined in content replaces with user function
Name;Then above-mentioned modified function is defined content to be added in newly-built header file, finally in the source code of user's input
The sentence of the header file is called in middle addition;
Step Z362, the first library file where being directed to Optimized code section, obtained after user selects incoming variable this
Above-mentioned call statement is added to user's specified function invocation bit in the source code of user's input by the call statement in one library file
It sets, and variable therein is revised as the variable name that user is passed to.
The fifth object of the present invention is achieved through the following technical solutions: a kind of code auxiliary transplantation method, steps are as follows:
Step B1, code library file generation method described in any one of claims 1 to 5 is obtained first generate library file
And it is directed toward the Summary file of library file, it is defined as the first library file and the first Summary file;
In the source code transplanting request for receiving user, be divided into source code according to slice rule file has first
Each independent code section of complete function;It is directed to the above-mentioned each code segment transplant got, is generated respectively first
One third library file, and retrieve each code segment input output statement, extracted from inputoutput statement input it is defeated
Parameter type and function name out, the input for then arriving said extracted output parameter type, function name storage to each code segment
In corresponding third library file;
Meanwhile it being directed to the above-mentioned each code segment transplant got, amplification is carried out to it generates test generation
Code, and multiple groups test data is generated, it is sorted by multiple groups test data and generates test data list, then in test code segment
Each group test data in input test data list, by obtaining corresponding each group output after test code operation as a result, will
The third library file that above-mentioned each group output result is added to according to the sequence of corresponding each group test data;
It is directed to the third library file of the above-mentioned each code segment got, generates the third Summary file for being directed toward it,
Extract in third library file the input that stores output parameter type, function name and each group output as a result, and by said extracted
Result as clip Text store into third Summary file, while by the address of third library file storage to third make a summary text
In part;
Step B2, it is directed to each third Summary file for each third library file of direction that step B1 is obtained, by itself and step
Each first Summary file of each first library file of direction got in B1 is matched, and specific matching process is as follows:
Step B21, the input type and output type in third Summary file are obtained, while obtaining what user to be transplanted to
Then the language and environmental information of code filter out input from each first Summary file as appointed language and environmental information
Type and output type is identical as third Summary file and language and environmental information are the of above-mentioned appointed language and environmental information
One Summary file;
Step B22, each group obtained in third Summary file exports as a result, each first filtered out from step B21 is plucked
It wants to filter out each group output result again in file and exports result corresponding identical first with each group in third Summary file and pluck
Want file;Needle passes through the library file address search that wherein stores to each first library in above-mentioned each first Summary file filtered out
File gets the runing time that code is tested in above-mentioned each first library file;Then by above-mentioned each first abstract filtered out
The runing time that code is tested in file and its each first library file being directed toward shows user, so that user is to need to transplant
Selected corresponding first Summary file of each code segment;
Step B23, being directed to user, finally to need, the code segment transplanted is corresponding to be selected the first Summary file and needs
The third Summary file of the code segment of transplanting reads the function name in first Summary file and third Summary file, right respectively
It should be defined as library file function name and user function name;Extract the first library file metacode pointed by first Summary file
In corresponding function define content and make as modification: function is defined to the library file function name in content and replaces with user function
Name;Then above-mentioned modified function content is defined to be added in the source code of user's input;
Or it is directed to user and is finally selected the first Summary file by the code segment correspondence that needs are transplanted and need to transplant
Code segment third Summary file, read the function name in first Summary file and third Summary file, it is fixed to respectively correspond
Justice is library file function name and user function name;Create header file and with the name of user function name;Extract first abstract
Corresponding function defines content and makes following modification in first library file metacode pointed by file: function is defined in content
Library file function name replace with user function name;Then above-mentioned modified function is defined into content and is added to newly-built head text
In part, the sentence for calling the header file is finally added in the source code of user's input;
Step B24, being directed to user finally is that each source code fragment transplanted is needed to correspond to selected first abstract text
First library file pointed by part obtains the call statement in first library file after user selects incoming variable, will be above-mentioned
Call statement is added to user's specified function calling station in the source code of user's input, and variable therein is revised as using
The incoming variable name in family.
The present invention has the following advantages and effects with respect to the prior art:
(1) in code library file method of the present invention, it is directed to source code, is divided into multiple independent generations with complete function
Code section, each independent code section with complete function are referred to as metacode section, generate a library for each metacode section
File, wherein storing metacode section, call statement, the corresponding source code address of test code metacode section and language in library file
Mention environmental information, input output parameter type, function name, label and each group test result;It is directed to each library file, point
Its Summary file Sheng Cheng be directed toward, by library file abstract part (include: language source code and environmental information, input it is defeated
Parameter type, function name, label, each group test result, library file address and amplification data out) it is added to Summary file
In, it can be seen from the above, the metacode section after the present invention divides source code carries out direction its library text obtained after automatic processing
The Summary file of part only saves the simplified characteristic information of metacode section, so only to the input of code segment output parameter
Type and test result etc. are analyzed, and (are to ignore code segment to some without carrying out full text lexical analysis to code segment
The sentence of function specific implementation), the calculation amount of feature is reduced while summarising metacode section content.In addition, this hair
The bright library file got can be saved in server, and Summary file can be saved in user terminal, when in source code to be directed to
Each code segment when being retrieved, the Summary file for only retrieving small documents can find corresponding library file, and abstract is moved easily
And preservation, reduce the computer resource expense of retrieval and preservation.
(2) in code library file method of the present invention, duplicate checking and conjunction are carried out also directed to each library file obtained in generation
And handle, specifically, filtering out the identical Summary file of stored input type, output type, test result first;Then
It is directed to the above-mentioned Summary file filtered out, tests code in the library file for further calling it to be directed toward, it will be in Summary file
Each group amplification data input test code tested obtain each group amplification assay again as a result, then from it is above-mentioned filter out pluck
It wants to filter out each group amplification assay result also identical Summary file in file again, finally obtains each library file of its direction,
Metacode section in above-mentioned each library file is matched according to the meaning of one's words, the library file that semantic similarity after matching is greater than certain value is considered as weight
Multiple library file.It is directed to repetition library file obtained above, only reservation allocating time is minimum and attribute is does not allow deletion
Library file repeats library file for other, and in the case where terminal allows to carry out label addition, label therein is added respectively
Into retained library file, wherein only storing the address of retained library file.It is above-mentioned to be directed to library file duplicate checking and conjunction
And handle, it can effectively save library file memory space.
(3) in code search method of the present invention, obtain first code library file method of the present invention library file generated and
Be directed toward the Summary file of library file, be directed to the code segment of corresponding function that user needs to retrieve, according to the input of user's input
Output parameter type, user are for the output valve of its selected test data input and the label of user's input to above-mentioned generation
Summary file successively screened, qualified Summary file can be filtered out, be directed to each Summary file filtered out,
User can further according to each Summary file be directed toward each library file in store test code execution time, metacode complexity with
And the conditions such as code committed memory space carry out final choice again.Therefore under the present invention, without paying close attention to generation when user search
Code intersegmental part code, only need to pay close attention to need code input output parameter type and test result, pass through the input mode of specification
Optimum code segment can be quickly filtered out from a large amount of codes, the money of computer consumed by code search can be reduced by having
The fast and accurate advantage of source, code search speed.
(4) in the automatic connecting method of code of the present invention, code library file method library text generated of the present invention is obtained first
Part and the Summary file for being directed toward library file, are directed to the library file that user selectes, and obtain the Summary file for being directed toward the library file, read
The function name in Summary file is taken, function corresponding in library file is defined into content modification at straight after customized user function name
It connects and copies in the source code of user's input;Or newly-built header file, by the corresponding letter for being modified as customized user function name
Number is defined content and is added in the newly-built header file named with the function name read, is then added in the source code of user's input
Add the sentence for calling the header file;It is directed to the library file that user selectes, obtains the library file after user selects incoming variable
In call statement, by above-mentioned call statement be added to user input source code in user's specified function calling station, and
Variable therein is revised as the variable name that user is passed to.It can be seen from the above, the method for the present invention is after user selectes code segment, only
It needs the incoming variable of user's simple selection in the way of regulation that code can be realized to add automatically, and in adding procedure, energy
Matched variable name is enough automatically generated, to be coupled context, therefore the automatic connecting method of code of the present invention can reduce user's work
The code time of work amount and modification addition.
(5) in code automatic optimization method of the present invention, code library file method generated first of the present invention is obtained first
Library file and the first Summary file for being directed toward the first library file, are directed to the source code fragment of user's input, with reference to code of the present invention
Library file method generates library file and the second Summary file for being directed toward the second library file.Then according to input type, output class
Type and test result are matched for the second Summary file and the first Summary file, and screening obtains input type, output class
Type and test result the first Summary file identical with the second Summary file, then call the test generation in the first library file
Each group amplification data in first Summary file is input to test code and tested again, obtained each group and temporarily test knot by code
Fruit and store be input in the test code of the second library file into the first Summary file, while by above-mentioned amplification data, obtain
To the interim test result of each group and store into the second Summary file;For having above-mentioned the first Summary file got and
Two Summary files compare the interim test result of each group of the two, filter out the interim test result of each group and the second abstract text again
Identical first Summary file of part, and recommend user;User finally can be according to the information in the first library file (such as generation
Code, runing time etc.) final choice goes out first Summary file, using the source original code of first Summary file as optimization generation
Code section is replaced for selected source code fragment.It can be seen from the above, the source code fragment that the method for the present invention is inputted by deceleration user,
The source code fragment that user inputs can be substituted for and execute the faster code segment of speed, user is facilitated to promote code quality and operation
Performance.
(6) code auxiliary transplantation method of the present invention obtains code library file method the first library generated of the present invention first
File and the first Summary file for being directed toward the first library file, in the source code transplanting request for receiving user, for source code
It is sliced and generates the third library file of each code segment and the third Summary file of direction third library file after slice, needle
For being directed toward each third Summary file of each third library file, by its be directed toward each first Summary file of each first library file into
Row matching, the first input type, output type, language and environmental information of both matchings, are screened from each first Summary file
Input type and output type is identical as third Summary file and language and environmental information are that above-mentioned appointed language and environment are believed out
First Summary file of breath;It is directed to above-mentioned each first Summary file selected, by the test result wherein stored and third
Test result in Summary file compares, and therefrom filters out test result identical with third Summary file first again and plucks
File is wanted, and (such as code, runing time are believed by the information in these first Summary files and its first library file of direction
Breath) user is showed, it is selected for user, is directed to the first Summary file of user's final choice, code is automatic through the invention
Metacode section corresponding in first library file is transplanted in the source code of user's input by connecting method.From the foregoing, it can be seen that this hair
The bright code segment that two kinds of identical functions under different language and environment can be matched by characteristic information in Summary file, and
In migration process as unit of code segment, the transplanting mode as unit of sentence, the method for the present invention have compared to the prior art
It is fast to transplant speed, while reducing analysis of the user to labyrinth code segment, user only needs shirtsleeve operation that journey can be realized
The programming time of user is saved in the transplanting of sequence.
(7) in conclusion user can be retrieved by using the method for the present invention directly obtains the code for realizing a certain function
Section, reduce user be realization function and carry out logic analysis and write the workload of specific sentence, user can also spend more
More time pays close attention to the framework of entire program, is recommended by code segment and code Automatic Optimal makes outstanding algorithm more easily
User is spread to, therefore this method has positive effect for software industry.
Detailed description of the invention
Fig. 1 is code library file generation method flow chart of the present invention.
Specific embodiment
Below with reference to embodiment and attached drawing, the present invention is described in further detail, but embodiments of the present invention are not
It is limited to this.
Embodiment 1
Present embodiment discloses a kind of code library file generation methods, as shown in Figure 1, steps are as follows:
Step S1, the programming language for getting source code first mentions environmental information;
Step S2, the slice rule file that environmental information is loaded into corresponding language is mentioned according to the programming language of source code, then
Source code is divided into each independent code section with complete function according to the slice program in slice rule file;It is directed to
Each independent code section got is stated, whether retrieval wherein has called external code, if so, being then added to external code
In metacode section, ultimately generate without each metacode section for calling external code;
Step S3, it is directed to each metacode section, a library file is generated respectively first, then by each metacode section and each Yuan Dynasty
The corresponding source code address of code section and language and environmental information storage are into the corresponding library file of each metacode section;
Meanwhile it being directed to each metacode section, the entrance of metacode section is retrieved, by entrance in metacode section to function call portion
The sentence divided generates corresponding call statement;Above-mentioned generation call statement is added in library file;In the present embodiment, it is directed to
Each metacode first determines whether wherein whether function call sentence has data correlation sentence when generating call statement;If so,
The data correlation sentence is then added before the function call sentence in metacode section first, then retrieves entering for metacode section
Mouthful, the sentence of entrance in Optimized code section to function call part is generated into corresponding call statement;If it is not, then retrieving metacode section
Entrance, the sentence of entrance in metacode section to function call part is generated into corresponding call statement;Metacode section is retrieved, is passed through
Keyword and lexical analysis identify the inlet/outlet and label of metacode section;Wherein in the present embodiment, entrance refers to code segment
The sentence of middle input parameter, outlet refer to that the sentence of output parameter in code segment, entrance label refer to being expert in sentence
Add entrance/egress identifier annotation.
Meanwhile it being directed to each metacode section, amplification is carried out to it and generates test code, while generating test data list,
Each test data is according to certain sequential arrangement in list, the then each group test in test code in input test data list
Data, by obtaining corresponding each group test result after test code operation, by above-mentioned test code and each group test result
It is added in the corresponding library file of each metacode section according to the sequence of corresponding each group test data;
Meanwhile be directed to each metacode section, according to grammer obtain it is therein input output statement, mark the sentence be into
Mouth/outlet, extracted from inputoutput statement input output parameter type and function name, then said extracted is arrived
The input of each metacode section output parameter type and function name storage into the corresponding library file of each metacode section;And it obtains
Label in metacode section stores the label in metacode section into library file.
Step S4, be directed to each library file that step S3 is got, extract respectively the language wherein stored and environmental information,
Input output parameter type, function name, each group test result and label;
For each library file, generate the Summary file for being directed toward it respectively, by the content of each library file said extracted with
And amplification data is stored in the Summary file for being directed toward it as clip Text, and the address of each library file is added to direction
In its Summary file.In the present embodiment, test code is in standard environment in the library file that can also be directed toward Summary file
Under the execution time, the complexity of metacode and library file memory headroom occupy size information and be added in Summary file.
Step S5, each Summary file, the library file address that regular visit wherein stores, it is determined whether can be accessed are directed to
It extracts in the library file and the library file being accessed for whether the data as clip Text to have update;
If the library file is not accessed, the new address of the library file is inquired, if the new address of the library file cannot be found,
It deletes Summary file and the address in Summary file is replaced with into the new of the library file if inquiring the new address of the library file
Address;
If the library file, which is extracted, has update for the data as clip Text, library file storage is extracted again
For data as clip Text, the clip Text in Summary file being directed toward replaces with above-mentioned to be extracted again
Data.
In the present embodiment, the content of the library file storage got in step S3 is as follows:
In the present embodiment, the content stored in the Summary file got in step S4 is as follows:
:/* (function name);(input parameter type :);(output parameter type);*/
/ * (test result) result 1;As a result 2;As a result 3;......;*/
/ * (programming language);(environmental information);(surveying the execution time under code standard environment from generation to generation);(complexity);(memory
Space hold) */
The label of/* { label } here refers to the function segment of library file can solve which type of programming problem or function
Annotation, than if any function segment be sequence, have plenty of and do string matching, then label here respectively " sorts ",
" string matching " */
/ * library file address: the address ftp/local file address */
Wherein in Summary file, at the ending of above-mentioned library file address reproduction to abstract.In the present embodiment, library file
It is to be submitted to obtain after auditing by developer/user with the label stored in Summary file, system can pass through retrieval coding
The label that sentence, annotation, parameter generate.In the present embodiment, Summary file saves information in strict accordance with format, by punctuation mark
Different item is separated, retrieves different item whereby.Content all specific symbols as defined in system inside Summary file are spaced apart
Come, for example be just spaced apart with@between output type and test result, then knocks in Searchin when user program:
After int, then the character string that this int just starts in this region of input type inside Summary file matches, if abstract
Only one int of character inside file in this region of input type, then illustrate successful match, this is screened successfully for the first time.
In the present embodiment above-mentioned steps S1, the programming language for getting each source code mentions the detailed process of environmental information such as
Under:
Step S11, be directed to source code, retrieve the annotation of source code first, determine in whether there is or not record instructions and environment to believe
The character string of breath, if so, then therefrom directly reading language and environmental information;If nothing enters step S12;
Step S12, it is read since source code starting, reads character string one by one;
Step S13, it is directed to the character string currently got, environment is searched and judges each language in library/environment judgement text
Part judges whether there is language/environment and judges that file includes the character string;If so, entering step S14;If it is not, then entering step
S15;
Step S14, judge to read language and environment letter in file from language/environment where the character string currently read
Breath, and feed back the language and environmental information;Then judge whether to meet in all language and environmental information of current feedback with
Lower first condition and second condition, first condition: certain language message is anti-in all language and environmental information of current feedback
The number of feedback is more than y times, second condition, time that certain environmental information is fed back in all language and environmental information of current feedback
Number is more than q times;
If being all satisfied first condition and second condition, the language of source code is judged as this kind of language message, by source generation
The environment of code is judged as this kind of environmental information;
If only meeting first condition, and do not meet second condition, then the language of source code be determined as this kind of language message,
And the acquisition for terminating language source code information, subsequently into step S15;
If only meeting second condition, and it is to meet first condition, then the environment of source code is judged as this kind of environmental information,
And the acquisition for terminating source code environmental information, subsequently into step S15;
If first condition and second condition is not satisfied;Then enter step S15;
Step S15, whether the character string that judgement is currently read is source code last character string, if so, into
Step S17;If it is not, then entering step S16;
Step S16, the character late string in source code is read, as the character string currently read, subsequently into step
Rapid S13;
Step S17, all language and environmental information of obtaining step S14 feedback;When source code language message also not by
When judging, then using by the most language message of Times of Feedback as the language message of source code;When the environmental information of source code
When not being judged out also, then using by the most environmental information of Times of Feedback as the environmental information of source code.
The code that different programming languages is write as, such as C language, C++, java etc. realize same algorithm, but code is certain
Be it is distinguishing, the present embodiment above-mentioned steps are exactly by feature exclusive in code (such as the standard library text for including in code
Part, header file, inputoutput statement etc.) carry out language and Context awareness and differentiation.Such as it is directed to following source code (note
For code 1), the first row retrieves the exclusive sentence of C Plus Plus " #include<iostream>", then " programming language: C++ " is defeated
Out to system, and " programming language: the C++ " frequency counts+1 and (detects the peculiar character string of language/environment then by its frequency for the first time
1) secondary counting is denoted as, language/environment frequency counting at this time is less than y/q times, therefore continues to retrieve.Note is retrieved in the 24th row
" C Plus Plus " is released, then " programming language: C++ " is exported to system, and the keyword counts+1, at this time language/environment frequency
Counting is less than y/q times, therefore continues to retrieve.24th row retrieves annotation " general-purpose platform " → then " programmed environment: general flat
This information of platform " is exported to system, and " programmed environment: general-purpose platform " counts+1.If not having language letter having read source code
Breath or environmental information are still not up to frequency of occurrence y and q times, then language message (the i.e. programming language for selecting frequency of occurrence most respectively
Speech: C++) and environmental information (i.e. programmed environment: general-purpose platform) be judging result.System is by its (" // programming language: C++;It compiles
Journey environment: general-purpose platform ") it is added to source code head.
Code 1:
In the present embodiment above-mentioned steps S3, in order to identify mode that differentiation is output and input, spy's 4 seed types of name are to protect
It is stored in the input type and output type partial information of library file: 1, user's input type: the variable manually typed in by user, than
The type name int of cin > > a input by sentence that variable a is such as used, retrieval should make an amendment after obtaining its types of variables name: it becomes
Amount type name prefixing (such as: " c_ " is " c_ type name ": being added to library file after c_int).2, it prints out type: using defeated
The type of that variable exported after sentence out, for example the type of the variable occurred after cout < < sentence is used, retrieval obtains it
It should make an amendment after types of variables name: its types of variables name prefixing (such as: " p_ " i.e. " p_ type name ": be added to library after p_int)
File.3, be passed to type: non-user input type contains: serving as the type, macrodefinition, pointer, number of those of function parameter variable
The type of the variables such as group, the corresponding type name of retrieval variable are simultaneously added to library file;4, type: non-print output class is spread out of
Type contains: the corresponding type such as the type of return value, macrodefinition variable, pointer variable when function has return value, its variable is corresponding
Type name be added to library file.When identifying function name, input/output type in metacode section in the present embodiment, need to accuse
Tell how computer identifies, that is, the foundation identified, such as one section of function code must have the type name of function, such as void,
After void and " (" before one be set to function name, so it is exactly that we are conceivable that the character between this, which is extracted,
Function name;It is the same that identification, which outputs and inputs the reason of type, such as such as common input type: int, char,
Float etc. is saved in together according to the form of character string one by one, it and function code section are then done string matching,
To find out the input type of function code section.It is above-mentioned through this embodiment such as in following code in (be labeled as code 2)
It after identification, obtains: (function name) insert_sort;(biography/input type :) int [], int;(biography/output type) int [].
Code 2:
The above method is only capable of calling in face of simple, can not solve the problems, such as that macrodefinition variable, customization type make parameter.Therefore
The present embodiment proposes another more improving method: Variable search: 1. according to the rule of arithmetic section in grammer and input/output
(in arithmetic statement variable closely operator thus by operator find variable, in input/output sentence variable by keyword < <
With > >) retrieval obtain the variable name in code segment;2. retrieving the sentence containing the variable by searching for the variable name (searches source generation
Code), whether be macrodefinition sentence, input/output sentence, if otherwise retrieving next, if label should if retrieving in the sentence
Sentence is inlet/outlet and the sentence for retrieving variable-definition, and (1) directly exports if variable is fundamental type, and (2) are if macro fixed
The variable of justice is added to code segment and labeled as macrodefinition, retrieves the sentence and obtains the type of variable and export to system;(3) if
Then character constant is added in code segment for character constant;(4) if then variable is customization type, by customization type
Definition statement is added to code segment and labeled as customization type, and the definition statement for retrieving the customization type obtains variable name
Types of variables is simultaneously exported to system.
In the present embodiment, step S3 is directed to each metacode section, and the method that amplification generates test code is carried out to it and is adopted
With template additive process, scalping method or supplement method, in which:
In the present embodiment, it is as follows that the step of testing code, is obtained using template additive process:
Step 1. is according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;Template is determined
Justice: the code skeleton write, metacode section need to be only added in the code of template can be formed it is executable complete
Program;Template consists of two parts: retrieval content and code;Retrieval content is for system retrieval when screening.
Step 2: retrieval metacode section identifies the inlet/outlet and mark of metacode section by keyword and lexical analysis
Note;Wherein in the present embodiment, entrance refers to the sentence that parameter is inputted in code segment, and outlet refers to the language of output parameter in code segment
Sentence, entrance label, which refers to being expert in sentence, is added into mouth/egress identifier annotation.
Step 3: labeled sentence being split as character string, by the character string splitted out to the template of above-mentioned screening
Inlet/outlet keyword is matched, and the most template of occurrence is selected, and matching template is completed;
Metacode section is added to template elected, obtains test code, and be deposited into corresponding library file;
Such as metacode section is as follows:
According to information above matching template and add metacode section obtain test code it is as follows:
In the present embodiment, it is as follows that the step of testing code, is obtained using scalping method:
The metacode section that correspondence will generate test code is defined as object code section by the copy for firstly generating source code;
In the copy of source code, by above-mentioned object code section sentence labeled as reservation sentence, and other metacode sections are deleted, together
When delete call other metacode sections sentence;
Searched targets code segment call statement obtains input variable therein, is retained in target by input variable name retrieval
Make the associated sentence of input variable in code segment call statement before calling main body function and defines the sentence of input variable, mark
It is denoted as reservation sentence, deletes remaining sentence comprising input variable name;Remaining unrelated sentence is deleted simultaneously;
It is deleted using side in the copy for becoming the method deletion source code of debug and is not labeled as the sentence retained, obtained last
The sentence arrived is minimum and complete code is as test code, and is deposited into corresponding library file;
It is handled for example, by using copy (be labeled as code 3) of the above-mentioned scalping method of the present embodiment to following source code,
Middle necessity structured statement is the necessary sentence for instigating code executable, is defined by developer.When deleting, the method for debug is specifically such as
Under: 1, a first progress debug and test (retrieval coding section entrance and exit in entrance give code segment assignment, in outlet insert
Enter test statement to obtain as a result, test can omit);2, non-reserved being associated property of sentence is analyzed into (the phase intermodulation between sentence
With, it is nested), the sentence that is mutually related is a part;3, it is partially deleted one by one, it is every to delete a part progress once
Debug and test, if continuing to delete next part by (debug no problem, test result are identical with testing for the first time), if nothing
Method continues to delete next part, until remaining sentence is marked as protecting entirely by then restoring the part and being marked as retaining
It stays.
Code 3 is as follows:
In the present embodiment, it is as follows that the step of testing code, is obtained using supplement method:
Step S3a, according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;
Step S3b, 1 is operated: according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;
Operation 2: retrieval metacode section identifies the inlet/outlet and label of metacode section by keyword and lexical analysis;Operation 3:
Labeled sentence is split as character string, inlet/outlet of the character string splitted out to the template of above-mentioned screening is crucial
Word is matched, and the most template of occurrence is selected, and matching template is completed;
Step S3c, metacode section is added to the template that step S3b is selected, obtains test code;
Step S3d, the test code obtained using step S3c tests the test data of input, if test can not
Pass through;Then execute following steps:
Step S3d1, the metacode section that correspondence will generate test code is defined as target generation by the copy for generating source code
Code section;In the copy of source code, by above-mentioned object code section sentence labeled as reservation sentence, and other metacode sections are deleted
It removes, while deleting the sentence for calling other metacode sections;
Step S3d2, searched targets code segment call statement obtains input variable therein, is retrieved by input variable name
Being retained in object code segment call sentence before calling main body function becomes the associated sentence of input variable and definition input
The sentence of amount deletes remaining sentence comprising input variable name labeled as sentence is retained;Remaining unrelated sentence is deleted simultaneously;
Step S3d3, not retained sentence is directed in the copy of source code, and the analysis of being associated property will be interrelated
Sentence conclude to together, as a partial code;
Step S3d4, it is directed to various pieces code obtained above, chooses one of partial code first, as working as
Preceding partial code;
Step S3d5, current portions code is added in the template that step S3b is filtered out, then adds metacode section
Into the above-mentioned template got, test code is obtained;It is directed to above-mentioned test code, input test data are once surveyed
Examination enters step S3d6 if test does not pass through using above-mentioned test code as final test code if test passes through;
Step S3d6, next partial code is chosen as current portions code, step S3d5 is then executed, until obtaining
Test code input test data can pass through after once testing, and will be deposited above by the test code after test
Enter into corresponding library file.
In the present embodiment code library file generation method, further include be directed to library file duplicate checking that step S3 is got and
Merging treatment, wherein duplicate library file refers to: several library file input types are identical, and output type is identical also identical, and
Algorithm in code etc. is all identical, but the variable name of defined variable may be different, and the label of this section of code how much may not
Together, such several library files are just known as duplicate library file
Specific step is as follows:
Step S31, the identical Summary file of stored input type, output type, test result is filtered out first;
Step S32, for the S31 Summary file filtered out and its library file of direction, amplification assay is added wherein
Data, the test code in library file for then calling it to be directed toward, above-mentioned each group amplification assay data are sequentially inputted to test
Successively get each group amplification assay respectively after being tested in code as a result, the amplification assay result that above-mentioned ought be got group
Number reaches certain value, then stops testing, and above-mentioned each group amplification assay result is added to Summary file;
Step S33, it for each Summary file of the S32 each library file of direction got, matches each in each Summary file
Group amplification assay extracts as a result, being screened out from it each group amplification assay result and corresponding to identical Summary file;
Step S34, it is directed to the Summary file that step S33 is filtered out, each library file of its direction is obtained, according to the meaning of one's words
With metacode section in above-mentioned each library file, the library file that semantic similarity after matching is greater than certain value is considered as repetition library file;
Step S35, for the terminal of preservation library file: being directed to the repetition library file that step S34 is got, retain and call
The library file that time is minimum and attribute is does not allow to delete;Then in the case where terminal allows to carry out label addition by other libraries
The label of file is added in retained library file, the address of retained library file is added to other library files, and delete
Except other contents repeated in library file in addition to retained library file address, so that other library files that repeat contain only retained library
File address;
Wherein, the above-mentioned other preservations for repeating library file and the Summary file for being directed toward it for containing only retained library file address
Time is persistence or temporarily saves;Wherein, when temporarily to save, the time temporarily saved is accessed regularly for library file
Maximum duration interval, be more than above-mentioned time interval after, it is other repeat library files will be deleted;In above-mentioned time interval,
When accessing other repetition library files by being directed toward other Summary files for repeating library file, retained library text can only be retrieved
The address of part, the library file address in the other Summary files for repeating library file of the direction is substituted for retained library file at this time
Address, to realize the update for the Summary file that other library files of the direction are directed toward;
Wherein, it is directed to retained library file, when the Summary file by being directed toward it accesses the library file, if learning
Label in the library file increases, then is added to the label increased in the Summary file for being directed toward it;
Wherein, in library file access process, if library file can not be accessed by the library file address in Summary file
When, then search request is issued to terminal, terminal is searched summary info other Summary files identical with the Summary file, found
The library file address in the Summary file is replaced with into above-mentioned find in the Summary file met after the Summary file met
Library file address;
For example, in the present embodiment, library file is placed on the storage region in some computer (terminal) or server, if
There are 5 library files this when in storage region or server in computer, number is 1,2,3,4,5 respectively, while having 5
A Summary file, number are also 1-, 2-, 3-, 4-, 5-, and each Summary file and corresponding library file are associated, for example No. 1- is plucked
Wanting file to be directed toward, No. 1 library file is associated, by our step 31 to after 34, it was found that No. 1 library file and No. 2 library files are
It is duplicate, so they are carried out with the merging treatment of step 35;Before merging, it would be desirable to judge 1, No. 2 the two library texts
Is which more excellent for part, retains more preferably library file, then problem is come, how to judge which library file is more excellent? this just uses " library
This concept of file allocating time ", address (this being meant that inside terminal access abstract of " library file allocating time "
Address is the address of some library file inside local server or memory block) time of terminal is downloaded to library file, certainly, this
A time is shorter, illustrates that this library file is more excellent, if then No. 1 library file is more excellent, then needs to retain 1 by test discovery
Number library file, then the label-copying in No. 2 library files into No. 1 library file, while the content in No. 2 library files is all deleted
Fall, and the address of No. 1 library file is added to No. 2 library files, that is to say, that the information that this when, No. 2 library files the insides saved
The address of only No. 1 library file, then finding No. 2 libraries when user removes No. 2 library files of access by 2- Summary file
The link of only one address, then have found No. 1 library file by this link, 2- Summary file will be according to No. 1 library inside file
File updates summary info and address: be more than library file be accessed regularly maximum duration interval when No. 2 library files and No. 2-
Summary file is deleted together;Wherein when in the maximum duration interval being accessed regularly in library file, plucked when by being directed toward No. 2-
When wanting No. 2 library files of file access, the address of No. 1 retained library file will can only be retrieved in No. 2 library files, at this time should
Library file address in 2- Summary file is substituted for the address of No. 1 library file, to realize the update of 2- Summary file.When
When user removes No. 1 library file of access by 1- Summary file, it is found that library file label here increases, then this
A little increased labels are also copied to 1- Summary file, and which achieves the updates of Summary file, while also duplicate No. 2 libraries
File and 2- Summary file delete together, to realize the duplicate checking and combined function of library file.
Embodiment 2
Present embodiment discloses a kind of code search methods, and steps are as follows:
Step X1, code library file generation method in embodiment 1 is obtained first to generate library file and be directed toward plucking for library file
Want file;
Step X2, after receiving the code segment searching request of user:
Step X21, the code segment input type that user needs is obtained, the defeated of input type and the code segment is then filtered out
Enter the identical Summary file of type;
In the present embodiment, the search shortcut key of setting user input, can be the Jian Tou ↙ towards lower left, works as user
Input: searchin:int, int: ↙, the then input type and each abstract that system can be inputted according to user match, such as
Step X21, if then there are this when 1000 Summary files to meet such case, it will search result is shown to us
Are as follows:
Result:1000Counts (shares 1000 search results);
If the code segment that user wants does not input, we just provide that user should knock in searchin at this time:
Enter key indicates no input type, then system will be screened according to this condition, filters out the function code of no input
Section, and user is shown to how many such Summary files are shared.In the present embodiment, want if there is user in ideal
User's key entry or printout are carried out in code segment, for example use scanf, cin, printf, the I/O modes such as cout
When, the input mode for searching for key entry then needs the prefixing " c_ " before input type name to key in: " searchin:c_ class
Type name " search, the way of output for searching for printout then need to need the prefixing " p_ " before output type name to input: " key
Enter: searchout:p_ type name.
Step X22, the code segment output type that user needs is obtained, from the Summary file filtered out in step X21 again
It is secondary to filter out output type Summary file identical with the output type of the code segment;
In the present embodiment, the output type of user's input can be set as: Searchout:int: ↙, wherein
Searchout is the identifier for showing output type, it is assumed that output type is an int type variable here, then needs stamping
Identifier Searchout: after stamp int, this when can again to generated after the completion of step X21 operation one that 1000
Search result carries out two wheel matchings, this matching is matched according to output type result, and hypothesis is by original after the completion of matching
1000 search results come become 500 search results, then can show on interface:
Result:500Counts
Such sentence is used to prompt user's the selection result.
Step X23, it is generated according to the input type of user's input and is formed by multiple groups test data according to certain sequential arrangement
Test data list, corresponding test data is selected for user by the test data list, it is selected according to its by user
Test data inputs corresponding output valve;It is directed to each group output valve that user inputs its selected each group test data, it will
The each group test result in Summary file filtered out in each group output valve and step X22 is matched, and each group is screened out from it
Test result is with user to the identical Summary file of its selected each group output valve of each group test data input;
In this step, user can according to oneself want code segment function according to select system recommendation multiple groups
Numerical value is inputted, goes manually to input corresponding output valve, for example wants one section of code segment for seeking two shaping number maximum values, this
When system recommendation [1,2] this group input numerical value, certainly, user just needs after striking lower output type again manually this when
The output valve for inputting corresponding input is [2], that subsequent 3 groups of recommendation numerical value are same reasons, this when, system can root
It is matched according to the test result in above-mentioned output valve and Summary file, because being to the system recommendation value of the input of concrete type
It is determining, so, be also determining according to the result that this input is run in test code, and generate Summary file when
Time can be indexed to together above-mentioned test result inside Summary file, be exactly the data result matching use for this step,
It is 20 remaining also in assuming after being screened in the remaining 500 abstracts result of step X22, then show that following one section of character is reminded
User, wherein system can specify that when the item number of search result is less than or equal to 30, will show tags label:
[2][3][4][4]
One section of prompting character of display:
Result:20Counts
Tags:0- [maximizing=3], 1- [sequence=1], 2- [platform=4 arm],
3- [platform=3 x86], 4- [full platform=4];
Wherein No. 0 tag representation is meant that last remaining 3 code segments are for maximizing and to meet step
The condition that rapid X21 screen to step X23 three-wheel, No. 1 tag representation are meant that 1 code segment of last residue is for sorting
And meet the condition that step X21 is screened to step X23 three-wheel, No. 2 labels refer to that remaining 4 code segments can either be in arm
It is run on platform and also can satisfy the condition that step X21 is screened to step X23 three-wheel.
Step X24, the first label that the needs that user selectes retain is obtained, the abstract text that step X23 is filtered out is directed to
Part compares label therein and the first label, screens outgoing label and the identical Summary file of the first label again, obtains
The second label that the needs that user selectes are deleted screens outgoing label and the second label from the above-mentioned Summary file filtered out again
Identical Summary file, and deleted;
In the present embodiment, " hold: " is used when setting retains the keyword of some label, meaning input, this is crucial
After word, the code segment of certain number label will remain in recommendation, use when deleting the keyword of some label
" remove: " means and is deleted in the reality of recommendation the label is corresponding, such as:
hold:0,4;Or remove:1,2,3;
Indicate that meet No. 0 label and the metacode section of No. 4 label common prescriptions leaves in recommending display, remaining deletion,
For example meet No. 0 label, it is desirable that code segment can maximizing function, share 3 metacode sections, meet No. 4 labels,
Code segment is asked to be screened in this way can also run on full platform under the premise of maximizing, if it is last only surplus
Lower 3 recommendations, there will be following statement prompt users:
Result:3Counts
XXX (indicates the corresponding library file code of 3 abstracts).
Step X25, the step X24 Summary file finally retained is recommended into user, gets corresponding library text for user
Part is tested and is selected.In the present embodiment, when user gets each Summary file of system recommendation, the abstract is called
The test code in library file that file is directed toward, while user selectes test data and inputs the output of corresponding test data
Value, will test be input to test code in running, get test result, if the above-mentioned test result got and
User is identical for the output valve of selected test data input, then the Summary file retains, on the contrary then delete.
In the present embodiment, after step X25, user can test code according in the library file pointed by Summary file
Runing time and the parameters such as library file committed memory space carry out more deep screening;Such as user is manually entered 3 groups
The specific value of [int, int] is run and is shown in the test code in the library file pointed by the corresponding Summary file recommended
Operation result and elapsed time are shown, such as have been manually entered testin:[7,4] [12,2] [999,0] (wherein testin is table
Show manual test library file keyword or it be referred to as identifier), this when, this input can residue recommend a member
Code segment, b metacode section are run in c metacode section, and show operation result and elapsed time, such as show:
testout:a:[7][12][999]:0.01s
b:[7][12][999]:0.03s
c:[7][12][999]:0.02s
At this point, user can be according to the shortest a metacode section of above-mentioned runing time.
Wherein, if user wants to see some parameters (complexity, the speed of service, in occupancy of satisfactory code segment
Deposit space size etc.), need to knock in keyword manually: show- filename .up .up expression parameter rises sequence, and .f indicates ginseng
Number size decline sequence;
Such as it knocks in manually:
Show-a.up or show (sequence sequence-default sort that complexity rises)
It can then show that the operating parameter (sorted) of three library files is as follows:
Sort:a- [complexity], b- [speed of service], c- [EMS memory occupation size];
a.h:10;0.02s;0.1KB;
b.h:20;0.03s;0.2KB;
c.h:30;0.01s;0.3KB;
After aforesaid operations, if wanting to retain ideal code segment or removing relatively undesirable code segment, it can carry out
It operates below for example:
hold:[7][12][999];↙
Or hold:a.test (retaining library file identical with a.h test result);↙
Or remove:b.test (removing library file identical with b.h test result);↙
Remaining display after deletion:
a.h:10;0.02s;0.1KB;
c.h:30;0.01s;0.3KB;
With aforesaid operations, the i.e. corresponding library file of qualified metacode will be fewer and fewer, wherein after aforesaid operations,
If leaving two qualified code segments is a.h and b.h respectively, if that programmer wants to check some library file
Specific code section can knock in keyword+library file name, such as knock in view:a.h, correspondence can be then shown after c.h ↙
The metacode section of library file is for reference, in order to which user selects a final code segment.In addition, determining some in user
After library file, and want with the metacode section in the library file, it is only necessary to knock in determine+ library file name manually
, such as: determine:a.h ↙.
Embodiment 3
Present embodiment discloses a kind of automatic connecting methods of code, and steps are as follows:
Step Y1, code library file generation method in embodiment 1 is obtained first to generate the library file selected for user and refer to
To the Summary file of library file;
Step Y2, customized user function name is obtained, the library file that user selectes is directed to, reads and is directed toward the library file
Summary file function name, and be defined as library file function name;It is fixed to extract corresponding function in the library file metacode
Adopted content simultaneously makes following modification: function being defined library file function name in content and replaces with user function name, is then repaired above-mentioned
Function after changing defines content and is added in the source code of user's input;
Obtain customized user function name;It is directed to the library file that user selectes, reads the abstract for being directed toward the library file
The function name of file, and it is defined as library file function name;Header file is created simultaneously and is named with user function name, is then mentioned
It gets corresponding function in the library file metacode to define content and make following modification: function is defined into library file function in content
Name replaces with user function name, and above-mentioned modified function is defined content and is added in newly-built header file, finally exists
The sentence of the header file is called in addition in the source code of user's input;
Step Y3 is directed to the library file that user selectes, and the tune in the library file is obtained after user selects incoming variable
With sentence, above-mentioned call statement is added to user's specified function calling station in the source code of user's input, and will wherein
Variable name be revised as the variable name that user is passed to.
In the present embodiment, following code 4 is metacode section in the library file selected of user, when by library file metacode section
The corresponding function of middle function name defines after content is directly appended to the source code of user, and obtained user's source code is following generation
Code 5.User can be reminded to modify incoming variable: int a [], int n in the automatic connecting method of the present embodiment code;// incoming
Categorical variable name;User inputs the following contents at this time: a [] -> b [], N- > n ↙, can be realized by call statement a [] and
N variable is respectively modified as the incoming variable b [] and n of user's selection, by " N=sizeof (a)/sizeof (int);" be modified as
" n=sizeof (b)/sizeof (int);", " insert_sort (a, N) " has been modified as " insert_sort (b, n);"
Code 4:
Code 5:
Embodiment 4
Present embodiment discloses a kind of code optimization methods, and steps are as follows:
Step Z1, code library file generation method described in any one of claims 1 to 5 is obtained first generate library file
And it is directed toward the Summary file of library file, it is defined as the first library file and the first Summary file;
It is directed to the source code fragment that user selectes, firstly generates second library file, while obtaining the source code fragment
Entrance and exit, from entrance and exit extract input output parameter type and function name, then by the source code fragment and its mention
The input of taking-up output parameter type and function name be added to the second library file;
It is directed to the source code fragment that user selectes simultaneously, amplification is carried out to it and generates test code, and is stored to second
In library file, while test data list is generated, then each group in test code in input test data list tests number
According to by obtaining corresponding each group output after test code operation as a result, above-mentioned each group output result is added to the second library text
Part;
Meanwhile amplification assay data are added in the second library file;
Step Z2, it is directed to the second library file of step Z1 generation, second Summary file for being directed toward it is generated, extracts
The input stored in second library file output parameter type, function name, each group output result and amplification assay data, and
It stores the result of said extracted as clip Text into the second Summary file, while the storage of the address of the second library file being arrived
In second Summary file;
Step Z3, the finger that will be got in the second Summary file of the second library file of direction that step Z2 is obtained and step Z1
It is matched to each first Summary file of each first library file, specific matching process is as follows:
Step Z31, the input type in the second Summary file is obtained, is then selected from each first Summary file defeated
Enter type the first Summary file identical with the input type in the second Summary file;
Step Z32, the output type in the second Summary file is obtained, each first abstract text filtered out from step Z31
Output type the first Summary file identical with the output type in the second Summary file is filtered out in part again;
Step Z33, each group obtained in the second Summary file exports as a result, each first filtered out from step Z32 is plucked
It wants to filter out each group output result again in file and exports result corresponding identical first with each group in the second Summary file and pluck
Want file;
Step Z34, it is directed to each first Summary file that step Z33 is filtered out, adds amplification assay data wherein, together
When obtain its direction each first library file and wherein add amplification assay data;It is directed to above-mentioned every 1 got
In one library file, each group amplification assay data in the first Summary file that input is directed toward it in test code pass through test
Corresponding each group is obtained after code operation temporarily to export as a result, above-mentioned each group is temporarily exported result according to corresponding each group amplification survey
First library file and be directed toward in the first Summary file of first library file that the sequence of examination data is added to;
It is directed to the second library file simultaneously, calls test code therein, then inputs second respectively in test code
Each group amplification assay data in Summary file are temporarily exported by obtaining corresponding each group after test code operation as a result, will
Second library file and the first abstract that the above-mentioned interim test result of each group is added to according to the sequence of corresponding each group amplification data
In file;
Step Z35, the interim test result of each group in the first Summary file, each first got from step Z34 are obtained
The interim test result of each group is filtered out in Summary file and the interim test result of each group in the second Summary file is corresponding identical
First Summary file;
Step Z36, each first Summary file filtered out for step Z35, is looked by the library file address wherein stored
Each first library file is found, the runing time for testing code in above-mentioned each first library file is got;Then step Z35 is screened
The runing time that code is tested in each first Summary file and its each first library file being directed toward out shows user, for
User selects, finally by the first library text pointed by the library file address stored in the first Summary file that user selects
Metacode section in part replaces the source code fragment that user selectes with Optimized code section as Optimized code section.
In the present embodiment, replacing the code segment that user selectes using Optimized code section, detailed process is as follows:
Step Z361, the first Summary file of the first library file where Optimized code section is directed toward in retrieval and direction optimised generation
Second Summary file of code section, reads the function name in first Summary file and the second Summary file, respectively corresponds and be defined as
Library file function name and user function name;Corresponding function in the first library file metacode is extracted to define content and do as follows
Modification: function is defined into the library file function name in content and replaces with user function name;Then above-mentioned modified function is determined
Adopted content is added in the source code of user's input;
Or retrieval is directed toward the first Summary file of the first library file of Optimized code section place and is directed toward optimised code segment
The second Summary file, read the function name in first Summary file and the second Summary file, respectively correspond and be defined as library text
Part function name and user function name;It creates header file and is named with user function name, extract the first library file metacode
In corresponding function define content and make following modification: library file function name function defined in content replaces with user function
Name;Then above-mentioned modified function is defined content to be added in newly-built header file, finally in the source code of user's input
The sentence of the header file is called in middle addition;
Step Z362, the first library file where being directed to Optimized code section, obtained after user selects incoming variable this
Above-mentioned call statement is added to user's specified function invocation bit in the source code of user's input by the call statement in one library file
It sets, and variable therein is revised as the variable name that user is passed to.
In the present embodiment step S36, user can test in the first library file according to pointed by the first Summary file
The parameters such as the runing time of code and library file committed memory space carry out more deep screening, and carry out code parameter
Display, check code and determine code operation;Specifically deeper into screening mode and code parameter show, check generation
Code is with the operation of determining code as in embodiment 2.
Embodiment 5
Present embodiment discloses a kind of code auxiliary transplantation methods, and steps are as follows:
Step B1, code library file generation method described in embodiment 1 is obtained first to generate library file and be directed toward library file
Summary file is defined as the first library file and the first Summary file;
In the source code transplanting request for receiving user, be divided into source code according to slice rule file has first
Each independent code section of complete function;It is directed to the above-mentioned each code segment transplant got, is generated respectively first
One third library file, and retrieve each code segment input output statement, extracted from inputoutput statement input it is defeated
Parameter type and function name out, the input for then arriving said extracted output parameter type, function name storage to each code segment
In corresponding third library file;
Meanwhile it being directed to the above-mentioned each code segment transplant got, amplification is carried out to it generates test generation
Code, and multiple groups test data is generated, it is sorted by multiple groups test data and generates test data list, then in test code segment
Each group test data in input test data list will by obtaining corresponding each group test result after test code operation
The third library file that above-mentioned each group test result is added to according to the sequence of corresponding each group test data;
It is directed to the third library file of the above-mentioned each code segment got, generates the third Summary file for being directed toward it,
Extract in third library file the input that stores output parameter type, function name and each group test result, and by said extracted
Result as clip Text store into third Summary file, while by the address of third library file storage to third make a summary text
In part;
Step B2, it is directed to each third Summary file for each third library file of direction that step B1 is obtained, by itself and step
Each first Summary file of each first library file of direction got in B1 is matched, and specific matching process is as follows:
Step B21, the input type and output type in third Summary file are obtained, while obtaining what user to be transplanted to
Then the language and environmental information of code filter out input from each first Summary file as appointed language and environmental information
Type and output type is identical as third Summary file and language and environmental information are the of above-mentioned appointed language and environmental information
One Summary file;
Step B22, each group obtained in third Summary file exports as a result, each first filtered out from step B21 is plucked
It wants to filter out each group output result again in file and exports result corresponding identical first with each group in third Summary file and pluck
Want file;Needle passes through the library file address search that wherein stores to each first library in above-mentioned each first Summary file filtered out
File gets the runing time that code is tested in above-mentioned each first library file;Then by above-mentioned each first abstract filtered out
The runing time that code is tested in file and its each first library file being directed toward shows user, so that user is to need to transplant
Selected corresponding first Summary file of each code segment;
Step B23, being directed to user, finally to need, the code segment transplanted is corresponding to be selected the first Summary file and needs
The third Summary file of the code segment of transplanting reads the function name in first Summary file and third Summary file, right respectively
It should be defined as library file function name and user function name;Extract the first library file metacode pointed by first Summary file
In corresponding function define content and make as modification: function is defined to the library file function name in content and replaces with user function
Name;Then above-mentioned modified function content is defined to be added in the source code of user's input;
Or it is directed to user and is finally selected the first Summary file by the code segment correspondence that needs are transplanted and need to transplant
Code segment third Summary file, read the function name in first Summary file and third Summary file, it is fixed to respectively correspond
Justice is library file function name and user function name;Create header file and with the name of user function name;Extract first abstract
Corresponding function defines content and makes following modification in first library file metacode pointed by file: function is defined in content
Library file function name replace with user function name;Then above-mentioned modified function is defined into content and is added to newly-built head text
In part, the sentence for calling the header file is finally added in the source code of user's input;
Step B24, being directed to user finally is that each source code fragment transplanted is needed to correspond to selected first abstract text
First library file pointed by part obtains the call statement in first library file after user selects incoming variable, will be above-mentioned
Call statement is added to user's specified function calling station in the source code of user's input, and variable therein is revised as using
The incoming variable name in family.
In the present embodiment, the division of source code described in step B1 can be that user divides manually or system divides automatically,
Wherein:
Divide and refer to manually: user selectes some sentences manually and divides a code segment into;Such as:
(division operation) divide:3 (line statement) -9 (line statement) ... to insert_sort (code segment name 1);
System divides automatically to be referred to: it is identified according to the definition statement for the structure for realizing concrete function, such as: in C++
Function structure, the class formation in Java.
Such as the old source code (being labeled as code 6) of user is as follows:
Code 6:
Then the c language of code 7 is by obtaining the new source code under java language environment after the transplanting of method through this embodiment
(being labeled as code 7) is as follows:
It should be noted that test data involved in the various embodiments described above is multiple groups test as defined in system
Data form test data table column according to determining sequential arrangement, and test data table column are equally as defined in system.Every kind basic
Categorical data has corresponding test data.The test result saved in Summary file is corresponding according to the order that test data table arranges
It saves.Therefore system can find corresponding test result according to the order for the test data that user selectes.For example: input class
Type be int → the test data table of int is classified as: 0,1,2,3,4,5 and feed back to user's selection, user selects at this time: 0
(order is 1 in table column), 1 (order is 2 in table column), the corresponding result of user's input: 0,2, system retrieves test knot according to order
First output Summary file that (order 1) result is 0 and second (order 2) test result is 2, can be found in fruit with this
The Summary file of the output valve of input described in selected test data is directed to test result and user.
The above embodiment is a preferred embodiment of the present invention, but embodiments of the present invention are not by above-described embodiment
Limitation, other any changes, modifications, substitutions, combinations, simplifications made without departing from the spirit and principles of the present invention,
It should be equivalent substitute mode, be included within the scope of the present invention.
Claims (10)
1. a kind of code library file generation method, which is characterized in that steps are as follows:
Step S1, the programming language for getting source code first mentions environmental information;
Step S2, the slice rule file that environmental information is loaded into corresponding language is mentioned according to the programming language of source code, then basis
Source code is divided into each independent code section with complete function by slice rule file;It is directed to the above-mentioned each independence got
Code segment, whether retrieval wherein has called external code, if so, then external code is added in metacode section, finally
It generates without each metacode section for calling external code;
Step S3, it is directed to each metacode section, generates a library file respectively first, each metacode section and each metacode section is corresponding
Source code address and language and environmental information store into the corresponding library file of each metacode section;
Meanwhile it being directed to each metacode section, the entrance of metacode section is retrieved, by entrance in metacode section to function call part
Sentence generates corresponding call statement;Above-mentioned generation call statement is added in library file;
Meanwhile it being directed to each metacode section, amplification is carried out to it and generates test code, while generating includes each group test data
Test data list, then each group test data in test code in input test data list, passes through test code fortune
Corresponding each group test result is obtained after row, and above-mentioned each group test result is added in the corresponding library file of each metacode section;
Meanwhile be directed to each metacode section, according to grammer obtain it is therein input output statement, mark the sentence be entrance/go out
Mouthful, extracted from inputoutput statement input output parameter type and function name, each Yuan Dynasty for then arriving said extracted
The input of code section output parameter type and function name store into the corresponding library file of each metacode section;And obtain metacode
Label in section stores the label in metacode section into library file;
Step S4, it is directed to each library file that step S3 is got, extracts the language wherein stored and environmental information, defeated respectively
Enter output parameter type, function name, each group test result and label;
For each library file, the Summary file for being directed toward it is generated respectively, using the content of each library file said extracted as plucking
It wants content to be stored in the Summary file for being directed toward it, and the address of each library file is added in the Summary file for being directed toward it.
2. code library file generation method according to claim 1, which is characterized in that further include following steps:
Step S5, each Summary file, the library file address that regular visit wherein stores, it is determined whether the library can be accessed are directed to
It extracts in file and the library file being accessed for whether the data as clip Text to have update;
If the library file is not accessed, the new address of the library file is inquired, if the new address of the library file cannot be found, is deleted
Address in Summary file is replaced with the new address of the library file if inquiring the new address of the library file by Summary file;
If the library file, which is extracted, has update for the data as clip Text, the use of library file storage is extracted again
In the data as clip Text, the clip Text in Summary file being directed toward replaces with the above-mentioned number extracted again
According to.
3. code library file generation method according to claim 1, it is characterised in that: further include following steps: for step
The library file that rapid S3 is got carries out duplicate checking and merging treatment, specifically:
Step S31, the identical Summary file of stored input type, output type, test result is filtered out first;
Step S32, the Summary file filtered out for S31 adds amplification assay data wherein, it is then called to be directed toward
Test code in library file, by above-mentioned each group amplification assay data be sequentially inputted to test code in tested after respectively according to
It is secondary to get each group amplification assay as a result, the group number for the amplification assay result that above-mentioned got reaches certain value, then stop surveying
Examination, and above-mentioned each group amplification assay result is added to Summary file;
Step S33, for each Summary file of the S32 each library file of direction got, each group matched in each Summary file expands
Increase test result, is screened out from it each group amplification assay result and corresponds to identical Summary file and extract;
Step S34, it is directed to the Summary file that step S33 is filtered out, each library file of its direction is obtained, is matched according to the meaning of one's words
Metacode section in each library file is stated, the library file that semantic similarity after matching is greater than certain value is considered as repetition library file;
Step S35, for the terminal of preservation library file: being directed to the repetition library file that step S34 is got, retain allocating time
Minimum and attribute is the library file for not allowing to delete;Then in the case where terminal allows to carry out label addition by other library files
Label be added in retained library file, the address of retained library file is added to other library files, and delete it
It repeats the content in library file in addition to retained library file address, so that other library files that repeat contain only retained library file
Address;
Wherein, the above-mentioned other holding times for repeating library file and the Summary file for being directed toward it for containing only retained library file address
For persistence or temporary preservation;Wherein, when temporarily to save, the time temporarily saved is that library file is accessed regularly most
Long interval of time, more than after above-mentioned time interval, other library files that repeat will be deleted;In above-mentioned time interval, when logical
Cross be directed toward it is other repeat library files Summary files access it is other repeat library file when, will can only retrieve retained library file
Address, the library file address in the other Summary files for repeating library file of the direction is substituted for the ground of retained library file at this time
Location, to realize the update for the Summary file that other library files of the direction are directed toward;
Wherein, it is directed to retained library file, when the Summary file by being directed toward it accesses the library file, if learning the library
Label in file increases, then is added to the label increased in the Summary file for being directed toward it;
Wherein, in library file access process, if library file can not be accessed by the library file address in Summary file,
Search request is issued to terminal, terminal searches summary info other Summary files identical with the Summary file, finds and meet
Summary file after the library file address in the Summary file replaced with into the above-mentioned library text found in the Summary file met
Part address.
4. code library file generation method according to claim 1, which is characterized in that get each source code in step S1
Programming language mention environmental information detailed process is as follows:
Step S11, be directed to source code, retrieve the annotation of source code first, determine in whether there is or not record instruction and environmental informations
Character string, if so, then therefrom directly reading language and environmental information;If nothing enters step S12;
Step S12, it is read since source code starting, reads character string one by one;
Step S13, it is directed to the character string currently got, environment is searched and judges that each language/environment in library judges file, sentence
It is disconnected whether to there is language/environment to judge that file includes the character string;If so, entering step S14;If it is not, then entering step S15;
Step S14, judge to read language and environmental information in file from language/environment where the character string currently read,
And feed back the language and environmental information;Then judge whether meet following in all language and environmental information of current feedback
One condition and second condition, first condition: certain language message is fed back in all language and environmental information of current feedback
Number is more than y times, second condition, and the number that certain environmental information is fed back in all language and environmental information of current feedback surpasses
It crosses q times;
If being all satisfied first condition and second condition, the language of source code is judged as this kind of language message, by source code
Environment is judged as this kind of environmental information;
If only meeting first condition, and do not meet second condition, then the language of source code is determined as this kind of language message, and
The acquisition for terminating language source code information, subsequently into step S15;
If only meeting second condition, and it is to meet first condition, then the environment of source code is judged as this kind of environmental information, and
The acquisition for terminating source code environmental information, subsequently into step S15;
If first condition and second condition is not satisfied;Then enter step S15;
Step S15, whether the character string that judgement is currently read is source code last character string, if so, entering step
S17;If it is not, then entering step S16;
Step S16, the character late string in source code is read, as the character string currently read, subsequently into step
S13;
Step S17, all language and environmental information of obtaining step S14 feedback;When the language message of source code is not judged also
When out, then using by the most language message of Times of Feedback as the language message of source code;When source code environmental information also not
When being judged out, then using by the most environmental information of Times of Feedback as the environmental information of source code.
5. code library file generation method according to claim 1, which is characterized in that the step S3 is directed to each Yuan Dynasty
Code section carries out amplification to it and generates the method for test code using template additive process, scalping method or supplement method, in which:
The step of obtaining test code using template additive process is as follows:
Step 1. is according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;
Step 2: retrieval metacode section identifies the inlet/outlet and label of metacode section by keyword and lexical analysis;
Step 3: labeled sentence being split as character string, by the character string splitted out entering to the template of above-mentioned screening
Mouth/outlet keyword is matched, and the most template of occurrence is selected, and matching template is completed;
Metacode section is added to template elected, obtains test code, and be deposited into corresponding library file;
The step of obtaining test code using scalping method is as follows:
The metacode section that correspondence will generate test code is defined as object code section by the copy for firstly generating source code;In source
In the copy of code, by above-mentioned object code section sentence labeled as reservation sentence, and other metacode sections is deleted, deleted simultaneously
Except the sentence for calling other metacode sections;
Searched targets code segment call statement obtains input variable therein, is retained in object code by input variable name retrieval
Make the associated sentence of input variable in segment call sentence before calling main body function and define the sentence of input variable, is labeled as
Retain sentence, deletes remaining sentence comprising input variable name;Remaining unrelated sentence is deleted simultaneously;
It is deleted using side in the copy for becoming the method deletion source code of debug and is not labeled as the sentence retained, by what is finally obtained
Sentence is minimum and complete code is as test code, and is deposited into corresponding library file;
The step of obtaining test code using supplement method is as follows:
Step S3a, according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;
Step S3b, 1 is operated: according to the language and environmental information screen selecting formwork of metacode section parameter type and metacode section;Operation
2: retrieval metacode section identifies the inlet/outlet and label of metacode section by keyword and lexical analysis;Operation 3: will be by
The sentence of label is split as character string, by the character string splitted out to the inlet/outlet keyword of the template of above-mentioned screening into
Row matching, selects the most template of occurrence, and matching template is completed;
Step S3c, metacode section is added to the template that step S3b is selected, obtains test code;
Step S3d, the test code obtained using step S3c tests the test data of input, if test can not pass through;
Then execute following steps:
Step S3d1, the metacode section that correspondence will generate test code is defined as object code section by the copy for generating source code;
In the copy of source code, by above-mentioned object code section sentence labeled as reservation sentence, and other metacode sections are deleted, together
When delete call other metacode sections sentence;
Step S3d2, searched targets code segment call statement obtains input variable therein, is retrieved and is retained by input variable name
Make the associated sentence of input variable before calling main body function in object code segment call sentence and defines input variable
Sentence deletes remaining sentence comprising input variable name labeled as sentence is retained;Remaining unrelated sentence is deleted simultaneously;
Step S3d3, not retained sentence, being associated property analysis, by the language that is mutually related are directed in the copy of source code
Sentence, which is concluded, to be arrived together, as a partial code;
Step S3d4, it is directed to various pieces code obtained above, chooses one of partial code first, as working as front
Divide code;
Step S3d5, current portions code is added in the template that step S3b is filtered out, then metacode section is added on
It states in the template got, obtains test code;It is directed to above-mentioned test code, input test data are once tested, if
Test passes through, then enters step S3d6 if test does not pass through using above-mentioned test code as final test code;
Step S3d6, next partial code is chosen as current portions code, step S3d5 is then executed, until obtained survey
Examination code input test data can pass through after once testing, and will be deposited into above by the test code after test
In corresponding library file;
In the step S3, be directed to each metacode, when generating call statement, first determine whether wherein function call sentence whether
There is data correlation sentence;If so, the data correlation sentence is added before the function call sentence in metacode section first,
The sentence of entrance in Optimized code section to function call part is generated corresponding calling language by the entrance for then retrieving metacode section
Sentence;If it is not, then directly retrieving the entrance of metacode section, the sentence of entrance in metacode section to function call part is generated and is corresponded to
Call statement.
6. a kind of code search method, which is characterized in that steps are as follows:
Step X1, code library file generation method described in any one of claims 1 to 5 is obtained first to generate library file and refer to
To the Summary file of library file;
Step X2, after receiving the code segment searching request of user:
Step X21, the code segment input type that user needs is obtained, the input class of input type Yu the code segment is then filtered out
The identical Summary file of type;
Step X22, the code segment output type that user needs is obtained, is sieved again from the Summary file filtered out in step X21
Select output type Summary file identical with the output type of the code segment;
Step X23, test data list is generated according to the input type of user's input, is selected by the test data list for user
Fixed corresponding test data inputs corresponding output valve according to its selected test data by user;User is directed to select it
The each group output valve of fixed each group test data input, will be in the Summary file that filtered out in each group output valve and step X22
Each group output result is matched, and is screened out from it each group output result and user to its selected each group test data input
The identical Summary file of each group output valve;
Step X24, the first label that the needs that user selectes retain is obtained, the Summary file that step X23 is filtered out is directed to, it will
Label therein is compared with the first label, screens outgoing label and the identical Summary file of the first label again, obtains user
It is identical as the second label to screen outgoing label from the above-mentioned Summary file filtered out again for the second label that selected needs are deleted
Summary file, and deleted;
Step X25, the step X24 Summary file finally retained is recommended into user, for user get corresponding library file into
Row test and selection.
7. a kind of automatic connecting method of code, which is characterized in that steps are as follows:
Step Y1, it is selected for user that the generation of code library file generation method described in any one of claims 1 to 5 is obtained first
Library file and be directed toward library file Summary file;
Step Y2, customized user function name is obtained, the library file that user selectes is directed to, reads and is directed toward plucking for the library file
The function name of file is wanted, and is defined as library file function name;It extracts in the library file metacode in corresponding function definition
Hold and make following modification: function being defined into library file function name in content and replaces with user function name, it then will be after above-mentioned modification
Function define content be added to user input source code in;
Obtain customized user function name;It is directed to the library file that user selectes, reads the Summary file for being directed toward the library file
Function name, and be defined as library file function name;Header file is created simultaneously and is named with user function name, is then extracted
Corresponding function defines content and makes following modification in the library file metacode: function being defined library file function name in content and is replaced
It is changed to user function name, and above-mentioned modified function is defined into content and is added in newly-built header file, finally in user
The sentence of the header file is called in addition in the source code of input;
Step Y3 is directed to the library file that user selectes, and the calling language in the library file is obtained after user selects incoming variable
Above-mentioned call statement is added to user's specified function calling station in the source code of user's input by sentence, and by change therein
Amount is revised as the variable name that user is passed to.
8. a kind of code optimization method, which is characterized in that steps are as follows:
Step Z1, code library file generation method described in any one of claims 1 to 5 is obtained first to generate library file and refer to
To the Summary file of library file, it is defined as the first library file and the first Summary file;
It is directed to the source code fragment that user selectes, firstly generates second library file, while obtaining the entrance of the source code fragment
And outlet, from entrance and exit extract input output parameter type and function name, then by the source code fragment and its extract
Input output parameter type and function name be added to the second library file;
It is directed to the source code fragment that user selectes simultaneously, amplification is carried out to it and generates test code, and is stored to the second library text
In part, while test data list is generated, then each group test data in test code in input test data list, leads to
Corresponding each group output is obtained as a result, above-mentioned each group output result is added to the second library file after crossing the operation of test code;
Meanwhile amplification assay data are added in the second library file;
Step Z2, it is directed to the second library file of step Z1 generation, second Summary file for being directed toward it is generated, extracts second
The input stored in library file output parameter type, function name, each group output result and amplification assay data, and will be upper
The result for stating extraction is stored as clip Text into the second Summary file, while the address of the second library file being stored to second
In Summary file;
Step Z3, the direction got in the second Summary file and step Z1 of the second library file of direction that step Z2 is obtained is each
Each first Summary file of first library file is matched, and specific matching process is as follows:
Step Z31, the input type in the second Summary file is obtained, then selects input class from each first Summary file
Type the first Summary file identical with the input type in the second Summary file;
Step Z32, the output type in the second Summary file is obtained, from each first Summary file filtered out in step Z31
Output type the first Summary file identical with the output type in the second Summary file is filtered out again;
Step Z33, each group output in the second Summary file is obtained as a result, each first abstract text filtered out from step Z32
Each group output result identical first abstract text corresponding with each group output result in the second Summary file is filtered out in part again
Part;
Step Z34, it is directed to each first Summary file that step Z33 is filtered out, amplification assay data is added wherein, obtains simultaneously
Each first library file for taking it to be directed toward;It is directed in above-mentioned every one first library file got, inputs and refer in test code
Each group amplification assay data into its first Summary file, it is temporarily defeated by obtaining corresponding each group after test code operation
Out as a result, above-mentioned each group is temporarily exported first library text that result is added to according to the sequence of corresponding each group amplification assay data
It part and is directed toward in the first Summary file of first library file;
It is directed to the second library file simultaneously, calls test code therein, then inputs the second abstract respectively in test code
Each group amplification assay data in file are temporarily exported by obtaining corresponding each group after test code operation as a result, by above-mentioned
Each group temporarily exports in second library file and the first Summary file that result is added to;
Step Z35, it obtains each group in the first Summary file and temporarily exports each first abstract as a result, getting from step Z34
Each group is filtered out in file temporarily export result temporarily export result corresponding identical first with each group in the second Summary file
Summary file;
Step Z36, each first Summary file filtered out for step Z35, is arrived by the library file address search wherein stored
Each first library file gets the runing time that code is tested in above-mentioned each first library file;Then step Z35 is filtered out
The runing time that code is tested in each first Summary file and its each first library file being directed toward shows user, for user
It is selected, it finally will be in the first library file pointed by the library file address that stored in the first Summary file that user selects
Metacode section as Optimized code section, replace the source code fragment that user selectes with Optimized code section.
9. code optimization method according to claim 8, which is characterized in that in the step Z36, using Optimized code section
Replacing the code segment that user selectes, detailed process is as follows:
Step Z361, the first Summary file of the first library file where Optimized code section is directed toward in retrieval and the optimised code segment of direction
The second Summary file, read the function name in first Summary file and the second Summary file, respectively correspond and be defined as library text
Part function name and user function name;It extracts corresponding function in the first library file metacode and defines content and do and repair as follows
Change: library file function name function defined in content replaces with user function name;Then above-mentioned modified function is defined
Content is added in the source code of user's input;
Or retrieval be directed toward Optimized code section where the first library file the first Summary file and be directed toward the of optimised code segment
Two Summary files read the function name in first Summary file and the second Summary file, respectively correspond and be defined as library file letter
Several and user function name;It creates header file and is named with user function name, it is right in the first library file metacode to extract
The function answered defines content and makes following modification: function being defined the library file function name in content and replaces with user function name;
Then above-mentioned modified function is defined content to be added in newly-built header file, is finally added in the source code of user's input
Add the sentence for calling the header file;
Step Z362, the first library file where being directed to Optimized code section obtains first library after user selects incoming variable
Above-mentioned call statement is added to user's specified function calling station in the source code of user's input by the call statement in file,
And variable therein is revised as the variable name that user is passed to.
10. a kind of code auxiliary transplantation method, which is characterized in that steps are as follows:
Step B1, code library file generation method described in any one of claims 1 to 5 is obtained first to generate library file and refer to
To the Summary file of library file, it is defined as the first library file and the first Summary file;
In the source code transplanting request for receiving user, be divided into source code according to slice rule file has completely first
Each independent code section of function;It is directed to the above-mentioned each code segment transplant got, generates one respectively first
Third library file, and retrieve each code segment input output statement, extracted from inputoutput statement input output ginseng
Several classes of types and function name, the input for then arriving said extracted output parameter type, function name storage it is corresponding to each code segment
Third library file in;
Meanwhile it being directed to the above-mentioned each code segment transplant got, amplification is carried out to it generates test code, and
And multiple groups test data is generated, it is sorted by multiple groups test data and generates test data list, then inputted in test code segment
Each group test data in test data list, by obtaining corresponding each group output after test code operation as a result, by above-mentioned
Each group exports the third library file that result is added to according to the sequence of corresponding each group test data;
It is directed to the third library file of the above-mentioned each code segment got, the third Summary file for being directed toward it is generated, extracts
The input stored in third library file output parameter type, function name and each group output as a result, and by the knot of said extracted
Fruit stores as clip Text into third Summary file, while the address of third library file being stored to third Summary file
In;
Step B2, be directed to each third Summary file for each third library file of direction that step B1 obtains, by its in step B1
Each first Summary file of each first library file of direction got is matched, and specific matching process is as follows:
Step B21, the input type and output type in third Summary file are obtained, while obtaining the code to be transplanted to of user
Language and environmental information as appointed language and environmental information then filter out input type from each first Summary file
With output type with third Summary file, identical and language and environmental information are the first of above-mentioned appointed language and environmental information to pluck
Want file;
Step B22, each group output in third Summary file is obtained as a result, each first abstract text filtered out from step B21
Each group output result identical first abstract text corresponding with each group output result in third Summary file is filtered out in part again
Part;Needle is in above-mentioned each first Summary file filtered out, by the library file address search that wherein stores to each first library file,
Get the runing time that code is tested in above-mentioned each first library file;Then by above-mentioned each first Summary file filtered out with
And its runing time of test code shows user in each first library file being directed toward, so that user is each generation for needing to transplant
Selected corresponding first Summary file of code section;
Step B23, user is directed to finally to be selected the first Summary file by the code segment correspondence that needs are transplanted and need to transplant
Code segment third Summary file, read the function name in first Summary file and third Summary file, it is fixed to respectively correspond
Justice is library file function name and user function name;It is right in the first library file metacode pointed by first Summary file to extract
The function answered defines content and makes such as modification: function being defined to the library file function name in content and replaces with user function name;So
Above-mentioned modified function content is defined afterwards to be added in the source code of user's input;
Or being directed to user finally is to need the code segment the transplanted corresponding generation selected the first Summary file and need to transplant
The third Summary file of code section, reads the function name in first Summary file and third Summary file, respectively corresponds and be defined as
Library file function name and user function name;Create header file and with the name of user function name;Extract first Summary file
Corresponding function defines content and makes following modification in the first pointed library file metacode: function is defined to the library in content
Documentation function name replaces with user function name;Then above-mentioned modified function is defined into content and is added to newly-built header file
In, the sentence for calling the header file is finally added in the source code of user's input;
Step B24, being directed to user finally is that each source code fragment transplanted is needed to correspond to selected first Summary file institute
The first library file being directed toward obtains the call statement in first library file, by above-mentioned calling after user selects incoming variable
Sentence is added to user's specified function calling station in the source code of user's input, and variable therein is revised as user's biography
The variable name entered.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811285105.0A CN109344230B (en) | 2018-10-31 | 2018-10-31 | Code library file generation, code search, coupling, optimization and migration method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811285105.0A CN109344230B (en) | 2018-10-31 | 2018-10-31 | Code library file generation, code search, coupling, optimization and migration method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109344230A true CN109344230A (en) | 2019-02-15 |
CN109344230B CN109344230B (en) | 2023-08-11 |
Family
ID=65313175
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811285105.0A Active CN109344230B (en) | 2018-10-31 | 2018-10-31 | Code library file generation, code search, coupling, optimization and migration method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109344230B (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110083351A (en) * | 2019-04-22 | 2019-08-02 | 北京百度网讯科技有限公司 | Method and apparatus for generating code |
CN110196952A (en) * | 2019-05-30 | 2019-09-03 | 百度时代网络技术(北京)有限公司 | Search processing method, device, equipment and the storage medium of program code |
CN110221824A (en) * | 2019-06-03 | 2019-09-10 | 精硕科技(北京)股份有限公司 | The generation method and device of component |
CN111177313A (en) * | 2019-12-10 | 2020-05-19 | 同济大学 | Searching method for instantly inputting programming code and instantly searching reference multiplexing program |
CN111309853A (en) * | 2019-09-03 | 2020-06-19 | 东南大学 | Code searching method based on structured information |
CN111338616A (en) * | 2020-03-24 | 2020-06-26 | 北京自如信息科技有限公司 | Protocol analysis code generation method and device and electronic equipment |
CN112394936A (en) * | 2020-11-26 | 2021-02-23 | 中信银行股份有限公司 | Database operation instruction conversion method, device, equipment and storage medium |
CN113822014A (en) * | 2021-11-19 | 2021-12-21 | 北京明略昭辉科技有限公司 | Code material storage method and device, electronic equipment and storage medium |
CN114968351A (en) * | 2022-08-01 | 2022-08-30 | 北京大学 | Hierarchical multi-feature code homologous analysis method and system |
WO2022206295A1 (en) * | 2021-03-30 | 2022-10-06 | International Business Machines Corporation | Program context migration |
CN116185379A (en) * | 2022-11-17 | 2023-05-30 | 北京东方通科技股份有限公司 | Method for optimizing code hosting platform |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050223363A1 (en) * | 2004-03-31 | 2005-10-06 | International Business Machines Corporation | Evaluation of a code segment |
CN101826014A (en) * | 2010-04-20 | 2010-09-08 | 北京邮电大学 | Dividing method of source code in software engineering |
CN106919434A (en) * | 2017-03-22 | 2017-07-04 | 恒生电子股份有限公司 | A kind of code generating method and device |
-
2018
- 2018-10-31 CN CN201811285105.0A patent/CN109344230B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050223363A1 (en) * | 2004-03-31 | 2005-10-06 | International Business Machines Corporation | Evaluation of a code segment |
CN101826014A (en) * | 2010-04-20 | 2010-09-08 | 北京邮电大学 | Dividing method of source code in software engineering |
CN106919434A (en) * | 2017-03-22 | 2017-07-04 | 恒生电子股份有限公司 | A kind of code generating method and device |
Cited By (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110083351A (en) * | 2019-04-22 | 2019-08-02 | 北京百度网讯科技有限公司 | Method and apparatus for generating code |
CN110083351B (en) * | 2019-04-22 | 2023-06-27 | 北京百度网讯科技有限公司 | Method and device for generating code |
CN110196952A (en) * | 2019-05-30 | 2019-09-03 | 百度时代网络技术(北京)有限公司 | Search processing method, device, equipment and the storage medium of program code |
CN110196952B (en) * | 2019-05-30 | 2021-11-12 | 百度时代网络技术(北京)有限公司 | Program code search processing method, device, equipment and storage medium |
CN110221824B (en) * | 2019-06-03 | 2024-03-22 | 北京秒针人工智能科技有限公司 | Method and device for generating component |
CN110221824A (en) * | 2019-06-03 | 2019-09-10 | 精硕科技(北京)股份有限公司 | The generation method and device of component |
CN111309853A (en) * | 2019-09-03 | 2020-06-19 | 东南大学 | Code searching method based on structured information |
CN111309853B (en) * | 2019-09-03 | 2024-03-22 | 东南大学 | Code searching method based on structured information |
CN111177313A (en) * | 2019-12-10 | 2020-05-19 | 同济大学 | Searching method for instantly inputting programming code and instantly searching reference multiplexing program |
CN111338616A (en) * | 2020-03-24 | 2020-06-26 | 北京自如信息科技有限公司 | Protocol analysis code generation method and device and electronic equipment |
CN112394936A (en) * | 2020-11-26 | 2021-02-23 | 中信银行股份有限公司 | Database operation instruction conversion method, device, equipment and storage medium |
CN112394936B (en) * | 2020-11-26 | 2024-06-25 | 中信银行股份有限公司 | Database operation instruction conversion method, device, equipment and storage medium |
WO2022206295A1 (en) * | 2021-03-30 | 2022-10-06 | International Business Machines Corporation | Program context migration |
US12039365B2 (en) | 2021-03-30 | 2024-07-16 | International Business Machines Corporation | Program context migration |
CN113822014A (en) * | 2021-11-19 | 2021-12-21 | 北京明略昭辉科技有限公司 | Code material storage method and device, electronic equipment and storage medium |
CN114968351B (en) * | 2022-08-01 | 2022-10-21 | 北京大学 | Hierarchical multi-feature code homologous analysis method and system |
CN114968351A (en) * | 2022-08-01 | 2022-08-30 | 北京大学 | Hierarchical multi-feature code homologous analysis method and system |
CN116185379B (en) * | 2022-11-17 | 2023-09-22 | 北京东方通科技股份有限公司 | Method for optimizing code hosting platform |
CN116185379A (en) * | 2022-11-17 | 2023-05-30 | 北京东方通科技股份有限公司 | Method for optimizing code hosting platform |
Also Published As
Publication number | Publication date |
---|---|
CN109344230B (en) | 2023-08-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109344230A (en) | Code library file generation, code search, connection, optimization and transplantation method | |
CN107704265B (en) | Configurable rule generation method for service flow | |
CN107644323B (en) | Intelligent auditing system for business flow | |
US9519636B2 (en) | Deduction of analytic context based on text and semantic layer | |
US8447775B2 (en) | Database query user interface to assist in efficient and accurate query construction | |
CN100470480C (en) | Hardware accelerator personality compiler | |
US5440742A (en) | Two-neighborhood method for computing similarity between two groups of objects | |
US20050005239A1 (en) | System and method for automatic insertion of cross references in a document | |
US20040015481A1 (en) | Patent data mining | |
US11449564B2 (en) | System and method for searching based on text blocks and associated search operators | |
US20020100022A1 (en) | Method and apparatus for automatic verification of properties of a concurrent software system | |
US5764978A (en) | Database system having a hierarchical network database and a corresponding relational database | |
US20060129418A1 (en) | Method and apparatus for analyzing functionality and test paths of product line using a priority graph | |
US7853595B2 (en) | Method and apparatus for creating a tool for generating an index for a document | |
JP2005501321A (en) | How to automatically index documents | |
US20050234959A1 (en) | User interfaces for categorization schemes | |
CN109308258A (en) | Building method, device, computer equipment and the storage medium of test data | |
CN116541887B (en) | Data security protection method for big data platform | |
US6343292B1 (en) | System and method for providing text descriptions to electronic databases | |
CN107577476A (en) | A kind of Android system source code difference analysis method, server and medium based on Module Division | |
EP1574950A2 (en) | Structured task naming | |
CN116126918A (en) | Data generation method, information screening method, device and medium | |
CN114861229A (en) | Hive dynamic desensitization method and system | |
CN112783775A (en) | Special character input testing method and device | |
KR20050065015A (en) | System and method for checking program plagiarism |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |