|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| NestedCategory.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 | package org.jconfig; | |
| 2 | ||
| 3 | import java.util.Collection; | |
| 4 | import java.util.HashMap; | |
| 5 | ||
| 6 | /** | |
| 7 | * This class is the result of countless discussions of what | |
| 8 | * a Category should be. After determing that it should be | |
| 9 | * another class, and that we can do something useful, we | |
| 10 | * created this Category. | |
| 11 | * | |
| 12 | * A Category is a logical extension of the Configuration | |
| 13 | * has Categories has Properties has Value frame-of-mind. | |
| 14 | * The primary goal is to reduce redundancy in source code | |
| 15 | * when using setter and getters that include Category | |
| 16 | * information. | |
| 17 | * | |
| 18 | * @since 2.2 | |
| 19 | * @author Andreas Mecky <andreas.mecky@xcom.de> | |
| 20 | * @author Terry Dye <terry.dye@xcom.de> | |
| 21 | */ | |
| 22 | public class NestedCategory extends DefaultCategory { | |
| 23 | ||
| 24 | private HashMap children; | |
| 25 | /** | |
| 26 | * @since 2.2 | |
| 27 | * @param categoryName | |
| 28 | */ | |
| 29 | 197 | public NestedCategory(String categoryName) { |
| 30 | 197 | super(categoryName); |
| 31 | 197 | children = new HashMap(); |
| 32 | } | |
| 33 | ||
| 34 | 45 | public void addCategory(Category cat) { |
| 35 | 45 | children.put(cat.getCategoryName(),cat); |
| 36 | } | |
| 37 | ||
| 38 | 81 | public NestedCategory getCategory(String name) { |
| 39 | 81 | return (NestedCategory)children.get(name); |
| 40 | } | |
| 41 | ||
| 42 | 54 | public Collection getChildCategories() { |
| 43 | 54 | return children.values(); |
| 44 | } | |
| 45 | ||
| 46 | } |
|
||||||||||