An AbstractProfProvider is an object that contains the ability to contain Proficiencies, either by TYPE of Equipment or direct references. Explicit Storage of TYPE vs. primitive is necessary due to the ability of the TYPE being a resolved against Equipment. @param The type of Profici
| 41 | * AbstractProfProvider provides |
| 42 | */ |
| 43 | public abstract class AbstractProfProvider<T extends CDOMObject> extends ConcretePrereqObject implements ProfProvider<T> |
| 44 | { |
| 45 | |
| 46 | /** |
| 47 | * Contains the set of primitive proficiencies objects that this |
| 48 | * AbstractProfProvider grants |
| 49 | */ |
| 50 | private final Set<CDOMReference<T>> direct; |
| 51 | |
| 52 | /** |
| 53 | * Contains the set of TYPEs of Equipment objects for which this |
| 54 | * AbstractProfProvider grants proficiency |
| 55 | */ |
| 56 | private final Set<CDOMReference<Equipment>> byEquipType; |
| 57 | |
| 58 | /** |
| 59 | * Constructs a new AbstractProfProvider with the given List of proficiency |
| 60 | * references and Equipment TYPE references. |
| 61 | * |
| 62 | * No reference is maintained to the internal structure of the given Lists, |
| 63 | * so modifications to this AbstractProfProvider are not reflected in the |
| 64 | * given Lists (and vice versa). |
| 65 | * |
| 66 | * @param profs |
| 67 | * The List of proficiency references indicating the primitive |
| 68 | * proficiency objects this AbstractProfProvider will contain. |
| 69 | * @param equipTypes |
| 70 | * The List of Equipment references indicating the TYPEs of |
| 71 | * Equipment objects this AbstractProfProvider will contain. |
| 72 | */ |
| 73 | public AbstractProfProvider(List<CDOMReference<T>> profs, List<CDOMReference<Equipment>> equipTypes) |
| 74 | { |
| 75 | direct = new TreeSet<>(ReferenceUtilities.REFERENCE_SORTER); |
| 76 | direct.addAll(profs); |
| 77 | byEquipType = new TreeSet<>(ReferenceUtilities.REFERENCE_SORTER); |
| 78 | byEquipType.addAll(equipTypes); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Returns true if this AbstractProfProvider provides proficiency for the |
| 83 | * given Equipment; false otherwise. |
| 84 | * |
| 85 | * @param equipment |
| 86 | * The Equipment to be tested to see if this AbstractProfProvider |
| 87 | * provides proficiency for the Equipment |
| 88 | * @return true if this AbstractProfProvider provides proficiency for the |
| 89 | * given Equipment; false otherwise. |
| 90 | */ |
| 91 | @Override |
| 92 | public abstract boolean providesProficiencyFor(Equipment equipment); |
| 93 | |
| 94 | /** |
| 95 | * Returns true if this AbstractProfProvider provides the given proficiency. |
| 96 | * This only tests against the direct proficiency list provided during |
| 97 | * construction of the AbstractProfProvider. |
| 98 | * |
| 99 | * @param proficiency |
| 100 | * The proficiency to be tested to see if this |
nothing calls this directly
no outgoing calls
no test coverage detected