//missing callback public Entity(string name, EntityClass classe) : base(name, classe) { viewPoints = new Dictionary<string, PointSpecification>(); // referentialPoint= new (UnityPointSpecification)ScriptableObject.CreateInstance("UnityPointSpecification"); // ((UnityPointSpecification)referentialPoint).instantiate();//getGlobalPosition(),getGlobalRotation()); }
public Zone(string name, EntityClass cl) : base(name, cl) { }
//default parameter strIsFileName=true; public ModelLoader2(string str, bool strIsFileName) { _idClass = new Dictionary<String, Class>(); //_idAsso = new Dictionary<string, Property>(); //_idAsso = new MapStringProperties(); _idOperations = new Dictionary<string, Operation>(); _idBehaviors = new Dictionary<string, Behavior>(); _parameters = new Dictionary<string, Parameter>(); _partitions = new Dictionary<string, ActivityPartition>(); _paramToType = new Dictionary<string, string>(); _classifiers = new Dictionary<string, Classifier>(); _callOperations = new Dictionary<CallOperationAction, string>(); _callBehaviors = new Dictionary<CallBehaviorAction, string>(); _callEvents = new Dictionary<CallEvent, string>(); _signals = new Dictionary<string, Signal>(); _events = new Dictionary<string, MascaretEvent>(); _activityNodes = new Dictionary<string, ActivityNode>(); _waitingNodes = new Dictionary<string, string>(); _objectNodes = new Dictionary<string, ObjectNode>(); _activityExpressions = new Dictionary<string, Expression>(); _activitiesMethod = new Dictionary<string, Activity>(); _subStateMachines = new Dictionary<string, StateMachine>(); _subStates = new Dictionary<string, State>(); _subStatesID = new Dictionary<string, string>(); _primitiveTypes = new Dictionary<string, string>(); _loader = new XDocument(); try { String s = MascaretApplication.Instance.readFlow(str); _loader = XDocument.Parse(s); _xmi = _loader.Root; // MascaretApplication.Instance.logfile.WriteLine("XMI : " + _xmi.Name.LocalName.ToLower()); MascaretApplication.Instance.logfile.Flush(); //Debug.Log (_xmi.Name); XElement modelNode = null; // MascaretApplication.Instance.logfile.WriteLine("Parsing Model"); MascaretApplication.Instance.logfile.Flush(); if ((_xmi.Name.LocalName.ToLower().CompareTo("uml:model") == 0) || (_xmi.Name.LocalName.ToLower().CompareTo("model") == 0)) { // MascaretApplication.Instance.logfile.WriteLine("OK"); MascaretApplication.Instance.logfile.Flush(); modelNode = _xmi; } else { foreach (XElement currentNode in _xmi.Elements()) { if (currentNode.Name.LocalName.ToLower().CompareTo("model") == 0) { modelNode = currentNode; } } } if (modelNode != null) { XAttribute attr = (XAttribute)modelNode.Attribute("name"); // MascaretApplication.Instance.logfile.WriteLine("ModelName : " + attr.Value); MascaretApplication.Instance.logfile.Flush(); if (MascaretApplication.Instance.hasModel(attr.Value)) { model = MascaretApplication.Instance.getModel(attr.Value); } else { model = new Model(attr.Value); if (strIsFileName) model.XmiUrl = str; MascaretApplication.Instance.addModel(model); getPrimitiveType(modelNode); addStereotypes(); addPackage(modelNode, null); _setParametersType(); addGeneralizations(); addAssociation(); addActivitiesAndStateMachines(); addCallOperations(); addCallBehaviors(); addConditions(); EntityClass curEntityClass = new EntityClass("undef"); Class classe = (Class)curEntityClass; model.Package.addClasses(classe); model.registerAllClasses(); } } } catch (FileLoadException) { } // Bouml preserved body end 0001F4E7 }
public void addClass(XElement classNode, Package pkg) { //StreamWriter file = new StreamWriter("log2.txt"); string type = "", className = "", id = ""; XAttribute attr = (XAttribute)classNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type"); if (attr == null) attr = (XAttribute)classNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type"); if (attr != null) type = attr.Value; attr = (XAttribute)classNode.Attribute("name"); if (attr != null) className = attr.Value; attr = (XAttribute)classNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id"); if (attr == null) attr = (XAttribute)classNode.Attribute("{http://www.omg.org/spec/XMI/20131001}id"); if (attr != null) id = attr.Value; if (type.CompareTo("uml:Class") != 0 && type.CompareTo("uml:Interface") != 0) { return; } Class cl = null; // file.WriteLine(" Class : " + className); // file.Flush(); // file.Close(); if (isStereotypedEntity(classNode)) { cl = new EntityClass(className); } else if (isStereotypedBlock(classNode)) { cl = new Block(className); } else if (isStereotypedAgent(classNode)) { cl = new AgentClass(className); } else if (isStereotypedVirtualHuman(classNode)) { cl = new VirtualHumanClass(className); } else if (isStereotypedRole(classNode)) { cl = new RoleClass(className); } else { cl = new EntityClass(className); } _idClass.Add(id, cl); _classifiers.Add(id, cl); //Debug.Log (" Adding Class : " + _classifiers.convertToDictionary().Count + " : " + id); if (pkg != null) pkg.addClasses(cl); cl.Description = getComment(classNode); cl.Summary = getSummary(classNode); cl.Tags = getTags(classNode); foreach (XElement child in classNode.Elements()) { if (child.Name.LocalName.CompareTo("ownedOperation") == 0) addOperation(child, cl); else if (child.Name.LocalName.CompareTo("ownedAttribute") == 0) addAttribute(child, cl); else if (child.Name.LocalName.CompareTo("generalization") == 0) { XAttribute attr2 = (XAttribute)child.Attribute("general"); if (attr2 != null) _toGeneralize.Add(new KeyValuePair<string, string>(id, attr2.Value)); } } foreach (KeyValuePair<CallEvent, string> pair in _callEvents) { if (_idOperations.ContainsKey(pair.Value)) { Operation oper = _idOperations[pair.Value]; // TO DO_callEvents.getKey(pair.Key).Operation=oper; } } foreach (XElement child in classNode.Elements()) { //Debug.Log(" Parsing class : " + cl.getFullName() + "/ Child : " + child.Name.LocalName); if (child.Name.LocalName.CompareTo("ownedBehavior") == 0 || child.Name.LocalName.CompareTo("nestedClassifier") == 0) { // MascaretApplication.Instance.logfile.WriteLine(" Owned Behavior"); MascaretApplication.Instance.logfile.Flush(); XAttribute attr2 = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type"); if (attr2 == null) attr2 = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type"); // MascaretApplication.Instance.logfile.WriteLine(attr2.Value); MascaretApplication.Instance.logfile.Flush(); //Debug.Log(" Parsing class : " + cl.getFullName() + "/ Attr : " + attr2); if (attr2 != null && attr2.Value.CompareTo("uml:StateMachine") == 0) addStateMachineToClass(child, cl); if (attr2 != null && attr2.Value.CompareTo("uml:Activity") == 0) addActivityToClass(child, cl); } } // Bouml preserved body end 0001F5E7 }