CN111984233A - Class flattening method in AltaRica model - Google Patents

Class flattening method in AltaRica model Download PDF

Info

Publication number
CN111984233A
CN111984233A CN202010766061.4A CN202010766061A CN111984233A CN 111984233 A CN111984233 A CN 111984233A CN 202010766061 A CN202010766061 A CN 202010766061A CN 111984233 A CN111984233 A CN 111984233A
Authority
CN
China
Prior art keywords
class
information
classinfo
classes
flattening
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
Application number
CN202010766061.4A
Other languages
Chinese (zh)
Other versions
CN111984233B (en
Inventor
胡军
祁健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Aeronautics and Astronautics
Original Assignee
Nanjing University of Aeronautics and Astronautics
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University of Aeronautics and Astronautics filed Critical Nanjing University of Aeronautics and Astronautics
Priority to CN202010766061.4A priority Critical patent/CN111984233B/en
Publication of CN111984233A publication Critical patent/CN111984233A/en
Application granted granted Critical
Publication of CN111984233B publication Critical patent/CN111984233B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/52Binary to binary

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a flattening method of classes in an AltaRica model, which comprises the following steps: writing an ANTLR grammar file of AltaRica 3.0, generating a lexical analyzer and a grammar analyzer based on an ANTLR 4 tool, and acquiring an abstract syntax tree; designing a data structure for storing class information, wherein the data structure comprises a data structure ClassInfo for storing key information and a data structure ClassCompleteInfo for storing complete information; traversing the abstract syntax tree, and storing the key node information of all classes in the syntax tree into Map < String, ClassInfo >; flattening all ClassInfo in Map < String, ClassInfo >; and (3) the information of all ClassInfo in the Map < String, ClassInfo > is integrated, and the integrated information is stored in the Map < String, ClassCompleteInfo >. The method can realize the syntactic analysis of the input model file by means of an ANTLR tool, acquire the information of all classes by traversing the syntactic analysis tree and store the information into a custom data structure, and finally realize the flattening operation of all classes by operating the data structure, thereby successfully realizing the flattening method of the classes in the AltRIca 3.0 model.

Description

Class flattening method in AltaRica model
Technical Field
The invention relates to the technical field of software model conversion, in particular to a flattening method for classes in an AltaRica model.
Background
Antlr (acoustic Tool for Language recognition) is an open-source parser creation Tool that can automatically create a lexical parser and a parser from a user-defined grammar file and process an input text into a parse tree. ANTLR is used to read, process, execute and translate structured text or binary files, and is widely used in academic fields and industrial production practices, and systems of companies such as Twitter, Oracle, NetBeans, etc. all use ANTLR to process parsing problems. ALTLR 4 is the latest version of the ANTLR tool, and compared to ANTLR 3, the biggest feature of ANTLR 4 is the ability to automatically generate a tree and tree walker, which allows access to nodes in the tree to execute custom business logic code. The main analysis process of ANTLR is as follows: lexical analysis, syntactic analysis, abstract Syntax analysis tree ast (abstract Syntax tree) analysis. Based on the self-defined grammar file, through the processes, the text which accords with the grammar specification can be identified and processed, and the original language text is converted into the text of the target language according to the conversion rule.
AltaRica is a high-level modeling language dedicated to security analysis, with strict grammatical and semantic definitions. The first version of this language, created in the computer science laboratories of the university of boldo at the end of the last 90 s, made it possible to build basic concepts, but for industrial scale models the resource consumption was too great. A second version of AltaRica Data-Flow was created at the Luminy math institute. Around this version, researchers developed many model evaluation tools, such as fault tree compilers, markov chain compilers, key event sequence generators, and so forth. Altariica Data-Flow has become the core of many industrial integrated modeling and simulation environments, such as Cecilia OCAS (Daxon aviation), Simfia and Safety Designer, to date. AltaRica 3.0 is the latest version of this Language, and is composed of a System architecture Modeling Language S2ML (System architecture Modeling Language) and a guard transformation System GTS (guarded transformation System). S2ML is a model language for describing AltaRica 3.0 hierarchical structure, GTS is a basic mathematical model for carrying out safety analysis on AltaRica 3.0, and a key step for carrying out system safety analysis is to convert the S2ML model into a semantically equivalent GTS model. The conversion process from S2ML to GTS is called flattening, and comprises three steps of flattening of a hierarchical structure, synchronously flattening and hiding. Wherein the flattening of the hierarchical structure comprises flattening of classes and flattening of blocks.
In AltaRica 3.0, the class is a very important component and is used for representing reusable components, so that it is very important to design an effective flattening method for the class, especially for the flattening method of the class in the conversion algorithm from the S2ML model of AltRIca 3.0 to the GTS model. The existing flattening method of the class has the following defects: firstly, the definition of the designed ANTLR grammar file of AltaRica 3.0 is not fine enough, and a part of input model files can not be analyzed correctly; secondly, the conventional method needs to repeatedly traverse the syntax tree of the class to acquire required information in the flattening process of the class, and the time and space complexity is high. Therefore, the invention optimally designs and realizes the flattening method of the class in the AltaRica 3.0 model aiming at the defects.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a class flattening method in an AltaRica model, which realizes syntactic analysis of an input model file by an ANTLR tool, acquires information of all classes by traversing a syntactic analysis tree and stores the information into a self-defined data structure, and finally realizes flattening operation of all classes by operating the data structure, thereby successfully realizing the class flattening method in the conversion method from the S2ML model of AltRIca 3.0 to the GTS model.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method of flattening classes in an AltaRica model, the flattening method comprising the steps of:
s1, writing an AntLR grammar file of AltaRica 3.0, generating a lexical analyzer and a grammar analyzer based on an ANTLR 4 tool, and acquiring an abstract syntax tree;
s2, designing data structure for storing class information, including ClassInfo for storing key information and ClassCompleteInfo for storing complete information;
s3, traversing the abstract syntax tree, and storing the key node information of all classes in the syntax tree into Map < String, ClassInfo >;
s4, flattening all ClassInfo in Map < String, ClassInfo >;
s5, the information of all ClassInfo in Map < String, ClassInfo > is integrated, and the integrated information is saved in Map < String, ClassCompleteInfo >.
In order to optimize the technical scheme, the specific measures adopted further comprise:
further, in step S1, the writing an antalr grammar file for AltaRica 3.0 further includes:
and optimizing and adjusting the written ANTLR grammar file by adopting a specific example.
Further, in step S2, the data structure classfnfo is used to store key node information in the syntax tree, and the data structure classfleteinfo supplements other information including symbol information on the basis of the data structure classfnfo, and combines some of the node information to encapsulate into a complete statement.
Further, in step S3, the process of traversing the abstract syntax tree and saving the key node information of all classes in the syntax tree to Map < String, ClassInfo > includes the following steps:
s31, storing all class names into ArrayList;
s32, pre-traversing the syntax analysis trees of all classes, judging whether the type of the declaration element exists in the ArrayList when traversing the declaration element, if so, taking the declaration element as an object, otherwise, taking the declaration element as a common variable;
s33, traversing the syntax analysis tree, obtaining all key node information in each class, and storing the key node information in the data structure Map < String, ClassInfo >, wherein String stores the class name, and ClassInfo stores all the information of the class corresponding to the class name.
Further, in step S4, the process of flattening all ClassInfo in Map < String, ClassInfo > includes the following steps:
flattening operation is carried out on the class according to the type of each component element contained in the class, and flattened information is still stored in a data structure Map < String, ClassInfo >:
(1) for the extension class, copying all the parent class information of each class into the subclasses;
(2) for other nested class instances in the class, adding instance names with dotted suffixes in front of all named objects in the copies of the class corresponding to the class instances, and then copying the copy information into the class;
(3) atomic elements in the declaration elements, and translations and assertions are copied directly into classes.
Further, let CflatIs a flattened form of class C, from C to CflatObtained by the following steps:
s41, serializing the object;
s42, calling a depeCopt () method to realize the copy of the simple variable declaration, the event declaration, the parameter declaration and the observer declaration in the class C, and the conversion and assertion of the class C;
s43, flattening the extension class:
and S431, preprocessing: c is to beflatThe list of the parent classes is empty, and the number of the parent classes is 0;
s432, if the number of the parents of the class C is more than 0, flattening all the extension classes in the class C, including:
calling a method getSuperclassList () of the class C to obtain a superclassList of the class C;
traverse superclassList: firstly, acquiring class information according to a currently traversed parent class name and storing the class information into a super class; merging parent class information into CflatPerforming the following steps; when the traversal of the superclassList is completed, the flattening of all the extension classes in the class C is completed;
s44, flattening the nested examples of other classes:
s441, preprocessing: c is to beflatThe mapping of the class instances is empty, and the number of the class instances is 0;
s442, if the number of the objects in the class C is larger than 0, flattening all the class instances in the class C:
s4421, calling a class C method getClassInstantEncap () to obtain a class instance mapping classInstantEncap, wherein all instances corresponding to all classes nested in the class C are stored;
s4422, traversing classInstanceMap:
a. acquiring instance names of all classes one by one, and storing all the instance names corresponding to each class into a list instanceList;
b. acquiring information of a currently traversed class, and storing the information into presentClassInfo;
c. traverse all class instances of the current class: calling a depeCopt () method to deeply copy presentClassInfo and storing the depeClassInfoClone into a presentClassInfo; calling method addPrefix ToClassInfo () to add an instance name with a dotted suffix to the front of all named objects in the copy presentClassInfo clone of the currently traversed class; merging class information with instance name prefix into CflatPerforming the following steps;
s4423, the information corresponding to the original class is changed to the information of the flattened class.
Further, in step S5, the process of completing the information of all classfnfos in Map < String, classfnfo > and saving the complete information in Map < String, classfulleino > includes:
s51, traversing all ClassInfo in Map < String, ClassInfo > storing flattening information, completing the information, supplementing necessary symbolic information, and combining part of node information to be packaged into complete sentences;
s52, the encapsulation result is saved in the data structure Map < String, ClassCompleteInfo >.
The invention has the beneficial effects that:
the lexical and syntactic analysis of the input model file is realized by means of an ANTLR tool, information of all classes is obtained by traversing a syntactic analysis tree and is stored in a custom data structure, and finally flattening operation of all classes is realized by operating the data structure, so that the flattening method of the class in the conversion algorithm from the S2ML model of AltRIca 3.0 to the GTS model is successfully realized. The method expands the range of recognizable and analyzable input models and realizes the accurate positioning of grammar analysis by refining and defining the ANLTR grammar file of AltaRica 3.0; the key information of the class is stored through a self-defined data structure ClassInfo, so that the traversal times of the syntax analysis tree are greatly reduced, and the time and space complexity of the method is reduced; through the verification of a group of example systems, the method can effectively realize flattening operation on medium and small scale systems.
Drawings
FIG. 1 is a class diagram of the data structure ClassInfo of the present invention.
FIG. 2 is a flow chart of the method of flattening classes in the AltaRica model of the present invention.
FIG. 3 is a schematic diagram of the flattening algorithm pseudo-code for the classes of the present invention.
Detailed Description
The present invention will now be described in further detail with reference to the accompanying drawings.
It should be noted that the terms "upper", "lower", "left", "right", "front", "back", etc. used in the present invention are for clarity of description only, and are not intended to limit the scope of the present invention, and the relative relationship between the terms and the terms is not limited by the technical contents of the essential changes.
With reference to fig. 2, the present invention refers to a method for flattening classes in the AltaRica model, said flattening method comprising the steps of:
s1, writing an ANTLR grammar file of AltaRica 3.0, generating a lexical analyzer and a grammar analyzer based on an ANTLR 4 tool, and obtaining an abstract syntax tree.
S2, designing data structure for storing class information, including ClassInfo for storing key information and ClassCompleteInfo for storing complete information.
S3, traversing the abstract syntax tree, and storing the key node information of all classes in the syntax tree into Map < String, ClassInfo >.
S4, flattening all ClassInfo in Map < String, ClassInfo >.
S5, the information of all ClassInfo in Map < String, ClassInfo > is integrated, and the integrated information is saved in Map < String, ClassCompleteInfo >.
The invention aims to solve the technical problem of providing a feasible optimization method aiming at the defects of the class flattening method in the conversion method from the S2ML model of AltRIca 3.0 to the GTS model. The invention mainly comprises the following contents:
the first part is to write an ANTLR grammar file of AltaRica 3.0, generate a lexical analyzer and a grammar analyzer based on an ANTLR 4 tool, and obtain an abstract syntax tree:
the invention relates to a class flattening method, which relates to the identification and conversion between two model languages. The invention writes AltaRica 3.0 ANTLR grammar file AltaRica3.g4 based on E-BNF in AltaRica 3.0 language specification appendix, and optimizes and adjusts the grammar file through specific examples. Based on the grammar file, a lexical analyzer and a grammar analyzer which can analyze the AltaRica 3.0 model are generated by using an ANTLR 4 tool, and a corresponding abstract grammar tree is generated by analyzing the AltaRica 3.0 model file of a certain system.
And the second part is used for designing a data structure for storing class information, wherein the data structure comprises ClassInfo for storing key information and ClassCompleteInfo for storing complete information:
in order to reduce the traversal times of an abstract syntax tree and reduce the time complexity of an algorithm, the invention designs a data structure ClassInfo for storing key node information in the syntax tree, wherein a class diagram of the ClassInfo is shown in FIG. 1; in addition, the invention also designs a data structure ClassCompleteInfo for storing the complete information of the class. It should be noted that: the ClassInfo data structure is more finely defined, the structure of the original model can be kept, only the key node information is stored, the flattening operation of the class is facilitated, and meanwhile, the time and space complexity of the flattening method of the class is reduced; the data structure classfileteinfo is designed only for convenience of output operation, and is supplemented with some symbolic information (such as "if", "→" → "and" ("and the like) on the basis of classffo, and meanwhile, some node information is combined and packaged into some complete statements.
And a third part, writing an algorithm, traversing the abstract syntax tree, and storing key node information of all classes in the syntax tree into Map < String, ClassInfo >:
in order to accurately judge whether a declaration element in a class is an object (an instance of the class) or a common variable when traversing the declaration element, a pre-traversal needs to be performed on the parse trees of all classes, so as to obtain class names of all classes. The invention stores all class names into an ArrayList, when traversing to the declaration element, judges whether the type of the declaration element exists in the ArrayList, if so, the declaration element is an object, otherwise, the declaration element is a common variable. Traversing the syntax analysis tree for the second time, all the key node information in each class needs to be obtained and stored in a data structure Map < String, classffo >, wherein String stores the class name, and classffo stores all the information of the class corresponding to the class name.
And fourthly, writing an algorithm, flattening all ClassInfo in Map < String, ClassInfo >:
the flattening operation of the class includes corresponding processing of the extension classes of all classes, objects (instances of classes) in declaration elements, atomic elements (variables, events, parameters, and observers), and transformations and assertions, and the flattened information is still saved in the data structure Map < String, ClassInfo >. For the extension class, all the parent class information of each class needs to be copied into the subclasses; for other nested class instances in a class, all named objects (variables, events, parameters, watchers and their references in expressions and synchronization) in the copy of the class corresponding to the class instance need to be prepended with the instance name with a dotted suffix, and then the copy information is copied into the class. Atomic elements in the declaration elements, and translations and assertions, are copied directly into classes. The pseudo code of the flattening algorithm for a class is shown in FIG. 3.
With reference to the examples, the flattening algorithm for classes is explained in detail as follows:
consider a C ═ C<CE,D,T,A>The class of constituents: cEIs a set of extension classes; d (declaration) is a set of declaration elements, including objects (instances of classes) and atomic elements (variables, events, parameters, and watchers); t (transition) is a transition; a (assertion) is asserted.
CflatIs a flattened form of class C, from C to CflatCan be obtained by the following steps:
step 1: (line 3 of FIG. 3) deep copy class C, saving its information to CflatIn (1). The code of line 3 in fig. 2 calls the depcopt () method of the object, i.e., the deep clone method. Since the object of the data structure classffo is a reference type and contains many child reference types, deep cloning of the object can be achieved in a Serialization (Serialization) manner.
Two steps are required to achieve deep cloning:
firstly, serializing an object, wherein the class of the object classInfo capable of realizing serialization needs to realize a Serializable interface, a nested class in the class also needs to realize the Serializable interface, and otherwise, the serialization operation cannot be realized;
and secondly, calling a depeCopt () method to realize the copy of an object. Step 1 in effect enables the copying of simple variable declarations (of the type Boolean, integrar, Real, Symbol or user-defined domain), event declarations, parameter declarations and observer declarations in class C to CflatAnd implements the replication of class C translations and assertions to CflatIn (1).
Step 2: (lines 4-11 of FIG. 3) performing an extension class C for a set of extension classesEFlattening.
(1) Before flattening, a pretreatment is required, namely CflatThe list of the parent classes is empty, and the number of the parent classes is 0;
(2) if the number of parents of the class C is more than 0, flattening all the extension classes in the class C is started:
calling a method getSuperclassList () of the class C to obtain a superclassList of the class C;
(vii) traverse superclassList: first, according toAcquiring class information by the currently traversed parent class name and storing the class information into a super class; then, merge the parent information into CflatIn (1). When the superclassList traversal is completed, flattening of all the extension classes in class C is completed.
And step 3: (lines 12-24 of FIG. 3) handle objects in D (examples of nested other classes).
(1) Before flattening, a pretreatment is also required, namely CflatThe mapping of class instances of (2) is empty, and the number of class instances is 0.
(2) If the number of objects in class C is greater than 0, then flattening all class instances in class C is started:
calling a class C method getClassInstanceMap () to obtain a class instance mapping classInstanceMap, wherein all instances corresponding to all classes nested in the class C are stored.
② traversing classInstanceMap:
a. acquiring instance names of all classes one by one, and storing all the instance names corresponding to each class into a list instanceList;
b. acquiring information of a currently traversed class, and storing the information into presentClassInfo;
c. traverse all class instances of the current class:
calling depepCopt () method to deeply copy presentClassInfo and saving it to presentClassInfo clone;
the call method addPrefix ToClassInfo () prepends all named objects (variables, events, parameters, watchers and their references in expressions and synchronization) in the copy presentClassInfoClone of the currently traversed class with an instance name with a point suffix.
Merging class information with instance name prefix into CflatIn (1).
And thirdly, changing the information corresponding to the original class into the information of the flattened class.
Through the steps, flattening of all kinds of information of AltaRica 3.0 models in the data structure Map < String, ClassInfo > can be achieved.
And a fifth part, writing an algorithm, completing the information of all ClassInfo in Map < String, ClassInfo >, and storing the complete information into the Map < String, ClassCompleteInfo >:
traversing all ClassInfo in Map < String, ClassInfo > storing flattening information, completing the information, supplementing some necessary symbol information, combining some node information, packaging into a complete statement, and then storing into a data structure Map < String, ClassCompleteInfo >.
The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above-mentioned embodiments, and all technical solutions belonging to the idea of the present invention belong to the protection scope of the present invention. It should be noted that modifications and embellishments within the scope of the invention may be made by those skilled in the art without departing from the principle of the invention.

Claims (7)

1. A flattening method for classes in an AltaRica model is characterized by comprising the following steps:
s1, writing an AntLR grammar file of AltaRica 3.0, generating a lexical analyzer and a grammar analyzer based on an ANTLR 4 tool, and acquiring an abstract syntax tree;
s2, designing data structure for storing class information, including ClassInfo for storing key information and ClassCompleteInfo for storing complete information;
s3, traversing the abstract syntax tree, and storing the key node information of all classes in the syntax tree into Map < String, ClassInfo >;
s4, flattening all ClassInfo in Map < String, ClassInfo >;
s5, the information of all ClassInfo in Map < String, ClassInfo > is integrated, and the integrated information is saved in Map < String, ClassCompleteInfo >.
2. The method for flattening classes in AltaRica model according to claim 1, wherein in step S1, the process of writing the ANTLR grammar file of AltaRica 3.0 further comprises:
and optimizing and adjusting the written ANTLR grammar file by adopting a specific example.
3. The method for flattening classes in AltaRica model according to claim 1, wherein in step S2, said data structure ClassInfo is used to store key node information in syntax trees, and said data structure ClassCompleteInfo supplements other information including symbol information on the basis of the data structure ClassInfo, and combines some of the node information to encapsulate into complete statements.
4. The method for flattening classes in AltaRica model according to claim 1, wherein in step S3, the process of traversing the abstract syntax tree and saving the key node information of all classes in the syntax tree to Map < String, ClassInfo > comprises the following steps:
s31, storing all class names into ArrayList;
s32, pre-traversing the syntax analysis trees of all classes, judging whether the type of the declaration element exists in the ArrayList when traversing the declaration element, if so, taking the declaration element as an object, otherwise, taking the declaration element as a common variable;
s33, traversing the syntax analysis tree, obtaining all key node information in each class, and storing the key node information in the data structure Map < String, ClassInfo >, wherein String stores the class name, and ClassInfo stores all the information of the class corresponding to the class name.
5. The method for flattening classes in AltaRica model according to claim 1, wherein in step S4, the process of flattening all ClassInfo in Map < String, ClassInfo > comprises the following steps:
flattening operation is carried out on the class according to the type of each component element contained in the class, and flattened information is still stored in a data structure Map < String, ClassInfo >:
(1) for the extension class, copying all the parent class information of each class into the subclasses;
(2) for other nested class instances in the class, adding instance names with dotted suffixes in front of all named objects in the copies of the class corresponding to the class instances, and then copying the copy information into the class;
(3) atomic elements in the declaration elements, and translations and assertions are copied directly into classes.
6. The method of claim 5, wherein C is defined asflatIs a flattened form of class C, from C to CflatObtained by the following steps:
s41, serializing the object;
s42, calling a depeCopt () method to realize the copy of the simple variable declaration, the event declaration, the parameter declaration and the observer declaration in the class C, and the conversion and assertion of the class C;
s43, flattening the extension class:
and S431, preprocessing: c is to beflatThe list of the parent classes is empty, and the number of the parent classes is 0;
s432, if the number of the parents of the class C is more than 0, flattening all the extension classes in the class C, including:
calling a method getSuperclassList () of the class C to obtain a superclassList of the class C;
traverse superclassList: firstly, acquiring class information according to a currently traversed parent class name and storing the class information into a super class; merging parent class information into CflatPerforming the following steps; when the traversal of the superclassList is completed, the flattening of all the extension classes in the class C is completed;
s44, flattening the nested examples of other classes:
s441, preprocessing: c is to beflatThe mapping of the class instances is empty, and the number of the class instances is 0;
s442, if the number of the objects in the class C is larger than 0, flattening all the class instances in the class C:
s4421, calling a class C method getClassInstantEncap () to obtain a class instance mapping classInstantEncap, wherein all instances corresponding to all classes nested in the class C are stored;
s4422, traversing classInstanceMap:
a. acquiring instance names of all classes one by one, and storing all the instance names corresponding to each class into a list instanceList;
b. acquiring information of a currently traversed class, and storing the information into presentClassInfo;
c. traverse all class instances of the current class: calling a depeCopt () method to deeply copy presentClassInfo and storing the depeClassInfoClone into a presentClassInfo; calling method addPrefix ToClassInfo () to add an instance name with a dotted suffix to the front of all named objects in the copy presentClassInfo clone of the currently traversed class; merging class information with instance name prefix into CflatPerforming the following steps;
s4423, the information corresponding to the original class is changed to the information of the flattened class.
7. The method for flattening classes in AltaRica model according to claim 1, wherein in step S5, the process of completing the information of all ClassInfo in Map < String, ClassInfo > and saving the complete information in Map < String, ClassCompleteInfo > comprises:
s51, traversing all ClassInfo in Map < String, ClassInfo > storing flattening information, completing the information, supplementing necessary symbolic information, and combining part of node information to be packaged into complete sentences;
s52, the encapsulation result is saved in the data structure Map < String, ClassCompleteInfo >.
CN202010766061.4A 2020-08-03 2020-08-03 Class flattening method in AltaRica model Active CN111984233B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010766061.4A CN111984233B (en) 2020-08-03 2020-08-03 Class flattening method in AltaRica model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010766061.4A CN111984233B (en) 2020-08-03 2020-08-03 Class flattening method in AltaRica model

Publications (2)

Publication Number Publication Date
CN111984233A true CN111984233A (en) 2020-11-24
CN111984233B CN111984233B (en) 2022-02-01

Family

ID=73445981

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010766061.4A Active CN111984233B (en) 2020-08-03 2020-08-03 Class flattening method in AltaRica model

Country Status (1)

Country Link
CN (1) CN111984233B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113467828A (en) * 2021-06-23 2021-10-01 中国海洋大学 Method and system for converting programming language in heterogeneous many-core processor

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799521A (en) * 2012-06-28 2012-11-28 南京航空航天大学 Hierarchical timed automata flattening algorithm
CN105404584A (en) * 2015-11-25 2016-03-16 广州博冠信息科技有限公司 LPC static code inspection method, apparatus and system
CN109857458A (en) * 2019-03-01 2019-06-07 南京航空航天大学 The method for transformation of the flattening of AltaRica 3.0 based on ANTLR
CN111176639A (en) * 2019-12-30 2020-05-19 南京航空航天大学 Automatic model conversion method from SysML to AltaRica
CN111414632A (en) * 2020-03-12 2020-07-14 西安电子科技大学 AST self-synthesis-based embedded program data stream security verification method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799521A (en) * 2012-06-28 2012-11-28 南京航空航天大学 Hierarchical timed automata flattening algorithm
CN105404584A (en) * 2015-11-25 2016-03-16 广州博冠信息科技有限公司 LPC static code inspection method, apparatus and system
CN109857458A (en) * 2019-03-01 2019-06-07 南京航空航天大学 The method for transformation of the flattening of AltaRica 3.0 based on ANTLR
CN111176639A (en) * 2019-12-30 2020-05-19 南京航空航天大学 Automatic model conversion method from SysML to AltaRica
CN111414632A (en) * 2020-03-12 2020-07-14 西安电子科技大学 AST self-synthesis-based embedded program data stream security verification method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
MICHEL BATTEUX等: "《The AltaRica 3.0 project for Model-Based Safety Assessment》", 《2013 11TH IEEE INTERNATIONAL CONFERENCE ON INDUSTRIAL INFORMATICS (INDIN)》 *
仵志鹏: "《面向AltaRica模型的系统安全性设计验证方法研究》", 《中国优秀硕士学位论文全文数据库工程科技Ⅱ辑-信息科技》 *
陈朔等: "《基于ANTLR的AltaRica 3.0模型平展化算法设计与实现》", 《小型微型计算机系统》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113467828A (en) * 2021-06-23 2021-10-01 中国海洋大学 Method and system for converting programming language in heterogeneous many-core processor
CN113467828B (en) * 2021-06-23 2024-01-12 中国海洋大学 Method and system for converting programming language in heterogeneous many-core processor

Also Published As

Publication number Publication date
CN111984233B (en) 2022-02-01

Similar Documents

Publication Publication Date Title
Garlan et al. Acme: An architecture description interchange language
Embley et al. Handbook of conceptual modeling: theory, practice, and research challenges
Cánovas Izquierdo et al. A domain specific language for extracting models in software modernization
CN111176639A (en) Automatic model conversion method from SysML to AltaRica
Akehurst Model Translation: A UML-based specification technique and active implementation approach
Sprinkle et al. Domain model translation using graph transformations
Gašević et al. MDA-based automatic OWL ontology development
CN111984233B (en) Class flattening method in AltaRica model
Zhekova et al. QUESTION PATTERNS FOR NATURAL LANGUAGE TRANSLATION IN SQL QUERIES.
CN108932225B (en) Method and system for converting natural language requirements into semantic modeling language statements
CN113655996B (en) Enterprise-level system generation method based on demand model
Hossain et al. Specifying conceptual models using restricted natural language
Athan et al. Legal Interpretations in LegalRuleML.
Curland et al. Enhanced verbalization of ORM models
Henriksson A lightweight framework for universal fragment composition: with an application in the semantic web
Maxwell Grammar debugging
Ahmed Proposing LT based Search in PDM Systems for Better Information Retrieval
Khelil et al. A new syntactic-semantic interface for ArabTAG an Arabic Tree Adjoining grammar
Chen et al. A Conversion Framework of the Continuous Modeling Languages Based on ANTLR4
Vo et al. Model-based generation of natural language specifications
Gradl et al. Explicating knowledge on data models through domain specific languages
David Attribute grammars for C++ disambiguation
Xiao Transformation System of two Similar Syntax Programs Based on the Compiler Principle
Ji et al. An Architectural Design and Architectural Transformation Method Based on the Complex Real-Time Embedded Systems
Broll et al. Extensible visual constraint language

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