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


C# INode.Equals方法代码示例

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


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

示例1: CheckCircularReference

 /// <summary>
 /// Checks for circular references and throws an error if there is one
 /// </summary>
 /// <param name="a">Object you are attempting to load</param>
 /// <param name="b">Object being referenced</param>
 /// <param name="property">QName for the property that makes the reference</param>
 /// <remarks>
 /// <para>
 /// If the Object you are trying to load and the Object you need to load are equal then this is a circular reference and an error is thrown
 /// </para>
 /// <para>
 /// The <see cref="ConfigurationLoader">ConfigurationLoader</see> is not currently capable of detecting more subtle circular references
 /// </para>
 /// </remarks>
 public static bool CheckCircularReference(INode a, INode b, String property)
 {
     if (a.Equals(b))
     {
         throw new DotNetRdfConfigurationException("Unable to load the Object identified by the Node '" + a.ToString() + "' as one of the values for the " + property + " property is a circular reference to the Object we are attempting to load");
     }
     else
     {
         return false;
     }
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:25,代码来源:ConfigurationLoader.cs

示例2: NodeMatch

 private static bool NodeMatch(INode expectedNode, INode actualNode, Dictionary<string, string> bnodeMap)
 {
     if (expectedNode is IBlankNode && actualNode is IUriNode)
     {
         var actualUriNode = actualNode as IUriNode;
         var expectedBNode = expectedNode as IBlankNode;
         if (bnodeMap.ContainsKey(actualUriNode.Uri.ToString()))
         {
             return expectedBNode.InternalID.Equals(bnodeMap[actualUriNode.Uri.ToString()]);
         }
         return true;
     }
     if (expectedNode is IBlankNode && actualNode is IBlankNode)
     {
         var ebNode = expectedNode as IBlankNode;
         var abNode = actualNode as IBlankNode;
         if (bnodeMap.ContainsKey(abNode.InternalID))
         {
             return ebNode.InternalID.Equals(bnodeMap[abNode.InternalID]);
         }
         return true; // ebNode.InternalID.Equals(abNode.InternalID);
     }
     if (!expectedNode.NodeType.Equals(actualNode.NodeType)) return false;
     return expectedNode.Equals(actualNode);
 }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:25,代码来源:SparqlTest.cs

示例3: OtherEnd

 /// <inheritdoc />
 public IVNode OtherEnd(INode node)
 {
     if (!node.Equals(To) && !node.Equals(From))
         throw new Exception("Cannot return other end. Parameter 'node' must be connected to link.");
     return From.Equals(node) ? To : From;
 }
开发者ID:JohnMcCaffery,项目名称:RoutingIsland,代码行数:7,代码来源:VLink.cs

示例4: Inequality

        /// <summary>
        /// Implements Node Inequality with SPARQL Semantics
        /// </summary>
        /// <param name="x">Node</param>
        /// <param name="y">Node</param>
        /// <returns></returns>
        public static bool Inequality(INode x, INode y)
        {
            if (x == null || y == null)
            {
                //Nulls can't be equal to each other
                throw new RdfQueryException("Cannot evaluate inequality when one/both arguments are null");
            }
            else if (x.NodeType != y.NodeType)
            {
                //Different Type Nodes are never equal to each other
                return true;
            }
            else if (x.NodeType == NodeType.Literal)
            {
                //Do they have supported Data Types?
                String xtype, ytype;
                try
                {
                    xtype = XmlSpecsHelper.GetSupportedDataType(x);
                    ytype = XmlSpecsHelper.GetSupportedDataType(y);
                }
                catch (RdfException)
                {
                    //Can't determine a Data Type for one/both of the Nodes so use RDF Term equality instead
                    return !x.Equals(y);
                }

                if (xtype.Equals(String.Empty) || ytype.Equals(String.Empty))
                {
                    //One/both has an unknown type
                    if (x.Equals(y))
                    {
                        //If RDF Term equality returns true then we return false
                        return false;
                    }
                    else
                    {
                        //If RDF Term equality returns false then we error
                        throw new RdfQueryException("Unable to determine inequality since one/both arguments has an Unknown Type");
                    }
                }
                else
                {
                    //Both have known types
                    SparqlNumericType xnumtype = GetNumericTypeFromDataTypeUri(xtype);
                    SparqlNumericType ynumtype = GetNumericTypeFromDataTypeUri(ytype);
                    SparqlNumericType numtype = (SparqlNumericType)Math.Max((int)xnumtype, (int)ynumtype);
                    if (numtype != SparqlNumericType.NaN)
                    {
                        if (xnumtype == SparqlNumericType.NaN || ynumtype == SparqlNumericType.NaN)
                        {
                            //If one is non-numeric then we can't assume non-equality
                            return false;
                        }

                        //Both are Numeric so use Numeric equality
                        try
                        {
                            return !NumericEquality(x, y, numtype);
                        }
                        catch (FormatException)
                        {
                            if (x.Equals(y)) return false;
                            return false;
                        }
                        catch (RdfQueryException)
                        {
                            //If this errors try RDF Term equality since 
                            return !x.Equals(y);
                        }
                    }
                    else if (xtype.Equals(ytype))
                    {
                        switch (xtype)
                        {
                            case XmlSpecsHelper.XmlSchemaDataTypeDate:
                                return !DateEquality(x, y);
                            case XmlSpecsHelper.XmlSchemaDataTypeDateTime:
                                return !DateTimeEquality(x, y);
                            case XmlSpecsHelper.XmlSchemaDataTypeDuration:
                                return !TimeSpanEquality(x, y);
                            case XmlSpecsHelper.XmlSchemaDataTypeString:
                                //Both Strings so use Lexical string equality
                                return !((ILiteralNode)x).Value.Equals(((ILiteralNode)y).Value);
                            default:
                                //Use value equality
                                return (x.CompareTo(y) != 0);
                        }
                    }
                    else
                    {
                        String commontype = XmlSpecsHelper.GetCompatibleSupportedDataType(xtype, ytype);
                        if (commontype.Equals(String.Empty))
                        {
//.........这里部分代码省略.........
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:101,代码来源:SPARQLSpecsHelper.cs

示例5: OnNodeUpdated

        private void OnNodeUpdated(INode node)
        {
            if (!node.Equals(Source)){
                throw new ArgumentException("Received updated callback for wrong node");
            }

            Source.Updated -= OnNodeUpdated;

            foreach (var child in ((IFolder)node).Children) {
                ITransfer t = Transfers.CreateTransfer(child, Path.Combine(Destination, child.Name), 0);
                SubTransfers.Add(t);
            }

            if (startCalled) {
                Download();
            } else {
                Status = Status.Pending;
                listingDone = true;
            }
        }
开发者ID:karlbohlmark,项目名称:SharpWired,代码行数:20,代码来源:FolderTransfer.cs


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