diff --git a/src/main/java/avatartranslator/tosysmlv2/AvatarFromSysML.java b/src/main/java/avatartranslator/tosysmlv2/AvatarFromSysML.java index 30df07ef2f9ef99f51c259ad4e69a243d5ea4a55..19776bbe59645b8bfd3eac78e497185020642127 100644 --- a/src/main/java/avatartranslator/tosysmlv2/AvatarFromSysML.java +++ b/src/main/java/avatartranslator/tosysmlv2/AvatarFromSysML.java @@ -59,15 +59,33 @@ import myutil.TraceManager; import static java.lang.System.out; +/** Class AvatarFromSysML + * Creation: 20/06/2024 + * + * @author Sophie Coudert + * @version 0.1 20/06/2024 + * + * Building Avatar Models from Their SysML V2 description. This Class exports the main function that does this. Technically, + * the class implements the last step of this process, i.e. it builds Avatar models from abstract syntax trees build by AvatarSysMLParser. + */ public class AvatarFromSysML { + /** the build Avatar specification, returned at the end of the building process */ private AvatarSpecification avSpec; + /** the source abstract syntax tree, obtained through a call to the parser */ private StxModel stxSpec; + /** maps signal syntactic elements to their associated avatar signal by the building process */ private HashMap<StxSignal, AvatarSignal> signalMap; + /** maps block syntactic elements to their associated avatar block by the building process */ private HashMap<StxBlock, AvatarBlock> blockMap; + /** maps state syntactic elements to their associated avatar state-machine element by the building process (when exists) */ private HashMap<StxState, AvatarStateMachineElement> stateMap; + /** maps transition syntactic elements to their associated avatar transition by the building process (when exists) */ private HashMap<AvatarStateMachineElement, StateTransitions> transitionMap; + /** maps Avatar datatypes extracted from the SysML sourse to their sequence of primitive fields */ private HashMap<AvatarDataType, AvatarDataTypePrimitiveFields> primitiveFieldsMap; + /** all errors encountered while parsing and building model from parsing-returned abstract syntax tree */ private List<AvatarFromSysMLError> errors; + public AvatarFromSysML(){ avSpec = null; stxSpec = null; @@ -77,6 +95,11 @@ public class AvatarFromSysML { transitionMap = new HashMap<AvatarStateMachineElement, StateTransitions>(); errors = null; } + + /** register an error encountered while parsing and building model from parsing-returned abstract syntax tree */ + private void addError(AvatarFromSysMLError _err) { errors.add(_err); } + + /** to memorize the set of transitions of a state and memorize its block with them */ private class StateTransitions { private AvatarBlock block; private List<AvatarTransition> transitions; @@ -87,9 +110,8 @@ public class AvatarFromSysML { public AvatarBlock getBlock() { return block; } public List<AvatarTransition> getTransitions() { return transitions; } } - private void addError(AvatarFromSysMLError _err) { - errors.add(_err); - } + + /** Builds an Avatar Specification From */ public AvatarSpecification sysMLtoSpec(String _fileName) { AvatarFromSysMLParser parser; try { parser =