Remove an EqSet from the PC's Equipped Equipment. @param id The identifier of the PC @param eSet The EquipSet to remove. @return true if the object was removed.
(CharID id, EquipSet eSet)
| 44 | * @return true if the object was removed. |
| 45 | */ |
| 46 | public boolean delEquipSet(CharID id, EquipSet eSet) |
| 47 | { |
| 48 | Collection<EquipSet> componentSet = getCachedSet(id); |
| 49 | if (componentSet == null) |
| 50 | { |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | boolean found = false; |
| 55 | final String pid = eSet.getIdPath(); |
| 56 | |
| 57 | // first remove this EquipSet |
| 58 | componentSet.remove(eSet); |
| 59 | |
| 60 | // now find and remove all it's children |
| 61 | for (Iterator<EquipSet> e = componentSet.iterator(); e.hasNext();) |
| 62 | { |
| 63 | final EquipSet es = e.next(); |
| 64 | final String abParentId = es.getParentIdPath() + Constants.EQUIP_SET_PATH_SEPARATOR; |
| 65 | final String abPid = pid + Constants.EQUIP_SET_PATH_SEPARATOR; |
| 66 | |
| 67 | if (abParentId.startsWith(abPid)) |
| 68 | { |
| 69 | e.remove(); |
| 70 | found = true; |
| 71 | } |
| 72 | } |
| 73 | return found; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Search all of the PC equipment sets and replace all instances of oldItem with newItem. |
no test coverage detected