コード例 #1
0
ファイル: MethodNode.cs プロジェクト: nylen/SharpDevelop
		public Relationship GetRelationship(INode node)
		{
			Relationship relationship = new Relationship();
			
			if (node == this) {
				relationship.Relationships.Add(RelationshipType.Same);
				return relationship;
			}

			if (node is NamespaceNode) {
				NamespaceNode ns = (NamespaceNode)node;
				
				foreach (var type in this.GetAllTypes()) {
					if (type != null && type.Namespace == ns) {
						relationship.AddRelationship(RelationshipType.UseThis);
					}
				}
			}
			
			if (node is TypeNode) {
				TypeNode type = (TypeNode)node;
				
				foreach (var usedType in this.GetAllTypes()) {
					if (type == usedType) {
						relationship.AddRelationship(RelationshipType.UseThis);
					}
				}
			}
			
			if (node is MethodNode) {
				MethodNode method = (MethodNode)node;
				
				foreach (var usedMethod in this.GetAllMethods()) {
					if (method == usedMethod) {
						relationship.AddRelationship(RelationshipType.UseThis);
					}
				}
			}
			
			if (node is FieldNode) {
				FieldNode field = (FieldNode)node;
				
				foreach (var usedField in this.GetAllFields()) {
					if (field == usedField) {
						relationship.AddRelationship(RelationshipType.UseThis);
					}
				}
			}

			return relationship;
		}
コード例 #2
0
ファイル: Module.cs プロジェクト: Bombadil77/SharpDevelop
		public Relationship GetRelationship(INode node)
		{
			Relationship relationship = new Relationship();
			return relationship;
		}
コード例 #3
0
        public Relationship GetRelationship(INode node)
        {
            Relationship relationship = new Relationship();

            if (node == this)
            {
                relationship.Relationships.Add(RelationshipType.Same);
                return(relationship);
            }

            if (node is NamespaceNode)
            {
                NamespaceNode ns = (NamespaceNode)node;

                foreach (var type in this.GetAllTypes())
                {
                    if (type != null && type.Namespace == ns)
                    {
                        relationship.AddRelationship(RelationshipType.UseThis);
                    }
                }
            }

            if (node is TypeNode)
            {
                TypeNode type = (TypeNode)node;

                foreach (var usedType in this.GetAllTypes())
                {
                    if (type == usedType)
                    {
                        relationship.AddRelationship(RelationshipType.UseThis);
                    }
                }
            }

            if (node is MethodNode)
            {
                MethodNode method = (MethodNode)node;

                foreach (var usedMethod in this.GetAllMethods())
                {
                    if (method == usedMethod)
                    {
                        relationship.AddRelationship(RelationshipType.UseThis);
                    }
                }
            }

            if (node is FieldNode)
            {
                FieldNode field = (FieldNode)node;

                foreach (var usedField in this.GetAllFields())
                {
                    if (field == usedField)
                    {
                        relationship.AddRelationship(RelationshipType.UseThis);
                    }
                }
            }

            return(relationship);
        }
コード例 #4
0
ファイル: Event.cs プロジェクト: kleinux/SharpDevelop
        public Relationship GetRelationship(INode node)
        {
            Relationship relationship = new Relationship();

            return(relationship);
        }
コード例 #5
0
ファイル: Namespace.cs プロジェクト: Bombadil77/SharpDevelop
        public Relationship GetRelationship(INode node)
        {
        	Relationship relationship = new Relationship();
        	
        	if (node == this) {
        		relationship.Relationships.Add(RelationshipType.Same);
        		return relationship;
        	}
        	
        	if (node is Namespace) {
        		Namespace ns = (Namespace)node;
        		
        		foreach (var type in ns.Types)
        		{
        			if (Types.Contains(type)) {
        		    	relationship.NumberOfOccurrences++;
        		    	relationship.Relationships.Add(RelationshipType.UseThis);
    		    	}
        		}
        	}

        	
        	if (node is Type) {
        		Type type = (Type)node;
        		
        		if (this.Types.Contains(type.BaseType)) {
        		    relationship.NumberOfOccurrences++;
        		    relationship.Relationships.Add(RelationshipType.UseThis);
    		    }
        		
        		foreach (var thisType in type.GenericImplementedInterfacesTypes) {
    		    	if (this.Types.Contains(thisType)) {
    		    		relationship.NumberOfOccurrences++;
    		    		relationship.Relationships.Add(RelationshipType.UseThis);
    		    	}
    		    }
        		
        		foreach (var thisType in type.ImplementedInterfaces) {
    		    	if (this.Types.Contains(thisType)) {
    		    		relationship.NumberOfOccurrences++;
    		    		relationship.Relationships.Add(RelationshipType.UseThis);
    		    	}
    		    }
        		
        		if (this.Types.Contains(type)) {
        		    relationship.Relationships.Add(RelationshipType.Contains);
    		    }
        	}
        	
        	if (node is Method) {
        		Method method = (Method)node;
        		
        		if (this.Types.Contains(method.ReturnType)) {
        		    relationship.NumberOfOccurrences++;
        		    relationship.Relationships.Add(RelationshipType.UseThis);
    		    }
    		    
        		foreach (var type in method.GenericReturnTypes) {
    		    	if (this.Types.Contains(type)) {
    		    		relationship.NumberOfOccurrences++;
    		    		relationship.Relationships.Add(RelationshipType.UseThis);
    		    	}
    		    }
        		
        		foreach (var parameter in method.Parameters) {
        			
        			if (this.Types.Contains(parameter.ParameterType)) {
        				relationship.NumberOfOccurrences++;
    		    		relationship.Relationships.Add(RelationshipType.UseThis);
        			}
        			
        			foreach (var type in parameter.GenericTypes) {
        				if (this.Types.Contains(type)) {
		    				relationship.NumberOfOccurrences++;
				    		relationship.Relationships.Add(RelationshipType.UseThis);
		    			}
        			}
        		}
        		
        		foreach (var type in method.TypeUses) {
        			if (this.Types.Contains(type)) {
	    				relationship.NumberOfOccurrences++;
			    		relationship.Relationships.Add(RelationshipType.UseThis);
	    			}
        		}
        		
        		foreach (var type in method.TypeUses) {
        			if (this.Types.Contains(type)) {
	    				relationship.NumberOfOccurrences++;
			    		relationship.Relationships.Add(RelationshipType.UseThis);
	    			}
        		}
        		
        		foreach (var field in method.FieldUses) {
        			foreach (var type in this.Types) {
        				if (type.Fields.Contains(field)) {
		    				relationship.NumberOfOccurrences++;
				    		relationship.Relationships.Add(RelationshipType.UseThis);
        				}
	    			}
        		}
        		
        		foreach (var meth in method.MethodUses) {
        			foreach (var type in this.Types) {
        				if (type.Methods.Contains(meth)) {
		    				relationship.NumberOfOccurrences++;
				    		relationship.Relationships.Add(RelationshipType.UseThis);
        				}
	    			}
        		}
        		
        		foreach (var type in method.TypeUses) {
        			if (this.Types.Contains(type)) { 
	    				relationship.NumberOfOccurrences++;
			    		relationship.Relationships.Add(RelationshipType.UseThis);
    				}
        				
        		}
        		
        		if (this.Types.Contains(method.DeclaringType))
    		    	relationship.Relationships.Add(RelationshipType.Contains);
        	}
        	
        	if (node is Field) {
        		Field field = (Field)node;
        		if (this.Types.Contains(field.FieldType)) {
        		    relationship.NumberOfOccurrences++;
        		    relationship.Relationships.Add(RelationshipType.UseThis);
    		    }
    		    
    		    foreach (var type in field.GenericTypes) {
    		    	if (this.Types.Contains(type)) {
    		    		relationship.NumberOfOccurrences++;
    		    		relationship.Relationships.Add(RelationshipType.UseThis);
    		    	}
    		    }
    		    
    		    if (this.Types.Contains(field.DeclaringType))
    		    	relationship.Relationships.Add(RelationshipType.Contains);
        	}
        	
        	return relationship;
        }
コード例 #6
0
ファイル: Field.cs プロジェクト: OmerRaviv/SharpDevelop
     public Relationship GetRelationship(INode node)
     {
     	Relationship relationship = new Relationship();
     	
     	if (node == this) {
     		relationship.Relationships.Add(RelationshipType.Same);
     		return relationship;
     	}
     	
     	if (node is Namespace) {
     		Namespace ns = (Namespace)node;
     		
     		foreach (var type in this.GetAllTypes()) {
     			if (type != null && type.Namespace == ns) {
     				relationship.AddRelationship(RelationshipType.UseThis);
     			}
     		}
     	}
     	
     	if (node is Type) {
     		Type type = (Type)node;
     		
     		foreach (var usedType in this.GetAllTypes()) {
     			if (type == usedType) {
     				relationship.AddRelationship(RelationshipType.UseThis);
     			}
     		}
     	}
     	
     	if (node is Field) {
     		Field field = (Field)node;
     		
     		if (this == field) {
 				relationship.AddRelationship(RelationshipType.UseThis);
 			}
     	}
     	
     	return relationship;
     }