private void _printPackage(int level, HttpRequest req, Package package, VirtualHuman human)
        {
            if (package == null) return;

            req.response.write("<div class=\"node\">");

            req.response.write("<img src = em_package.png>");
            req.response.write(" ");
            req.response.write(package.name);
            level++;
            req.response.write("<ul>");
            foreach (KeyValuePair<string, Class> cl in package.Classes)
            {
                req.response.write("<P><img src =EndL.png>");
                req.response.write("<img src =em_class.png>");
                req.response.write(" <a href=\"Class?alias=");
                req.response.write(cl.Value.name);
                if (human != null)
                {
                    req.response.write("&agent=");
                    req.response.write(human.name);
                }
                req.response.write("\" target = \"Body\">");
                req.response.write(cl.Value.name);
                req.response.write("</a>");
                req.response.write("</P>");
            }
            foreach (KeyValuePair<string, Package> pkg in package.Packages)
                _printPackage(level, req, pkg.Value, human);
            req.response.write("</ul>");
            req.response.write("</div>");
        }
        protected Class _findClassPackage(Package package, string className)
        {
            Class classe = null;

            foreach (Class currentClass in package.Classes.Values)
            {
                if (currentClass.name == className)
                {
                    classe = currentClass;
                    break;
                }
            }

            if (classe == null)
            {
                foreach (Package currentPackage in package.Packages.Values)
                {
                    classe = _findClassPackage(currentPackage, className);
                    if (classe != null)
                        break;
                }
            }
            return classe;
        }
 Class _findClasse(Package package, string id)
 {
     if (package.Classes.ContainsKey(id))
         return package.Classes[id];
     else
     {
         Dictionary<string, Package> packages = package.Packages;
         Class c = null;
         foreach (KeyValuePair<string, Package> pkg in packages)
         {
             c = _findClasse(pkg.Value, id);
             if (c != null) break;
         }
         return c;
     }
 }
Exemple #4
0
        public void addCallEvent(XElement callNode, Package pkg)
        {
            // Bouml preserved body begin 0001F5E7

            string type = "", className = "", id = "";

            XAttribute attr = (XAttribute)callNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
            if (attr == null) attr = (XAttribute)callNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type");

            if (attr != null) type = attr.Value;

            attr = (XAttribute)callNode.Attribute("name");
            if (attr != null) className = attr.Value;

            if (type.CompareTo("uml:CallEvent") != 0)
            {
                //Debug.Log(className + " is a " + type + " and must be a signal");
                return;
            }

            attr = (XAttribute)callNode.Attribute("id");
            if (attr != null) id = attr.Value;

            CallEvent callEvent = new CallEvent(id);
            attr = (XAttribute)callNode.Attribute("operation");

            if (attr != null) _callEvents.Add(callEvent, attr.Value);

            _events.Add(id, callEvent);
            // Bouml preserved body end 0001F5E7
        }
Exemple #5
0
        void addPackage(XElement packageNode, Package parent)
        {
            // Bouml preserved body begin 0001F567
            // StreamWriter file = MascaretApplication.Instance.logfile;

            // file.WriteLine("Parsing Packages ..."); file.Flush();

            XAttribute typeAttr = null, pkgNameAttr = null;
            string type = "", pkgName = "";
            typeAttr = (XAttribute)packageNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
            if (typeAttr == null) typeAttr = (XAttribute)packageNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
            if (typeAttr != null) type = typeAttr.Value;

            if (typeAttr == null && ((packageNode.Name.LocalName.CompareTo("Model") == 0) || (packageNode.Name.LocalName.CompareTo("uml:Model") == 0)))
                type = "uml:Model";

            pkgNameAttr = (XAttribute)packageNode.Attribute("name");
            if (pkgNameAttr != null) pkgName = pkgNameAttr.Value;

            // file.WriteLine("type : " + type); file.Flush();

            if (String.Compare(type, "uml:Model") != 0 && String.Compare(type, "uml:Package") != 0)
            {
                return;
            }

            Package pkg = null;
            if (String.Compare(type, "uml:Package") == 0 || String.Compare(type, "uml:Model") == 0)
            {
                pkg = new Package(pkgName);

                pkg.Description = getComment(packageNode);
                pkg.Summary = getSummary(packageNode);
                pkg.Tags = getTags(packageNode);

                if (parent != null)
                {
                    //Debug.Log ("Package got parent");
                    parent.addPackages(pkg);
                }
                else
                {
                    //Debug.Log("Package is root" );
                    model.Package = pkg;
                }
            }

            foreach (XElement child in packageNode.Elements())
            {

                if (child.Name.LocalName.CompareTo("packagedElement") == 0 || child.Name.LocalName.CompareTo("ownedMember") == 0)
                {
                    string childType = "";
                    string id = "";

                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                    if (attr != null) childType = attr.Value;

                    attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}id");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}id");
                    if (attr != null) id = attr.Value;

                    //MascaretApplication.Instance.VRComponentFactory.Log("================    " + childType);
                    if (childType.CompareTo("uml:InstanceSpecification") == 0)
                    {
                        if (isStereotypedUnit(child))
                        {
                            string unitName = "";
                            XAttribute attrName = (XAttribute)child.Attribute("name");
                            if (attrName != null) unitName = attrName.Value;
                            string classifier = "";
                            string classifierType = "";
                            XElement typeNode = child.Element("classifier");

                            XAttribute attrType = (XAttribute)typeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                            if (attrType == null) attrType = (XAttribute)typeNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                            if (attrType != null) classifierType = attrType.Value;

                            if (classifierType == "uml:PrimitiveType")
                            {

                                attrType = (XAttribute)typeNode.Attribute("href");
                                if (attr != null) classifier = attr.Value.Substring(attr.Value.IndexOf("#") + 1);

                                Class cl = model.getBasicType(classifier.ToLower());
                                Unit unit = new Unit(unitName, cl);
                                _units.Add(id, unit);
                                MascaretApplication.Instance.VRComponentFactory.Log("NEW UNIT : " + unitName + " : " + cl.name);
                            }

                        }
                    }
                }
            }

            foreach (XElement child in packageNode.Elements())
            {

                if (child.Name.LocalName.CompareTo("packagedElement") == 0 || child.Name.LocalName.CompareTo("ownedMember") == 0)
                {
                    string childType = "";

                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                    if (attr != null) childType = attr.Value;

                    //Debug.Log("================    " + childType);
                    if (childType.CompareTo("uml:DataType") == 0 || childType.CompareTo("PrimitiveType") == 0)
                        addDatatype(child);
                    else if (childType.CompareTo("uml:Signal") == 0)
                    {
                        addSignal(child, pkg);
                    }
                }
                else if (child.Name.LocalName.CompareTo("ownedRule") == 0)
                {
                    string childType = "";

                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                    if (attr != null) childType = attr.Value;

                    if (childType.CompareTo("Constraint") == 0)
                    {
                        ConstraintT constraint = new ConstraintT();

                        attr = (XAttribute)child.Attribute("id");
                        if (attr != null) constraint.id = attr.Value;

                        attr = (XAttribute)child.Attribute("constrainedElement");
                        if (attr != null) constraint.constrainedElementID = attr.Value;

                        foreach (XElement specifNode in child.Elements())
                        {
                            if (specifNode.Name.LocalName.CompareTo("specification") == 0)
                            {
                                attr = (XAttribute)specifNode.Attribute("value");
                                if (attr != null) constraint.specification = attr.Value;
                                _constraints.Add(constraint);
                                break;
                            }
                        }
                    }
                }
            }

            foreach (XElement child in packageNode.Elements())
            {

                if (child.Name.LocalName.CompareTo("packagedElement") == 0 || child.Name.LocalName.CompareTo("ownedMember") == 0)
                {
                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null)
                        attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                    //     file.WriteLine("Child : " + child.Name.LocalName); file.Flush();
                    //     file.WriteLine("Type : " + attr.Value); file.Flush();

                    //Debug.Log("ATTR : " + attr.Name + " == " + attr.Value);
                    if (attr != null && attr.Value.CompareTo("uml:Package") == 0)
                        addPackage(child, pkg);

                }
            }

            foreach (XElement child in packageNode.Elements())
            {

                if (child.Name.LocalName.CompareTo("packagedElement") == 0 || child.Name.LocalName.CompareTo("ownedMember") == 0)
                {
                    string childType = "";

                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                    if (attr != null) childType = attr.Value;

                    if (childType.CompareTo("uml:SignalEvent") == 0)
                        addSignalEvent(child, pkg);
                    if (childType.CompareTo("uml:CallEvent") == 0)
                        addCallEvent(child, pkg);
                    if (childType.CompareTo("uml:ChangeEvent") == 0)
                        addChangeEvent(child, pkg);
                    if (childType.CompareTo("uml:TimeEvent") == 0)
                        addTimeEvent(child, pkg);
                }
            }

            foreach (XElement child in packageNode.Elements())
            {

                if (child.Name.LocalName.CompareTo("packagedElement") == 0 || child.Name.LocalName.CompareTo("ownedMember") == 0)
                {
                    string childType = "";

                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                    if (attr != null) childType = attr.Value;

                    if (childType.CompareTo("uml:Class") == 0 || childType.CompareTo("uml:Interface") == 0)
                        addClass(child, pkg);
                    else if (childType.CompareTo("Activity") == 0)
                        _activities.Add(new KeyValuePair<XNode, Package>(child, pkg));
                    //addActivity(child,pkg);
                    else if (childType.CompareTo("StateMachine") == 0)//StateMachine
                        _stateMachines.Add(new KeyValuePair<XNode, Package>(child, pkg));
                    //addStateMachine(child,pkg);
                }
            }

            foreach (XElement child in packageNode.Elements())
            {
                if (child.Name.LocalName.CompareTo("packagedElement") == 0 || child.Name.LocalName.CompareTo("ownedMember") == 0)
                {
                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");

                    if (attr != null && attr.Value.CompareTo("uml:Association") == 0)
                    {
                        XAttribute id = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}id");
                        if (id != null)
                        {
                            if (_idAsso.ContainsKey(id.Value))
                            {
                                XElement owned = child.Element("ownedEnd");
                                if (owned != null)
                                {
                                    XElement clElement = _idAsso[id.Value][0].Value;
                                    XAttribute typeA = clElement.Attribute("type");
                                    Class cl = _idClass[typeA.Value];
                                    _idAsso[id.Value].Add(new KeyValuePair<Class, XElement>(cl, owned));

                                }
                            }
                        }
                    }
                }
            }

            foreach (XElement child in packageNode.Elements())
            {
                if (child.Name.LocalName.CompareTo("packagedElement") == 0 || child.Name.LocalName.CompareTo("ownedMember") == 0)
                {
                    XAttribute attr = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");

                    if (attr != null && attr.Value.CompareTo("uml:Collaboration") == 0)
                    {
                        addOrganisationalStructure(child);
                    }
                }
            }

            //add signals
            //Debug.Log ("ADDING SIG IN PKG : " + pkg.getFullName());
            foreach (Signal itSig in _signals.Values)
            {   //Debug.Log(" ----> Signal : " + itSig);
                pkg.addSignals(itSig);
            }
            //_signals.clear();

            // Bouml preserved body end 0001F567
        }
Exemple #6
0
        public void addTimeEvent(XElement timeNode, Package pkg)
        {
            string type;

            type = timeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value;
            if (type == null) type = timeNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type").Value;

            if (type != "uml:TimeEvent")
            {
                return;
            }

            string id = timeNode.Attribute("id").Value;

            TimeEvent timeEvent = new TimeEvent(id);

            XElement when = timeNode.Element("when");
            if (when != null && when.Element("expr") != null)
            {
                string timeExp = when.Element("expr").Attribute("value").Value;
                LiteralReal time = new LiteralReal(timeExp);
                timeEvent.When = time;
            }
            /* add in package*/
            _events.Add(id, timeEvent);
        }
Exemple #7
0
 public void addActivity(XNode activityNode, Package pkg)
 {
 }
Exemple #8
0
 //TODO ajout après le reste
 public void addStateMachine(XNode smNode, Package pkg)
 {
 }
Exemple #9
0
        public void addSignalEvent(XElement signalNode, Package pkg)
        {
            // Bouml preserved body begin 0001F5E7

            string type = "", className = "", id = "";

            XAttribute attr = (XAttribute)signalNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
            if (attr == null) attr = (XAttribute)signalNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type");

            if (attr != null) type = attr.Value;

            attr = (XAttribute)signalNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id");
            if (attr == null) attr = (XAttribute)signalNode.Attribute("{http://www.omg.org/spec/XMI/20131001}id");

            if (attr != null) id = attr.Value;

            attr = (XAttribute)signalNode.Attribute("name");
            if (attr != null) className = attr.Value;

            if (type.CompareTo("uml:SignalEvent") != 0)
            {
                //Debug.Log(className + " is a " + type + " and must be a signal");
                return;
            }

            SignalEvent signalEvent = new SignalEvent(className);

            attr = (XAttribute)signalNode.Attribute("signal");
            if (attr != null)
            {
                if (_signals.ContainsKey(attr.Value))
                {
                    Signal sig = _signals[attr.Value];
                    signalEvent.SignalClass = _signals[attr.Value];
                }

            }

            _events.Add(id, signalEvent);

            // Bouml preserved body end 0001F5E7
        }
Exemple #10
0
        public void addSignal(XElement signalNode, Package pkg)
        {
            // Bouml preserved body begin 0001F5E7

            //  StreamWriter file = new StreamWriter("signal.txt");

            string type = "", className = "", id = "";

            XAttribute attr = (XAttribute)signalNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
            if (attr == null) attr = (XAttribute)signalNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type");

            if (attr != null) type = attr.Value;

            attr = (XAttribute)signalNode.Attribute("name");
            if (attr != null) className = attr.Value;

            if (type.CompareTo("uml:Signal") != 0)
            {
                //Debug.Log( className + " is a " + type + " and must be a signal");
                return;
            }

            attr = (XAttribute)signalNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id");
            if (attr == null) attr = (XAttribute)signalNode.Attribute("{http://www.omg.org/spec/XMI/20131001}id");

            if (attr != null) id = attr.Value;

            //Debug.Log( " ############## Add Signal : " + className );

            Signal signal = new Signal(className);

            //    file.WriteLine("Signal : " + className); file.Flush();
            //    file.Close();
            if (_signals.ContainsKey(id)) return;
            _signals.Add(id, signal);

            if (pkg != null)
                pkg.addSignals(signal);
            signal.Description = getComment(signalNode);
            signal.Summary = getSummary(signalNode);
            signal.Tags = getTags(signalNode);

            foreach (XElement child in signalNode.Elements())
            {
                string childName = child.Name.LocalName;

                if (childName.CompareTo("ownedOperation") == 0)
                    addOperation(child, signal);
                else if (childName.CompareTo("ownedAttribute") == 0)
                {
                    //Debug.Log( "AddAttribute SIGNAL" );
                    addAttribute(child, signal);
                }
            }

            foreach (XElement child in signalNode.Elements())
            {
                string childName = child.Name.LocalName;

                XAttribute attr2 = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                if (attr == null) attr = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");

                if (attr2 != null)
                {
                    if (childName.CompareTo("ownedBehavior") == 0)
                    {
                        if (attr2.Value.CompareTo("uml:StateMachine") == 0)
                            addStateMachineToClass(child, signal);
                    }
                    else if (childName.CompareTo("nestedClassifier") == 0)
                    {
                        if (attr2.Value.CompareTo("uml:StateMachine") == 0)
                            addStateMachineToClass(child, signal);
                    }
                }
            }
            // Bouml preserved body end 0001F5E7
        }
Exemple #11
0
        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
        }
Exemple #12
0
        public void addChangeEvent(XElement changeNode, Package pkg)
        {
            string type = "";

            if (changeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type") != null)
                type = changeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value;
            else if (changeNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type") != null)
                type = changeNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type").Value;

            MascaretApplication.Instance.VRComponentFactory.Log("Type = " + type);
            if (type != "uml:ChangeEvent")
            {
                return;
            }

            string id = "";
            if (changeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id") != null)
                id = changeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id").Value;
            else if (changeNode.Attribute("{http://www.omg.org/spec/XMI/20131001}id") != null)
                id = changeNode.Attribute("{http://www.omg.org/spec/XMI/20131001}id").Value;

            ChangeEvent changeEvent = new ChangeEvent(id);

            if (changeNode.Element("changeExpression") != null)
            {
                MascaretApplication.Instance.VRComponentFactory.Log("New Change Event : " + id);

                string changeExp = changeNode.Element("changeExpression").Attribute("value").Value;

                Expression exp = new Expression(changeExp, this.Model.BasicTypes["boolean"]);
                changeEvent.ChangeExpression = exp;
            }
            /* add in package*/
            _events.Add(id, changeEvent);
        }
Exemple #13
0
        public void addClassesFromPackage(Package p)
        {
            foreach (Class cl in p.Classes.Values)
            {
                allClassesFullName.Add(cl.getFullName(), cl);
                if (!allClasses.ContainsKey(cl.name))
                    allClasses.Add(cl.name, new List<Class>());

                allClasses[cl.name].Add(cl);
            }
            foreach (Package p2 in p.Packages.Values)
                addClassesFromPackage(p2);
        }
Exemple #14
0
 public void addPackages(Package element)
 {
     packages.Add(element.name, element);
     element.ParentPackage = this;
 }