| 5540 | private List<EquipmentHead> heads = new ArrayList<>(); |
| 5541 | |
| 5542 | public EquipmentHead getEquipmentHead(int index) |
| 5543 | { |
| 5544 | if (index <= 0) |
| 5545 | { |
| 5546 | throw new IndexOutOfBoundsException(Integer.toString(index)); |
| 5547 | } |
| 5548 | |
| 5549 | int headsIndex = index - 1; |
| 5550 | int currentSize = heads.size(); |
| 5551 | |
| 5552 | EquipmentHead head; |
| 5553 | if (headsIndex >= currentSize) |
| 5554 | { |
| 5555 | for (int i = 0; i < headsIndex - currentSize; i++) |
| 5556 | { |
| 5557 | heads.add(null); |
| 5558 | } |
| 5559 | head = new EquipmentHead(this, index); |
| 5560 | heads.add(head); |
| 5561 | } |
| 5562 | else |
| 5563 | { |
| 5564 | head = heads.get(headsIndex); |
| 5565 | if (head == null) |
| 5566 | { |
| 5567 | head = new EquipmentHead(this, index); |
| 5568 | heads.set(headsIndex, head); |
| 5569 | } |
| 5570 | } |
| 5571 | return head; |
| 5572 | } |
| 5573 | |
| 5574 | public EquipmentHead getEquipmentHeadReference(int index) |
| 5575 | { |