This class stores an association between an object and a set of prereqs. Refactored from ChoiceInfo originally written by Andrew Wilson <nuance@sourceforge.net> @param
| 34 | * @param <T> |
| 35 | */ |
| 36 | public class QualifiedObject<T> extends ConcretePrereqObject implements QualifyingObject |
| 37 | { |
| 38 | |
| 39 | private T theObject; |
| 40 | |
| 41 | /** |
| 42 | * Constructor |
| 43 | * @param anObj |
| 44 | */ |
| 45 | public QualifiedObject(final T anObj) |
| 46 | { |
| 47 | theObject = anObj; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Constructor |
| 52 | * @param anObj |
| 53 | * @param aPrereqList |
| 54 | */ |
| 55 | public QualifiedObject(final T anObj, final List<Prerequisite> aPrereqList) |
| 56 | { |
| 57 | theObject = anObj; |
| 58 | addAllPrerequisites(aPrereqList); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Constructor |
| 63 | * @param anObj |
| 64 | * @param prereq |
| 65 | */ |
| 66 | public QualifiedObject(final T anObj, Prerequisite prereq) |
| 67 | { |
| 68 | theObject = anObj; |
| 69 | addPrerequisite(prereq); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Get the qualifiying object. Will always return the object |
| 74 | * if no character is passed in. |
| 75 | * |
| 76 | * @param aPC Character to be checked or null |
| 77 | * @param owner TODO |
| 78 | * @return qualifying object |
| 79 | */ |
| 80 | public T getObject(final PlayerCharacter aPC, CDOMObject owner) |
| 81 | { |
| 82 | if (aPC == null || qualifies(aPC, owner)) |
| 83 | { |
| 84 | return theObject; |
| 85 | } |
| 86 | return null; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Get the qualifiying object. Will always return the object |
| 91 | * |
| 92 | * @return qualifying object |
| 93 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected