Clover.NET coverage report - Coverage for s2container.net

Coverage timestamp: 2006年5月30日 11:21:29

File Stats: LOC: 142   Methods: 8
NCLOC: 78 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Framework.Container\Util\MetaDefSupport.cs 83.3% 95.8% 100.0% 93.2%
coverage coverage
1   #region Copyright
2   /*
3   * Copyright 2005 the Seasar Foundation and the Others.
4   *
5   * Licensed under the Apache License, Version 2.0 (the "License");
6   * you may not use this file except in compliance with the License.
7   * You may obtain a copy of the License at
8   *
9   * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14   * either express or implied. See the License for the specific language
15   * governing permissions and limitations under the License.
16   */
17   #endregion
18  
19   using System;
20   using System.Collections;
21  
22   namespace Seasar.Framework.Container.Util
23   {
24   /// <summary>
25   /// IMetaDefの設定をサポートします
26   /// </summary>
27   public sealed class MetaDefSupport
28   {
29  
30   private IList metaDefs_ = ArrayList.Synchronized(new ArrayList());
31   private IS2Container container_;
32  
33   /// <summary>
34   /// コンストラクタ
35   /// </summary>
36 1441 public MetaDefSupport()
37   {
38   }
39  
40   /// <summary>
41   /// コンストラクタ
42   /// </summary>
43   /// <param name="container">S2Container</param>
44 250 public MetaDefSupport(IS2Container container)
45   {
46 250 this.Container = container;
47   }
48  
49   /// <summary>
50   /// IMetaDefを追加します。
51   /// </summary>
52   /// <param name="metaDef"></param>
53 5 public void AddMetaDef(IMetaDef metaDef)
54   {
55 5 if(container_ != null)
56   {
57 1 metaDef.Container = container_;
58   }
59 5 metaDefs_.Add(metaDef);
60   }
61  
62   /// <summary>
63   /// IMetaDefの数
64   /// </summary>
65   public int MetaDefSize
66   {
67 2 get
68   {
69 2 return metaDefs_.Count;
70   }
71   }
72  
73   /// <summary>
74   /// 番号を指定してIMetaDefを取得します。
75   /// </summary>
76   /// <param name="index"></param>
77   /// <returns>IMetaDef</returns>
78 1 public IMetaDef GetMetaDef(int index)
79   {
80 1 return (IMetaDef) metaDefs_[index];
81   }
82  
83   /// <summary>
84   /// 名前を指定してIMetaDefを取得します。
85   /// </summary>
86   /// <param name="name">IMetaDefの名前</param>
87   /// <returns>IMetaDef</returns>
88 1 public IMetaDef GetMetaDef(string name)
89   {
90 1 IEnumerator enu = metaDefs_.GetEnumerator();
91 1 while(enu.MoveNext())
92   {
93 1 IMetaDef metaDef = (IMetaDef)enu.Current;
94 1 if((name == null && metaDef.Name == null) || name != null
95   && name.ToLower().CompareTo(metaDef.Name.ToLower()) == 0)
96   {
97 1 return metaDef;
98   }
99   }
100 0 return null;
101   }
102  
103   /// <summary>
104   /// 名前を指定してIMetaDefの配列を取得します。
105   /// </summary>
106   /// <param name="name">IMetaDefの名前</param>
107   /// <returns>IMetaDefの配列</returns>
108 1 public IMetaDef[] GetMetaDefs(string name)
109   {
110 1 ArrayList defs = new ArrayList();
111 1 IEnumerator enu = metaDefs_.GetEnumerator();
112 4 while(enu.MoveNext())
113   {
114 3 IMetaDef metaDef = (IMetaDef)enu.Current;
115 3 if((name == null && metaDef.Name == null) || name != null
116   && name.ToLower().CompareTo(metaDef.Name.ToLower()) == 0)
117   {
118 2 defs.Add(metaDef);
119   }
120   }
121 1 return (IMetaDef[]) defs.ToArray(typeof(IMetaDef));
122   }
123  
124   /// <summary>
125   /// S2Container
126   /// </summary>
127   public IS2Container Container
128   {
129 2482 set
130   {
131 2482 container_ = value;
132 2482 IEnumerator enu = metaDefs_.GetEnumerator();
133 2483 while(enu.MoveNext())
134   {
135 1 IMetaDef metaDef = (IMetaDef)enu.Current;
136 1 metaDef.Container = value;
137   }
138   }
139   }
140   }
141   }
142