当前位置: 首页>>代码示例>>C#>>正文


C# IObject.get方法代码示例

本文整理汇总了C#中IObject.get方法的典型用法代码示例。如果您正苦于以下问题:C# IObject.get方法的具体用法?C# IObject.get怎么用?C# IObject.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObject的用法示例。


在下文中一共展示了IObject.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetName

        public string GetName(IObject element)
        {
            // Returns the name by the uml logic.
            var dataLayer = _dataLayerLogic?.GetDataLayerOfObject(element);
            var metaLayer = _dataLayerLogic?.GetMetaLayerFor(dataLayer);
            var uml = _dataLayerLogic?.Get<_UML>(metaLayer);
            if (uml != null && element.isSet(_UML._CommonStructure._NamedElement.name))
            {
                var result = element.get(_UML._CommonStructure._NamedElement.name);
                if (result != null)
                {
                    return result.ToString();
                }
            }

            // If the element is not uml induced or the property is empty, check by
            // the default "name" property
            if (element.isSet("name"))
            {
                return element.get("name").ToString();
            }

            // Ok, finally, we don't know what to do, so request retrieve the name just via ToString
            return element.ToString();
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:25,代码来源:UmlNameResolution.cs

示例2: IsProperty

        public bool IsProperty(IObject element)
        {
            var attributeXmi = "{" + Namespaces.Xmi + "}type";

            return element.isSet(attributeXmi) &&
                   element.get(attributeXmi).ToString() == "uml:Property";
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:7,代码来源:XmiSourceParser.cs

示例3: GetSubProperties

        public static IEnumerable<IObject> GetSubProperties(IObject element)
        {
            var elementAsExt = (IObjectAllProperties)element;
            if (elementAsExt == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            foreach (var property in elementAsExt.getPropertiesBeingSet())
            {
                var propertyValue = element.get(property);
                var propertyAsEnumerable = propertyValue as IEnumerable;
                if (propertyAsEnumerable != null)
                {
                    foreach (var innerValue in propertyAsEnumerable)
                    {
                        var innerValueAsObject = innerValue as IObject;
                        if (innerValueAsObject != null)
                        {
                            yield return innerValueAsObject;
                        }
                    }
                }
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:25,代码来源:Helper.cs

示例4: getDescendents

        /// <summary>
        ///     Gets all descendents of an object, but does not
        ///     return this object itself
        /// </summary>
        /// <param name="element">Element being queried</param>
        /// <returns>An enumeration of all object and its descendents</returns>
        public static IEnumerable<IObject> getDescendents(IObject element)
        {
            var elementAsIObjectExt = element as IObjectAllProperties;
            if (elementAsIObjectExt == null)
            {
                throw new InvalidOperationException("element is not of type IObjectExt");
            }

            foreach (var property in elementAsIObjectExt.getPropertiesBeingSet())
            {
                var value = element.get(property);
                if (value is IObject)
                {
                    // Value is an object... perfect!
                    yield return value as IObject;
                }

                if (value is IEnumerable && value.GetType() != typeof (string))
                {
                    // Value is a real enumeration. Unfortunately strings are also
                    // enumeration, but we would like to skip them. Their content
                    // would be skipped either.
                    var valueAsEnumerable = value as IEnumerable;
                    foreach (var innerValue in getDescendents(valueAsEnumerable))
                    {
                        yield return innerValue;
                    }
                }
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:36,代码来源:AllDescendentsQuery.cs

示例5: GetName

        public static string GetName(IObject value)
        {
            if (value.isSet("name"))
            {
                return value.get("name").ToString();
            }

            return null;
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:9,代码来源:UmlHelper.cs

示例6: WalkProperty

        protected override void WalkProperty(IObject propertyObject, CallStack stack)
        {
            base.WalkProperty(propertyObject, stack);

            var nameAsObject = propertyObject.get("name");
            var name = nameAsObject == null ? string.Empty : nameAsObject.ToString();
            if (name != null)
            {
                Result.AppendLine($"{stack.Indentation}public static string @{name} = \"{name}\";");
                Result.AppendLine($"{stack.Indentation}public IElement _{name} = null;");
                Result.AppendLine();
            }
            else
            {
                Debug.WriteLine($"Found unknown property: {propertyObject}");
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:17,代码来源:ClassTreeGenerator.cs

示例7: ConvertToJson

        /// <summary>
        /// Converts a given element to a json string, dependent on the column definition as given by the 
        /// ColumnCreationResult
        /// </summary>
        /// <param name="element"></param>
        /// <param name="creatorResult"></param>
        /// <returns></returns>
        private Dictionary<string, object> ConvertToJson(IObject element, ColumnCreationResult creatorResult)
        {
            var result = new Dictionary<string, object>();

            foreach (var property in creatorResult.Properties
                .Where(property => element.isSet(property)))
            {
                var propertyAsString = ColumnCreator.ConvertPropertyToColumnName(property);

                var propertyValue = element.get(property);

                if (creatorResult.ColumnsOnProperty[property].isEnumeration)
                {
                    if (propertyValue is IEnumerable && !(propertyValue is string))
                    {
                        var list = new List<object>();
                        foreach (var listValue in (propertyValue as IEnumerable))
                        {
                            var asElement = listValue as IElement;
                            string url;
                            if (asElement != null)
                            {
                                url = asElement.GetUri();
                            }
                            else
                            {
                                url = null;
                            }

                            list.Add(new
                            {
                                u = url,
                                v = listValue == null ? "null" : _resolution.GetName(listValue)
                            });
                        }

                        result[propertyAsString] = list;
                    }
                    else
                    {
                        result[propertyAsString] = propertyValue == null ? "null" : _resolution.GetName(propertyValue);
                    }
                }
                else
                {
                    result[propertyAsString] = propertyValue == null ? "null" : _resolution.GetName(propertyValue);
                }
            }

            return result;
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:58,代码来源:ExtentController.cs

示例8: GetNameOfElement

 protected static string GetNameOfElement(IObject element)
 {
     var nameAsObject = element.get("name");
     var name = nameAsObject == null ? string.Empty : nameAsObject.ToString();
     return name;
 }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:6,代码来源:WalkPackageClass.cs

示例9: XmlGetElementsOfTypes

        /// <summary>
        /// Gets all elements of a specific type in the proeprty
        /// </summary>
        /// <param name="element">Element, whose property is queried </param>
        /// <param name="typeNames">Type names to be queried</param>
        /// <returns>Enumeration of all elements</returns>
        private static IEnumerable<IObject> XmlGetElementsOfTypes(IObject element, IEnumerable<string> typeNames)
        {
            var elementAsExt = (IObjectAllProperties) element;
            if (elementAsExt == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            var attributeXmi = "{" + Namespaces.Xmi + "}type";
            var typeNamesList = typeNames.ToList();

            foreach (var property in elementAsExt.getPropertiesBeingSet())
            {
                var propertyValue = element.get(property);
                var propertyAsEnumerable = propertyValue as IEnumerable;
                foreach (var innerValue in propertyAsEnumerable)
                {
                    var innerValueAsObject = innerValue as IObject;
                    if (innerValueAsObject != null && innerValueAsObject.isSet(attributeXmi))
                    {
                        var type = innerValueAsObject.get(attributeXmi).ToString();
                        if (typeNamesList.Count(x => type == x) > 0)
                        {
                            yield return innerValueAsObject;
                        }
                    }
                }
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:35,代码来源:Helper.cs


注:本文中的IObject.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。