public void ParseComponent(InterfaceObject parentInterface, AtlasFeature feature)
        {
            Component comp = new Component(feature.Name);

            this.bragi.AddComponent(comp);

            if (parentInterface != null)
            {
                Socket so = new Socket(comp, parentInterface, (++counter).ToString());
                bragi.AddSocket(so);
            }

            foreach (AtlasFeature fchild in this.model.GetChildren(feature))
            {
                if (fchild.IsAbstract)
                {
                    this.ParseInterface(comp, fchild);
                }
                else
                {
                    string          iname = (++counter).ToString();
                    InterfaceObject o     = new InterfaceObject(iname, comp);
                    this.bragi.AddInterface(o);

                    SMarty m = new SMarty((++counter).ToString(), SMartyBindingTimeTypes.CompileTime, o);
                    this.bragi.AddAttachment(m);

                    this.ParseComponent(o, fchild);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Adds Interface to Danu. Adds its name, minVar, maxVar and bindingTime.
        /// </summary>
        public void AddInterface(InterfaceObject io)
        {
            SMartyBindingTimeTypes bindingTime    = default(SMartyBindingTimeTypes);
            DanuBindingTime        newBindingTime = default(DanuBindingTime);
            SMarty attach = null;

            foreach (IAttachment attachment in io.Attachments)
            {
                if (attachment.GetType().Equals(typeof(SMarty)))
                {
                    attach = (SMarty)attachment;
                }
            }

            int minVar = attach.MinSelection;
            int maxVar = attach.MaxSelection;

            foreach (IAttachment attachment in io.Attachments)
            {
                if (attachment.GetType().Equals(typeof(SMarty)))
                {
                    SMarty smarty = (SMarty)attachment;
                    bindingTime = smarty.BindingTime;
                    minVar      = smarty.MinSelection;
                    maxVar      = smarty.MaxSelection;
                    break;
                }
            }

            if (!bindingTime.Equals(default(SMartyBindingTimeTypes)))
            {
                switch (bindingTime)
                {
                case SMartyBindingTimeTypes.CompileTime:
                    newBindingTime = DanuBindingTime.CompileTime;
                    break;

                case SMartyBindingTimeTypes.LinkingTime:
                    newBindingTime = DanuBindingTime.LinkingTime;
                    break;

                case SMartyBindingTimeTypes.Runtime:
                    newBindingTime = DanuBindingTime.Runtime;
                    break;

                case SMartyBindingTimeTypes.UpdateTime:
                    newBindingTime = DanuBindingTime.UpdateTime;
                    break;
                }
            }

            DanuInterfaceObject newInterface = new DanuInterfaceObject(io.Name, newBindingTime, minVar, maxVar);

            interfaces.Add(newInterface.Name, newInterface);
        }
        public void ParseInterface(Component parentComponent, AtlasFeature feature)
        {
            string iname = (++counter).ToString();

            InterfaceObject o = new InterfaceObject(iname, parentComponent);

            this.bragi.AddInterface(o);

            SMarty m = new SMarty((++counter).ToString(), SMartyBindingTimeTypes.CompileTime, o);

            this.bragi.AddAttachment(m);

            foreach (AtlasFeature child in this.model.GetChildren(feature))
            {
                this.ParseComponent(o, child);
            }
        }