TYPE needs special care for WeaponProf due to CHANGEPROF
| 34 | * TYPE needs special care for WeaponProf due to CHANGEPROF |
| 35 | */ |
| 36 | public class TypeToken implements PrimitiveToken<WeaponProf> |
| 37 | { |
| 38 | private static final Class<WeaponProf> WEAPONPROF_CLASS = WeaponProf.class; |
| 39 | private CDOMGroupRef<WeaponProf> typeRef; |
| 40 | |
| 41 | @Override |
| 42 | public String getTokenName() |
| 43 | { |
| 44 | return "TYPE"; |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public <R> Collection<R> getCollection(PlayerCharacter pc, Converter<WeaponProf, R> c) |
| 49 | { |
| 50 | List<WeaponProf> profs = pc.getWeaponProfsInTarget(typeRef); |
| 51 | List<R> returnList = new ArrayList<>(profs.size() + 10); |
| 52 | for (WeaponProf wp : profs) |
| 53 | { |
| 54 | returnList.addAll(c.convert(CDOMDirectSingleRef.getRef(wp))); |
| 55 | } |
| 56 | return returnList; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public GroupingState getGroupingState() |
| 61 | { |
| 62 | return GroupingState.ANY; |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public Class<? super WeaponProf> getReferenceClass() |
| 67 | { |
| 68 | return WEAPONPROF_CLASS; |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public String getLSTformat(boolean useAny) |
| 73 | { |
| 74 | return typeRef.getLSTformat(useAny); |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public boolean initialize(LoadContext context, Class<WeaponProf> cl, String value, String args) |
| 79 | { |
| 80 | if (args != null) |
| 81 | { |
| 82 | return false; |
| 83 | } |
| 84 | typeRef = context.getReferenceContext().getCDOMTypeReference(WEAPONPROF_CLASS, value); |
| 85 | return typeRef != null; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public boolean equals(Object obj) |
| 90 | { |
| 91 | if (obj == this) |
| 92 | { |
| 93 | return true; |
nothing calls this directly
no outgoing calls
no test coverage detected