public static DslModeling::ElementLink Connect(DslModeling::ModelElement source, DslModeling::ModelElement target)
        {
            if (source == null)
            {
                throw new global::System.ArgumentNullException("source");
            }
            if (target == null)
            {
                throw new global::System.ArgumentNullException("target");
            }

            if (CanAcceptSourceAndTarget(source, target))
            {
                if (source is global::Maxsys.VisualLAL.Simbolo)
                {
                    if (target is global::Maxsys.VisualLAL.Simbolo)
                    {
                        global::Maxsys.VisualLAL.Simbolo sourceAccepted = (global::Maxsys.VisualLAL.Simbolo)source;
                        global::Maxsys.VisualLAL.Simbolo targetAccepted = (global::Maxsys.VisualLAL.Simbolo)target;
                        DslModeling::ElementLink         result         = new global::Maxsys.VisualLAL.SimboloReferences(sourceAccepted, targetAccepted);
                        if (DslModeling::DomainClassInfo.HasNameProperty(result))
                        {
                            DslModeling::DomainClassInfo.SetUniqueName(result);
                        }
                        return(result);
                    }
                }
            }
            global::System.Diagnostics.Debug.Fail("Having agreed that the connection can be accepted we should never fail to make one.");
            throw new global::System.InvalidOperationException();
        }
Esempio n. 2
0
        internal static global::System.Collections.IList GetElementsFromSimboloForSinonimoCompartment(DslModeling::ModelElement rootElement)
        {
            global::Maxsys.VisualLAL.Simbolo root = (global::Maxsys.VisualLAL.Simbolo)rootElement;
            // Segments 0 and 1
            DslModeling::LinkedElementCollection <global::Maxsys.VisualLAL.Sinonimo> result = root.Sinonimos;

            return(result);
        }
        public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget)
        {
            // Accepts null, null; source, null; source, target but NOT null, target
            if (candidateSource == null)
            {
                if (candidateTarget != null)
                {
                    throw new global::System.ArgumentNullException("candidateSource");
                }
                else                 // Both null
                {
                    return(false);
                }
            }
            bool acceptSource = CanAcceptSource(candidateSource);

            // If the source wasn't accepted then there's no point checking targets.
            // If there is no target then the source controls the accept.
            if (!acceptSource || candidateTarget == null)
            {
                return(acceptSource);
            }
            else             // Check combinations
            {
                if (candidateSource is global::Maxsys.VisualLAL.Simbolo)
                {
                    if (candidateTarget is global::Maxsys.VisualLAL.Simbolo)
                    {
                        global::Maxsys.VisualLAL.Simbolo sourceSimbolo = (global::Maxsys.VisualLAL.Simbolo)candidateSource;
                        global::Maxsys.VisualLAL.Simbolo targetSimbolo = (global::Maxsys.VisualLAL.Simbolo)candidateTarget;
                        if (targetSimbolo == null || sourceSimbolo == null || global::Maxsys.VisualLAL.SimboloReferences.GetLinks(sourceSimbolo, targetSimbolo).Count > 0)
                        {
                            return(false);
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }