|
|||||||||||||||||||
| This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ReferencedData.java | 75% | 90,9% | 100% | 88,9% |
|
||||||||||||||
| 1 |
/* |
|
| 2 |
* JBind |
|
| 3 |
* |
|
| 4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
| 5 |
* |
|
| 6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
| 7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
| 8 |
* 'Apache Software License V 1.1'. |
|
| 9 |
*/ |
|
| 10 |
package org.jbind.xml.instance.data; |
|
| 11 |
|
|
| 12 |
import java.util.ArrayList; |
|
| 13 |
import java.util.Collections; |
|
| 14 |
import java.util.HashMap; |
|
| 15 |
import java.util.List; |
|
| 16 |
import java.util.ListIterator; |
|
| 17 |
import java.util.Map; |
|
| 18 |
|
|
| 19 |
import org.jbind.xml.core.data.IAnyTypeData; |
|
| 20 |
|
|
| 21 |
public class ReferencedData implements IReferencedData {
|
|
| 22 |
|
|
| 23 |
private Map myDataLists = new HashMap(17); |
|
| 24 |
|
|
| 25 | 25 |
public ReferencedData() {}
|
| 26 |
|
|
| 27 | 61 |
public void add(String aKey, IAnyTypeData aData) {
|
| 28 | 61 |
List l = (List)myDataLists.get(aKey); |
| 29 | 61 |
if (null == l) {
|
| 30 | 28 |
l = new ArrayList(); |
| 31 | 28 |
myDataLists.put(aKey, l); |
| 32 |
} |
|
| 33 | 61 |
l.add(aData); |
| 34 |
} |
|
| 35 |
|
|
| 36 | 10 |
public ListIterator iter(String aKey) {
|
| 37 | 10 |
ListIterator res = null; |
| 38 | 10 |
List l = (List)myDataLists.get(aKey); |
| 39 | 10 |
if (null != l) {
|
| 40 | 10 |
res = l.listIterator(); |
| 41 |
} else {
|
|
| 42 | 0 |
res = Collections.EMPTY_LIST.listIterator(); |
| 43 |
} |
|
| 44 | 10 |
return res; |
| 45 |
} |
|
| 46 |
|
|
| 47 |
} |
|
| 48 |
|
|
||||||||||