Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a convention should be interpreted in accordance with the meaning of one of skill in the art having generally understood the convention (e.g., "a system having at least one of A, B and C" would include, but not be limited to, systems having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). The terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more features.
To facilitate an understanding of the embodiments of the present disclosure, a description is first given of some concepts to which the present disclosure relates.
The transmission control protocol (Transmission Control Protocol, TCP for short) is a connection-oriented, reliable, byte-stream based transport layer communication protocol. TCP is intended to accommodate a layered protocol hierarchy that supports multiple network applications.
The hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP for short), is a simple request-response protocol, which typically runs on top of TCP.
Java is an object-oriented programming language, not only absorbs various advantages of the C++ language, but also abandons concepts such as multi-inheritance and pointers which are difficult to understand by the C++ force, so that the Java language has two characteristics of powerful functions, simplicity and easiness in use. Java has the characteristics of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multithreading, dynamics and the like.
JavaScript, abbreviated as JS, is a lightweight, interpreted or just-in-time compiled programming language with function priority.
Extensible markup language (Extensible Markup Language, XML for short) is a subset of the standard generic markup language used to mark electronic files as structured markup language.
The JS object numbered musical notation (JavaScript Object Notation, JSON for short) is a lightweight data exchange format. It stores and represents data in a text format that is completely independent of the programming language.
The Representational STATE TRANSFER, abbreviated as RESTFUL, is a design style and development mode of a network application program, and can be defined by using XML format or JSON format based on HTTP.
An application program interface (Application Programming Interface, abbreviated as API) is a predefined interface (e.g., function, HTTP interface) or a convention that refers to the engagement of different components of a software system.
The front end is separated from the back end, and the front end can refer to a web server and is responsible for returning user page information. The backend may refer to an application server, responsible for handling business logic. The front-end and back-end separate hypertext markup language (Hyper Text Markup Language, abbreviated HTML) pages, which may refer to the front-end, call the back-end's restul API interface through asynchronous JavaScript and XML (Asynchronous JavaScript And XML And HTML, abbreviated AJAX) and interact using JSON data.
JSP is known as Java SERVER PAGES, which is a dynamic web page development technology that uses JSP tags to insert Java code in HTML web pages. Is a technology with front and back ends not separated, and has no distinction between the front and back ends.
Spring is an open-source lightweight Java back-end development framework and has the two core characteristics of control inversion and section-oriented. The method is mainly used for back-end service development.
Some companies are now running programs written using JSP technology on a production environment. These procedures are basically old in technology, the ideas fall behind, and maintenance is difficult. However, if the program written based on the JSP technology is reconstructed by using the new technology, the method is time-consuming and labor-consuming and has high cost. For example, the JSP technology development system is basically incompatible with the existing development system with front-end and back-end separation, and the transplantation cost is high. In the related art, JSP codes can be reconstructed into spring codes through manual reconstruction by manpower, so that operators are required to meet the requirements of both JSP technology and spring technology, and high requirements are put on programming literacy of the operators. For example, an operator needs to analyze the code of the JSP system before performing manual reconstruction. Such a method requires a lot of labor cost, and is prone to cause program defects (bugs) during the reconstruction process, resulting in economic loss.
In the related art, the mainstream code conversion method mainly relies on manual operation to reconstruct JSP code to spring code, and the drawbacks include the following.
For example, the automation degree is low, and code reconstruction can only be carried out by manpower, which is time-consuming and labor-consuming. The knowledge of the service needs to be known, and the reconstruction efficiency is low.
For example, the operator is required to be skilled in JSP and front-end and back-end separation technology to reconstruct, and the requirement on the operator is high.
For example, there is a problem in that a human operation may cause problems due to subjective cognition of a person, and the problems also need to be solved by consuming manpower.
In summary, many companies do not have the incentive to reconstruct JSP code.
To at least partially ameliorate the above pain, embodiments of the present disclosure provide a method, apparatus, and electronic device for transcoding. The method for transcoding comprises a file acquisition process and a code reconstruction process. In the file acquisition process, a first extensible markup language file and a Java file are acquired. After the file acquisition process is completed, a code reconstruction process is carried out, the structured query language code is reconstructed through an extensible markup language analysis method, java codes in Java files are reconstructed through a template generation method, and a folder of a second program is obtained, wherein the folder of the second program comprises the reconstructed structured query language code and the reconstructed Java codes.
The method, the device and the electronic equipment for converting codes effectively improve the defect of complicated and difficult reconstruction of JSP codes, provide a technical scheme which is efficient, convenient and capable of automatically reconstructing the JSP codes into spring codes, effectively improve the reconstruction efficiency and rapidly convert simple and clear JSP codes into spring codes.
The method, the device and the electronic equipment for converting codes provided by the embodiment of the disclosure can be used in the field of the internet of things in the related aspect of converting codes, and can also be used in various fields except the field of the internet of things, such as the financial field, and the application fields of the method, the device and the electronic equipment for converting codes provided by the embodiment of the disclosure are not limited.
Fig. 1 schematically illustrates an exemplary system architecture of a method, apparatus and electronic device in which transcoding may be applied according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
As shown in fig. 1, a system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 may include a number of gateways, routers, hubs, network cables, etc. to provide a medium for communication links between the end devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user can interact with other terminal devices and the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or transmit information or the like, such as receiving Java files, transmitting codes or the like. The terminal devices 101, 102, 103 may be installed with various communication client applications. For example, web browser applications, drawing class applications, software development class applications, banking class applications, government class applications, monitoring class applications, search class applications, office class applications, instant messaging tools, mailbox clients, social platform software, and the like (just examples). For example, the user may perform transcoding using the terminal device 101 or send a transcoding instruction or the like to the server side.
Terminal devices 101, 102, 103 include, but are not limited to, smartphones, virtual reality devices, augmented reality devices, tablet computers, laptop computers, desktop computers, and the like that are capable of using a web browser or client.
The server 105 may receive the request and process the request, and may specifically be a storage server, a background management server, a server cluster, and the like. For example, server 105 may store programs developed based on JSP technology. For example, the server 105 may be used to run a transcoded program or the like.
It should be noted that, the method for generating a message provided by the embodiments of the present disclosure may be generally performed by the terminal devices 101, 102, 103 or the server 105. Accordingly, the apparatus for generating a message provided in the embodiments of the present disclosure may be generally disposed in the terminal device 101, 102, 103 or the server 105. The method of generating a message provided by the embodiments of the present disclosure may also be performed by a server or a cluster of servers that are different from the server 105 and that are capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks and servers is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 schematically illustrates a flow chart of a method of transcoding according to an embodiment of the present disclosure. The method for converting codes is used for converting codes supported by a first program into codes supported by a second program, wherein the first program comprises a first extensible markup language file and a Java file, and the first extensible markup language file comprises a structured query language code.
As shown in FIG. 2, the method for transcoding may include operations S210-S220.
In operation S210, a first extensible markup language file and a Java file are acquired.
In this embodiment, a Java folder and a first extensible markup language file including a structured query language (Structured Query Language, abbreviated as SQL) statement may be obtained from a program installed in an electronic device. Two types of folders, namely 1, XML folders containing SQL sentences, can be included in programs developed based on the JSP technology. 2. Java folders.
The programs developed based on the spring technology can comprise a plurality of types of folders 1 and a program interface folder (such as a controller folder) for storing program interfaces. 2. A service type folder (e.g., a service folder) for storing service-related codes. 3. A data access Object (DATA ACCESS Object, DAO) type folder (e.g., DAO folder, each XML file in which an XML file generates a Java file). 4. An extensible markup language type folder (e.g., an XML folder) for storing SQL statements.
In operation S220, the structured query language code is reconstructed by the extensible markup language parsing method, and Java codes in the Java file are reconstructed by the template generating method, so as to obtain a folder of the second program, where the folder of the second program includes the reconstructed structured query language code and the reconstructed Java codes.
Specifically, the embodiment includes two types of operations, on one hand, parsing and reconstructing the SQL, and on the other hand, parsing and reconstructing the Java. The program developed based on the JSP technology can be reconstructed into the spring program by combining two types of operations. It should be noted that, during the conversion process, a small amount of manual processing may be required to operate.
Aiming at the characteristics of the JSP codes, the JSP codes are divided into two types of XML files and Java files in the embodiment, wherein the SQL codes are reconstructed by using an XML parsing method and the Java codes are reconstructed by using a template generating method. By the method, spring code engineering can be quickly constructed, a large amount of workload is saved, and various problems possibly caused by manual reconstruction are reduced.
In some embodiments, the first extensible markup language file includes business statements and template statements, the business statements and template statements capable of generating structured query language code.
Fig. 3 schematically illustrates a flow chart of a method of reconstructing structured query language code, according to an embodiment of the disclosure.
As shown in fig. 3, reconstructing the structured query language code by the extensible markup language parsing method may include operations S301 to S302.
In operation S301, the business statement and the template statement are parsed using the extensible markup language file parser, respectively, to obtain a parsed result. For example, the extensible markup language file parser may be a Dom4j, dom, etc. parser. The Dom4j is a Java XML application interface (API), which is a jdom upgrade for reading and writing XML files.
In operation S302, a second extensible markup language file for the parsing result is generated according to the persistence format requirement, and a Java file corresponding to the second extensible markup language file is generated under the data access object folder.
For example, the persistent format requirement may be a format requirement of MyBatis, or the like. MyBatis is a persistent layer framework that supports custom SQL, stored procedures, and high-level mapping. MyBatis avoids nearly all Java database connection (Java Database Connectivity, JDBC) codes and manual set parameters and get result sets. MyBatis can use simple XML or annotations to configure and map native information, mapping the interface and generic Java objects of Java (Plan Ordinary Java Object, POJOs for short) to records in the database.
In some embodiments, the above-described process may be implemented by an SQL parse-reconstruct module. For example, the SQL parsing reconstruction module uses Dom4j (an XML parsing and generation tool) as a specific implementation method based on XML parsing technology. Rewriting an XML file of the JSP into an XML file readable by mybatis (a persistence tool), and putting the XML file into an XML folder; and simultaneously generating a Java file in a corresponding dao folder, which is used for matching with the XML file of mybatis.
Specifically, the SQL parsing reconstruction module first traverses all XML files in a program developed based on JSP technology. XML files in programs developed based on JSP technology are mainly divided into business sentences and template sentences, and the business sentences and the template sentences are combined to generate readable SQL sentences. And respectively analyzing the business statement and the template statement by using the Dom4j, and performing formatting storage. And then regenerating the XML file according to the format required by mybatis, and generating Java files under the corresponding dao folder while generating the XML file.
Fig. 4 schematically illustrates a block diagram of an XML parser in accordance with an embodiment of the present disclosure.
As shown in FIG. 4, the XML parser may include a DOM class, a SAX class, and a JAXP class. The DOM class may be parsed by a DOM4j parser or a DOM parser. The SAX class may be parsed using a SAX parser. In addition, JAXP classes can also be parsed using a DOM parser and a SAX parser.
Dom4j is an open source XML parsing package, which is a readily available, open source library for XML, XPath, and XSLT. It applies to the Java platform, adopts the Java set framework and fully supports DOM, SAX and JAXP.
The Dom4j implements its functionality based primarily on the XML-Dom model. The main interfaces of Dom4j are all defined in the package org.dom4j. For example, attribute Attribute defines attributes of XML. Branch Branch is a node such as an XML Element (Element) and document that can contain child nodes.
In some embodiments, the business statement and the template statement are parsed using an extensible markup language file parser, respectively, to obtain a parsing result comprising the following operations.
The method comprises the steps of firstly traversing and analyzing template sentences according to files, wherein the template sentences are sentences obtained by analyzing a first extensible markup language file, traversing and analyzing business sentences according to files, and storing the template sentences and the business sentences in a mapping set in an associated mode.
And then, the service statement and the template statement are jointly analyzed to obtain a reconstructed structured query language code.
The XML parsing using Dom4j is exemplified below.
With respect to parsing an XML document.
The reading and writing of XML documents mainly depends on org.Dom4j.io package, wherein two different modes of DOMReader and SAXReader are provided, and the calling modes are all called by means of interfaces.
Reading XML from file, inputting file name, returning XML document
public Document read(String fileName)throws MalformedURLException,DocumentException{
SAXReader reader=new SAXReader();
Document document=reader.read(new File(fileName));
return document;
}
The read method of the reader is reloaded, and can be read from InputStream, file, url and other different sources. The resulting Document object represents the entire XML.
The character codes read are converted according to the codes defined by the XML file header. If a scrambling problem is encountered, the code names of all places need to be kept consistent.
The next step after reading is to obtain the Root node.
public Element getRootElement(Document doc){
return doc.getRootElement();
}
Next, the XML tree is traversed.
Specifically, the nodes of the XML tree may be traversed by any one of enumeration, recursion, and guests.
For example, 1. Enumeration (Iterator).
All child nodes are enumerated/enumerated
for(Iterator i=root.elementIterator();i.hasNext();){
Element element=(Element)i.next();
//do something
}
Node with the name foo
for(Iterator i=root.elementIterator(foo);i.hasNext();){
Element foo=(Element)i.next();
//do something
}
The// enumeration properties
for(Iterator i=root.attributeIterator();i.hasNext();){
Attribute attribute=(Attribute)i.next();
//do something
}
E.g., 2. Recursion.
Recursion may also employ Iterator as an enumeration means, but additional practices are provided in the document
public void treeWalk(){
treeWalk(getRootElement());
}
public void treeWalk(Element element){
for(int i=0,size=element.nodeCount();i<size;i++){
Node node=element.node(i);
if(node instanceof Element){
treeWalk((Element)node);
}else{//do something....
}
}
}
For example, a monitor mode.
The support of the DOM4J to Visitor can greatly reduce the code amount, and only one class needs to be self-defined to realize the Visitor interface.
public class MyVisitor extends VisitorSupport{
public void visit(Element element){
System.out.println(element.getName());
}
public void visit(Attribute attr){
System.out.println(attr.getName());
}
}
Concerning the call, root.
The Visitor interface provides a variety of reloads of Visit () that will be accessed in different ways depending on the objects in the XML. This Visitor is an automatic traversal of all child nodes. If root, accept (MyVisitor), the child node will be traversed.
With respect to the conversion of strings with XML.
Sometimes conversion of strings into XML or vice versa is often used.
Xml conversion character string
Document document=...;
String text=document.asXML();
String conversion of/character XML
String text=<name>James</name></person>;
Document document=DocumentHelper.parseText(text);
For example, transforming XML with XSLT
public Document styleDocument(
Document document,
String stylesheet
)throws Exception{
//load the transformer using JAXP
TransformerFactory factory=TransformerFactory.newInstance();
Transformer transformer=factory.newTransformer(
new StreamSource(stylesheet)
);
//now lets style the given document
DocumentSource source=new DocumentSource(document);
DocumentResult result=new DocumentResult();
transformer.transform(source,result);
//return the transformed document
Document transformedDoc=result.getDocument();
return transformedDoc;
}
With respect to creating XML.
Creating XML may be a work before writing a file.
public Document createDocument(){
Document document=DocumentHelper.createDocument();
Element root=document.addElement("root");
Element author1=
root
.addElement(author)
.addAttribute(name,James)
.addAttribute(location,UK)
.addText(James Strachan);
Element author2=
root
.addElement(author)
.addAttribute(name,Bob)
.addAttribute(location,US)
.addText(Bob McWhirter);
return document;
}
In some embodiments, generating a second extensible markup language file for the parsing result according to the persistence requirement format includes storing the reconstructed structured query language code as a second extensible markup language file that meets the persistence format requirement. For example, XML files stored as mybatis readable
In some embodiments, generating Java files corresponding to the second eXtensible markup language files under the data access object folder includes generating Java files corresponding to the second eXtensible markup language files meeting the requirements of the persistence format under the data access object folder for each of the second eXtensible markup language files meeting the requirements of the persistence format.
In one particular embodiment, reconstructing the structured query language code is accomplished by the following operations.
First, the XML template statement in the JSP program is parsed by using the Dom4j according to the file traversal, and is stored in a map.
Then, XML business statements in the JSP program are parsed by file traversal.
Then, the XML business statement is combined with the XML template statement in the first operation to be resolved in a joint way.
And then, storing the SQL sentence analyzed in the step 2 as an XML file readable by mybatis by using the Dom4 j.
Then, each time an XML file is generated, a corresponding Java file is generated under the dao folder.
In some embodiments, reconstructing Java code in a Java file by a template generation method may include parsing the Java code to generate Java files in a service folder and generating Java files corresponding to Java files in a service folder in a program interface folder.
Specifically, code generation based on a template method can be realized through a Java parsing reconstruction module. For example, FREEMARKER (a template code generation method) is used for Java code generation. Similar to the SQL parsing method, the template method is used for parsing Java codes, and the Java codes are parsed to generate Java files in a service folder, and simultaneously a Java file is correspondingly generated in a controller folder.
Fig. 5 schematically illustrates a flowchart of a method of generating Java files in a service folder according to an embodiment of the present disclosure.
As shown in fig. 5, parsing the Java code to generate the Java file in the service folder may include operations S501 to S503.
In operation S501, java files in the first program are parsed per file traversal.
In operation S502, a calling method of a structured query language code in a Java file in a first program is converted into a method corresponding to the calling method of the structured query language code under a data access object folder.
In operation S503, java files in the service folder are generated based on a method corresponding to the calling method of the structured query language code.
For example, generating Java files in the program interface folder that correspond to Java files in the service folder includes generating Java files in the program interface file that correspond to Java files in the service folder after generating at least one Java file in the service folder.
In some embodiments, the method may further include modifying the Java files in the service folder in response to a user operation after generating the Java files in the service folder. Thus, the adjustment requirements of some complex scenes can be met, and the like.
Fig. 6 schematically illustrates a block diagram FREEMARKER according to an embodiment of the present disclosure.
As shown in FIG. 6, FREEMARKER is a generic tool that is based on the template and the data that needs to be changed and is used to generate output text (HTML web page, email, configuration file, source code, etc.). It is not end-user oriented, but rather a Java class library, a component that can embed programs they develop.
Templates written as FREEMARKER TEMPLATE Language (FTL) are simple, proprietary languages. This means that the data is to be prepared for display in the real programming language, such as database queries and business operations, after which the templates display the data already prepared.
This mode is commonly referred to as the MVC (model view controller) mode, which is a mature mode for dynamic web pages.
The working principle thereof can be as follows.
Assume that an HTML page is required in an application as follows:
The user name in the page (i.e., "XXBC" above) is the name of the visitor logging into this page and the data should come from the database to be updated at any time. "XXBC", "greenmXXX" and links cannot be entered directly in the HTML page, and static HTML code cannot be used. The template may be solved using a template that requires output, the template and the static page being identical, the template may contain some instructions FREEMARKER to turn it into dynamic content. Such as:
The template file is stored on a network (Web) server, and FREEMARKER is involved in executing when someone accesses the page, then the template is dynamically converted, the parts of the template are replaced with the latest data content, $. The visitor's Web browser receives content such as the first HTML instance (i.e., HTML code without FREEMARKER instructions), nor does the visitor perceive FREEMARKER for use at the server side. It should be noted that the template file stored in the Web server side is not modified. Substitutions also occur only in the response of the Web server.
The entirety of the data prepared for the template is referred to as a data model. The data model is a tree structure (e.g., folders and files in a tree topology).
For example, these values may be selected from the data model, using the user and latestproduct. In analogy to a tree structure, the data model is like a file system, "(root)" and latestProduct correspond to directories (folders), and user, url and name are files in these directories.
In general, as shown in fig. 6, the template and data model are components necessary for FREEMARKER to generate an output, template+data model=output.
In one particular embodiment, reconstructing Java code may include the operations shown below.
First, java files in a JSP program are parsed per file traversal.
Then, the SQL calling method in the Java file analyzed in the previous operation is changed into a corresponding method under the dao folder.
Then, FREEMARKER is used to generate the content analyzed in the previous operation into Java files under the service folder, and if special cases are available, customization improvement can be performed.
Then, each time a Java file under a service folder is generated, a Java file under a controller folder is correspondingly generated.
Through the combined application of the XML analysis method and the template generation method, the basic reconstruction from the JSP program to the spring program can be completed, and then the reconstruction work can be completed under manual adjustment.
According to the method, the device and the electronic equipment for converting codes, which are provided by the embodiment of the disclosure, aiming at the problems of high cost, easy error and the like of manually converting codes, an XML parsing method and a template method are introduced to reconstruct XML files and Java files, so that operators can get rid of a large amount of repeated time-consuming work, labor is saved, efficiency is improved, and meanwhile the occurrence probability of problems is reduced. Saving a lot of cost for enterprises.
For example, by designing a whole set of JSP reconstruction flow, the situation of reconstruction of different JSP items can be multiplexed and rapidly solved.
For example, the XML parsing method and the template method are used for reconstructing XML files and Java files, so that the working efficiency is greatly improved, and the reconstruction cost is reduced.
For example, the customized reconstruction can be performed aiming at special files, the mechanism is flexible, and the reconstruction work is convenient to develop.
Another aspect of the present disclosure provides an apparatus for transcoding. The apparatus is for converting code supported by a first program into code supported by a second program, wherein the first program comprises a first extensible markup language file and a Java file, and the first extensible markup language file comprises structured query language code.
Fig. 7 schematically illustrates a block diagram of an apparatus for transcoding according to an embodiment of the present disclosure.
As shown in fig. 7, the apparatus 700 for transcoding may include a file acquisition module 710 and a code reconstruction module 720.
The file acquisition module 710 is configured to acquire a first extensible markup language file and a Java file.
The code reconstruction module 720 is configured to reconstruct the structured query language code by using an extensible markup language parsing method, and reconstruct the Java code in the Java file by using a template generating method, so as to obtain a folder of the second program, where the folder of the second program includes the reconstructed structured query language code and the reconstructed Java code.
It should be noted that, the implementation manner, the solved technical problems, the realized functions and the obtained technical effects of each module/unit and the like in the apparatus portion embodiment are the same as or similar to the implementation manner, the solved technical problems, the realized functions and the obtained technical effects of each corresponding step in the method portion embodiment, and are not described in detail herein.
Any number of the modules, units, or at least some of the functionality of any number of the modules, units, or units according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, units according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules, units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware in any other reasonable manner of integrating or packaging the circuits, or in any one of or in any suitable combination of three of software, hardware, and firmware. Or one or more of the modules, units according to embodiments of the present disclosure may be at least partially implemented as computer program modules which, when executed, may perform the corresponding functions.
For example, any of the file acquisition module 710 and the code reconstruction module 720 may be combined in one module to be implemented, or any of the modules may be split into a plurality of modules. Or at least some of the functionality of one or more of the modules may be combined with, and implemented in, at least some of the functionality of other modules. According to embodiments of the present disclosure, at least one of the file acquisition module 710 and the code reconstruction module 720 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware, such as any other reasonable way of integrating or packaging the circuitry, or in any one of or a suitable combination of three of software, hardware, and firmware. Or at least one of the file acquisition module 710 and the code reconstruction module 720 may be at least partially implemented as computer program modules which, when executed, perform the corresponding functions.
Another aspect of the present disclosure also provides an electronic device.
Fig. 8 schematically illustrates a block diagram of an electronic device according to an embodiment of the disclosure. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, an electronic device 800 according to an embodiment of the present disclosure includes a processor 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. The processor 801 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. The processor 801 may also include on-board memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the disclosure.
In the RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, ROM 802, and RAM 803 are communicatively connected to each other via a bus 804. The processor 801 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 802 and/or the RAM 803. Note that the program may be stored in one or more memories other than the ROM 802 and the RAM 803. The processor 801 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in one or more memories.
According to an embodiment of the present disclosure, the electronic device 800 may also include an input/output (I/O) interface 805, the input/output (I/O) interface 805 also being connected to the bus 804. The electronic device 800 may also include one or more of an input portion 806 including a keyboard, mouse, etc., an output portion 807 including a display such as a Cathode Ray Tube (CRT), liquid Crystal Display (LCD), etc., and speakers, etc., a storage portion 808 including a hard disk, etc., and a communication portion 809 including a network interface card such as a LAN card, modem, etc., connected to the I/O interface 805. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
According to embodiments of the present disclosure, the method flow according to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 801. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
The present disclosure also provides a computer-readable storage medium that may be included in the apparatus/device/system described in the above embodiments, or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 802 and/or RAM 803 and/or one or more memories other than ROM 802 and RAM 803 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program comprising program code for performing the methods provided by the embodiments of the present disclosure, the program code for causing an electronic device to implement the image model training method or the image processing method provided by the embodiments of the present disclosure when the computer program product is run on the electronic device.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 801. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed, and downloaded and installed in the form of a signal on a network medium, and/or from a removable medium 811 via a communication portion 809. The computer program may comprise program code that is transmitted using any appropriate network medium, including but not limited to wireless, wireline, etc., or any suitable combination of the preceding.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be combined in various combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. These examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.