Пример #1
0
        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::Ufba.Ev.Option)
                {
                    if (target is global::Ufba.Ev.Function)
                    {
                        global::Ufba.Ev.Option   sourceAccepted = (global::Ufba.Ev.Option)source;
                        global::Ufba.Ev.Function targetAccepted = (global::Ufba.Ev.Function)target;
                        DslModeling::ElementLink result         = new global::Ufba.Ev.OptionHasFunctions(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();
        }
Пример #2
0
        internal static global::System.Collections.IList GetElementsFromOptionForProperties(DslModeling::ModelElement rootElement)
        {
            global::Ufba.Ev.Option root = (global::Ufba.Ev.Option)rootElement;
            // Segments 0 and 1
            DslModeling::LinkedElementCollection <global::Ufba.Ev.Property> result = root.Properties;

            return(result);
        }
Пример #3
0
 internal static global::System.Collections.ICollection GetOptionForOptionShapeProperties(global::Ufba.Ev.Property root)
 {
     // Segments 1 and 0
     global::Ufba.Ev.Option result = root.Option;
     if (result == null)
     {
         return(new DslModeling::ModelElement[0]);
     }
     return(new DslModeling::ModelElement[] { result });
 }
Пример #4
0
 internal static global::System.Collections.ICollection GetOptionForOptionShapeActionsFromLastLink(global::Ufba.Ev.OptionHasTypes root)
 {
     // Segment 0
     global::Ufba.Ev.Option result = root.Option;
     if (result == null)
     {
         return(new DslModeling::ModelElement[0]);
     }
     return(new DslModeling::ModelElement[] { result });
 }
Пример #5
0
 public static global::Ufba.Ev.EvModel GetParentForOption(global::Ufba.Ev.Option root)
 {
     // Segments 0 and 1
     global::Ufba.Ev.EvModel result = root.EvModel;
     if (result == null)
     {
         return(null);
     }
     return(result);
 }
Пример #6
0
 public static global::Ufba.Ev.EvModel GetParentForFunction(global::Ufba.Ev.Function root)
 {
     // Segments 0 and 1
     global::Ufba.Ev.Option root2 = root.Option;
     if (root2 == null)
     {
         return(null);
     }
     // Segments 2 and 3
     global::Ufba.Ev.EvModel result = root2.EvModel;
     if (result == null)
     {
         return(null);
     }
     return(result);
 }
Пример #7
0
        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::Ufba.Ev.Option)
                {
                    if (candidateTarget is global::Ufba.Ev.Function)
                    {
                        global::Ufba.Ev.Option   sourceOption   = (global::Ufba.Ev.Option)candidateSource;
                        global::Ufba.Ev.Function targetFunction = (global::Ufba.Ev.Function)candidateTarget;
                        if (targetFunction == null || global::Ufba.Ev.OptionHasFunctions.GetLinkToOption(targetFunction) != null)
                        {
                            return(false);
                        }
                        if (targetFunction == null || sourceOption == null || global::Ufba.Ev.OptionHasFunctions.GetLinks(sourceOption, targetFunction).Count > 0)
                        {
                            return(false);
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }