Skip to content
Snippets Groups Projects
Commit 0b4fe41c authored by Sophie Coudert's avatar Sophie Coudert
Browse files

save...

parent 5d243078
No related branches found
No related tags found
4 merge requests!504merge first stable version of Avatar-SysML V2,!503merge the first stable version of the Avatar-SysML parser/generator,!501Avatar sys ml 04 2024,!498Avatar sys ml 04 2024 (first merge request, only for verification)
......@@ -341,12 +341,20 @@ public class AvatarFromSysML {
StxAction action = actions.get(k);
if(action.getType() == AvatarFromSysMLSyntax.STXASSIGNACTION){
String leftHandStr = extendIdent(action.getTarget(),blk);
AvatarDataType dataType = extendType;
String rightHandStr;
StxTerm value = action.getValue();
if (value instanceof StxId){ rightHandStr = extendIdent(((StxId)value).getString(),blk); }
else if (value instanceof StxExpr){ rightHandStr = ((StxExpr)value).getString(); }
else { rightHandStr = extendCall((StxCall)value,blk); }
theTransition.addAction(AvatarTerm.createActionFromString(theBlock, leftHandStr + "=" + rightHandStr));
AvatarAction act = AvatarTerm.createActionFromString(theBlock, leftHandStr + "=" + rightHandStr);
theTransition.addAction(act);
if(dataType != null && act != null && ((AvatarActionAssignment)act).getLeftHand() instanceof AvatarTuple ) {
AvatarAttribute head =
(AvatarAttribute)((AvatarTuple) ((AvatarActionAssignment)act).getLeftHand()).getComponents().get(0);
head.setDataType(dataType);
}
//!!! Ajouter le tagging datatype
}
else { // STXMETHODACTION
if (action.getValue() instanceof StxCall) { // else ERROR
......@@ -507,17 +515,22 @@ public class AvatarFromSysML {
}
return type;
}
private String extendString;
private AvatarDataType extendType;
private String extendPath(String path, StxBlock b) {
String type = getStxPathType(path, b);
if (type.equals("Integer") || type.equals("Boolean")) return path;
AvatarDataType adt = AvatarDataType.dataTypeMap.get(type);
int size = adt.getFullSize() - 1;
extendString = getStxPathType(path, b);
if (extendString.equals("Integer") || extendString.equals("Boolean")) {
extendType = null;
return path;
}
extendType = AvatarDataType.dataTypeMap.get(extendString);
int size = extendType.getFullSize() - 1;
if (size == -1) return path;
StringBuffer res = new StringBuffer();
int i;
for (i = 0; i < size; i++)
res.append(path + "__" + adt.getFieldString(i) + ", ");
res.append(path + "__" + adt.getFieldString(i));
res.append(path + "__" + extendType.getFieldString(i) + ", ");
res.append(path + "__" + extendType.getFieldString(i));
return res.toString();
}
private String extendIdent (String path, StxBlock b) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment