~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Parser/ProjectDomStats.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// ProjectDomStats.cs
 
3
//  
 
4
// Author:
 
5
//       Lluis Sanchez Gual <lluis@novell.com>
 
6
// 
 
7
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
 
8
// 
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
 
 
27
using System.Collections.Generic;
 
28
using System.IO;
 
29
 
 
30
namespace MonoDevelop.Projects.Dom.Parser
 
31
{
 
32
        class ProjectDomStats
 
33
        {
 
34
                public int ClassEntries;
 
35
                public int LoadedClasses;
 
36
                public int ReturnTypes;
 
37
                public int ReturnTypeParts;
 
38
                public int ClassesWithUnsharedReturnTypes;
 
39
                public int UnsharedReturnTypes;
 
40
                public List<string> UnsharedReturnTypesDetail;
 
41
                public int Parameters;
 
42
                public int Methods;
 
43
                public int Properties;
 
44
                public int Fields;
 
45
                public int Attributes;
 
46
                public int Events;
 
47
                public int InstantiatedTypes;
 
48
                
 
49
                public void Add (ProjectDomStats s)
 
50
                {
 
51
                        ClassEntries += s.ClassEntries;
 
52
                        LoadedClasses += s.LoadedClasses;
 
53
                        ReturnTypes += s.ReturnTypes;
 
54
                        ReturnTypeParts += s.ReturnTypeParts;
 
55
                        ClassesWithUnsharedReturnTypes += s.ClassesWithUnsharedReturnTypes;
 
56
                        UnsharedReturnTypes += s.UnsharedReturnTypes;
 
57
                        Parameters += s.Parameters;
 
58
                        Methods += s.Methods;
 
59
                        Properties += s.Properties;
 
60
                        Fields += s.Fields;
 
61
                        Attributes += s.Attributes;
 
62
                        Events += s.Events;
 
63
                        InstantiatedTypes += s.InstantiatedTypes;
 
64
                }
 
65
                
 
66
                public void Dump (TextWriter tw, string indent)
 
67
                {
 
68
                        tw.WriteLine (indent + "Class entries: " + ClassEntries);
 
69
                        tw.WriteLine (indent + "Loaded classes: " + LoadedClasses);
 
70
                        tw.WriteLine (indent + "Instantiated types: " + InstantiatedTypes);
 
71
                        tw.WriteLine (indent + "Return types: " + ReturnTypes);
 
72
                        tw.WriteLine (indent + "Return type parts: " + ReturnTypeParts);
 
73
                        tw.WriteLine (indent + "Classes with unshared RTs: " + ClassesWithUnsharedReturnTypes);
 
74
                        tw.WriteLine (indent + "Unshared RTs: " + UnsharedReturnTypes);
 
75
                        tw.WriteLine (indent + "Methods: " + Methods);
 
76
                        tw.WriteLine (indent + "Parameters: " + Parameters);
 
77
                        tw.WriteLine (indent + "Properties: " + Properties);
 
78
                        tw.WriteLine (indent + "Fields: " + Fields);
 
79
                        tw.WriteLine (indent + "Attributes: " + Attributes);
 
80
                        tw.WriteLine (indent + "Events: " + Events);
 
81
                        
 
82
                        if (UnsharedReturnTypesDetail != null && UnsharedReturnTypesDetail.Count > 0) {
 
83
                                tw.WriteLine (indent + "Unshared RTs (first 10):");
 
84
                                foreach (var s in UnsharedReturnTypesDetail)
 
85
                                        tw.WriteLine (indent + "  " + s);
 
86
                        }
 
87
                }
 
88
        }
 
89
}