Clover coverage report - brownies library - 1.0-beta-1 Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00 FRAMES NO FRAMES |
file stats: | LOC: | 112 |  | Methods: | 14
| NCLOC: | 56 |  | Classes: | 3
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
MapUtils.java | - | 41.2% | 50% | 45.2% |

1 |  |
     /*
2 |  |
      * Joey and its relative products are published under the terms
3 |  |
      * of the Apache Software License.
4 |  |
      */
5 |  |
     /*
6 |  |
      * Created on 2004/02/15
7 |  |
      */
8 |  |
     package org.asyrinx.brownie.core.collection;
9 |  |
10 |  |
     import java.util.ArrayList;
11 |  |
     import java.util.Collections;
12 |  |
     import java.util.List;
13 |  |
     import java.util.Map;
14 |  |
15 |  |
     import org.asyrinx.brownie.core.collection.wrapper.MapWrapper;
16 |  |
17 |  |
     /**
18 |  |
      * Mapインタフェースに関するユーティリティです。 <br>
19 |  |
      *
20 |  |
      * @see java.util.Map
21 |  |
      * @author akima
22 |  |
      */
23 |  |
     public class MapUtils extends org.apache.commons.collections.MapUtils {
24 |  |
25 |  |
         /**
26 |  |
          * 引数に指定されたマップにIntegerKeyMapのインタフェースを追加します。
27 |  |
          *
28 |  |
          * @param map
29 |  |
          *            対象となるMapオブジェクト
30 |  |
          * @return
31 |  |
          */
32 | 1 |
         public static IntegerKeyMap toIntegerKeyMap(final Map map) {
33 | 1 |
             return new WrappingNumberMap(map);
34 |  |
         }
35 |  |
36 |  |
         /**
37 |  |
          * 引数に指定されたマップにStringKeyMapのインタフェースを追加します。
38 |  |
          *
39 |  |
          * @param map
40 |  |
          *            対象となるMapオブジェクト
41 |  |
          * @return
42 |  |
          */
43 | 1 |
         public static StringKeyMap toStringKeyMap(final Map map) {
44 | 1 |
             return new WrappingStringKeyMap(map);
45 |  |
         }
46 |  |
47 |  |
     }
48 |  |
49 |  |
     class WrappingNumberMap extends MapWrapper implements IntegerKeyMap {
50 |  |
51 |  |
         /**
52 |  |
          * @param wrapped
53 |  |
          */
54 | 1 |
         public WrappingNumberMap(Map wrapped) {
55 | 1 |
             super(wrapped);
56 |  |
         }
57 |  |
58 | 2 |
         public void put(int number, Object value) {
59 | 2 |
             put(new Integer(number), value);
60 |  |
         }
61 |  |
62 | 2 |
         public void put(Integer key, Object value) {
63 | 2 |
             super.put(key, value);
64 |  |
         }
65 |  |
66 | 0 |
         public Object get(int number) {
67 | 0 |
             return get(new Integer(number));
68 |  |
         }
69 |  |
70 | 0 |
         public Object get(Integer key) {
71 | 0 |
             return super.get(key);
72 |  |
         }
73 |  |
74 | 0 |
         public Object remove(int number) {
75 | 0 |
             return remove(new Integer(number));
76 |  |
         }
77 |  |
78 | 0 |
         public Object remove(Integer key) {
79 | 0 |
             return super.remove(key);
80 |  |
         }
81 |  |
82 |  |
     }
83 |  |
84 |  |
     class WrappingStringKeyMap extends MapWrapper implements StringKeyMap {
85 |  |
86 |  |
         /**
87 |  |
          * @param wrapped
88 |  |
          */
89 | 1 |
         public WrappingStringKeyMap(Map wrapped) {
90 | 1 |
             super(wrapped);
91 |  |
         }
92 |  |
93 | 0 |
         public Object get(String key) {
94 | 0 |
             return super.get(key);
95 |  |
         }
96 |  |
97 | 2 |
         public void put(String key, Object value) {
98 | 2 |
             super.put(key, value);
99 |  |
         }
100 |  |
101 | 0 |
         public Object remove(String key) {
102 | 0 |
             return super.remove(key);
103 |  |
         }
104 |  |
105 | 0 |
         public List sortedKeys() {
106 | 0 |
             final List result = new ArrayList();
107 | 0 |
             result.addAll(this.keySet());
108 | 0 |
             Collections.sort(result);
109 | 0 |
             return result;
110 |  |
         }
111 |  |
112 |  |
     }