The Class EquipNodeImpl represents a node in the equipping tree. It may be an item of equipment or a slot that may be filled. EquipNodeImpl objects are immutable.
| 35 | * EquipNodeImpl objects are immutable. |
| 36 | */ |
| 37 | public class EquipNode implements Comparable<EquipNode> |
| 38 | { |
| 39 | public static enum NodeType |
| 40 | { |
| 41 | /** This is a body location which can contain other slots rather |
| 42 | * than equipment. */ |
| 43 | BODY_SLOT, |
| 44 | |
| 45 | /** This is a node which shows an empty slot that takes a specific |
| 46 | * equipment type (e.g. Ring). It is removed from the tree when the |
| 47 | * slot it represents is full and added back in when there is space |
| 48 | * in the slot. */ |
| 49 | PHANTOM_SLOT, |
| 50 | |
| 51 | /** This is a node representing an equipped item of equipment. */ |
| 52 | EQUIPMENT |
| 53 | } |
| 54 | |
| 55 | private static final NumberFormat FMT = new DecimalFormat("00"); |
| 56 | private final NodeType nodeType; |
| 57 | private final BodyStructure bodyStructure; |
| 58 | private Equipment equipment; |
| 59 | EquipNode parent; |
| 60 | private final String name; |
| 61 | private EquipSlot slot; |
| 62 | String idPath; |
| 63 | private String order; |
| 64 | boolean singleOnly = false; |
| 65 | |
| 66 | /** |
| 67 | * Create a new EquipNodeImpl instance representing a body structure. |
| 68 | * |
| 69 | * @param bodyStructure The part of the body. |
| 70 | * @param order The order of the body structure |
| 71 | */ |
| 72 | public EquipNode(BodyStructure bodyStructure, int order) |
| 73 | { |
| 74 | this.nodeType = NodeType.BODY_SLOT; |
| 75 | this.bodyStructure = bodyStructure; |
| 76 | this.name = bodyStructure.toString(); |
| 77 | this.order = FMT.format(order); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Create a new EquipNodeImpl instance representing an equipment slot. |
| 82 | * These are called phantom slots as they represent a location yet to |
| 83 | * be filled. |
| 84 | * |
| 85 | * @param parent The parent body structure node |
| 86 | * @param slot The equipment slot |
| 87 | * @param singleOnly Can the slot only ever have a single entry. e.g. weapon slots |
| 88 | */ |
| 89 | public EquipNode(EquipNode parent, EquipSlot slot, boolean singleOnly) |
| 90 | { |
| 91 | this.nodeType = NodeType.PHANTOM_SLOT; |
| 92 | this.bodyStructure = parent.bodyStructure; |
| 93 | this.slot = slot; |
| 94 | this.name = slot.getSlotName(); |
nothing calls this directly
no outgoing calls
no test coverage detected