Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 119   Methods: 7
NCLOC: 61 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Framework.Container\Util\PropertyDefSupport.cs 62.5% 88.2% 100.0% 84.4%
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   using System.Collections.Specialized;
22  
23   namespace Seasar.Framework.Container.Util
24   {
25   /// <summary>
26   /// IPropertyDefの設定をサポートします。
27   /// </summary>
28   public sealed class PropertyDefSupport
29   {
30   private Hashtable propertyDefs_ = Hashtable.Synchronized(CollectionsUtil.CreateCaseInsensitiveHashtable());
31   private IS2Container container_;
32  
33   /// <summary>
34   /// コンストラクタ
35   /// </summary>
36 791 public PropertyDefSupport()
37   {
38   }
39  
40   /// <summary>
41   /// PropertyDefを追加します。
42   /// </summary>
43   /// <param name="propertyDef">IPropertyDef</param>
44 333 public void AddPropertyDef(IPropertyDef propertyDef)
45   {
46 333 if(container_ != null)
47   {
48 0 propertyDef.Container = container_;
49   }
50 333 propertyDefs_.Add(propertyDef.PropertyName,propertyDef);
51   }
52  
53   /// <summary>
54   /// IPropertyDefの数
55   /// </summary>
56   public int PropertyDefSize
57   {
58 12 get{ return propertyDefs_.Count; }
59   }
60  
61   /// <summary>
62   /// 番号を指定してIPropertyDefを取得します。
63   /// </summary>
64   /// <param name="index">IPropertyDefの番号</param>
65   /// <returns>IPropertyDef</returns>
66 6 public IPropertyDef GetPropertyDef(int index)
67   {
68 6 int i = 0;
69 6 IEnumerator enu = propertyDefs_.Values.GetEnumerator();
70 6 while(enu.MoveNext())
71   {
72 6 if(i++ == index)
73   {
74 6 return (IPropertyDef) enu.Current;
75   }
76   }
77 0 return null;
78   }
79  
80   /// <summary>
81   /// 名前を指定してIPropertyDefを取得します。
82   /// </summary>
83   /// <param name="propertyName">IPropertyDefの名前</param>
84   /// <returns>IPropertyDef</returns>
85 281 public IPropertyDef GetPropertyDef(string propertyName)
86   {
87 281 return (IPropertyDef) propertyDefs_[propertyName];
88   }
89  
90   /// <summary>
91   /// 指定された名前のIPropertyDefを持っているか判定します。
92   /// </summary>
93   /// <param name="propertyName">IPropertyDefの名前</param>
94   /// <returns>存在するならtrue</returns>
95 1460 public bool HasPropertyDef(string propertyName)
96   {
97 1460 return propertyDefs_.ContainsKey(propertyName);
98   }
99  
100   /// <summary>
101   /// S2Container
102   /// </summary>
103   public IS2Container Container
104   {
105 788 set
106   {
107 788 container_ = value;
108 788 IEnumerator enu = propertyDefs_.Values.GetEnumerator();
109 1121 while(enu.MoveNext())
110   {
111 333 IPropertyDef propertyDef = (IPropertyDef) enu.Current;
112 333 propertyDef.Container = value;
113   }
114   }
115   }
116  
117   }
118   }
119