View Javadoc

1   /*
2    @See License.txt@
3    */
4   package spellcast.spell;
5   
6   import spellcast.beings.IBeing;
7   import spellcast.beings.IWizard;
8   import spellcast.gestures.Gesture;
9   
10  /***
11   * The default implementation of <code>ISpell</code>.
12   *
13   * @author Barrie Treloar
14   * @version $Revision: 1.1 $
15   */
16  public class SpellImpl implements ISpell {
17      /*** The casting <code>IWizard</code> of this <code>ISpell</code>. */
18      private IWizard caster;
19  
20      /*** The description of this <code>ISpell</code>. */
21      private String description;
22  
23      /*** The <code>Gesture</code> s needed to cast this <code>ISpell</code>. */
24      private Gesture[] gestures;
25  
26      /*** The target <code>IBeing</code> of this <code>ISpell</code>. */
27      private IBeing target;
28  
29      /***
30       * Creates the default implementation of <code>SpellImpl</code>.
31       *
32       * @param theCaster
33       *            the <code>IWizard</code> caster of the <code>ISpell</code>.
34       * @param theTarget
35       *            the target <code>IBeing</code> of the <code>ISpell</code>.
36       * @param theGestures
37       *            the <code>Gesture</code> s needed to cast this
38       *            <code>ISpell</code>.
39       * @param theDescription
40       *            the description of this <code>ISpell</code>.
41       */
42      protected SpellImpl(final IWizard theCaster, final IBeing theTarget,
43              final Gesture[] theGestures, String theDescription) {
44          setCaster(theCaster);
45          setTarget(theTarget);
46          setGestures(theGestures);
47          setDescription(theDescription);
48      }
49  
50      /***
51       * {@inheritDoc}
52       */
53      public final IWizard getCaster() {
54          return caster;
55      }
56  
57      /***
58       * {@inheritDoc}
59       */
60      public final String getDescription() {
61          return description;
62      }
63  
64      /***
65       * {@inheritDoc}
66       */
67      public final Gesture[] getGestures() {
68          return gestures;
69      }
70  
71      /***
72       * {@inheritDoc}
73       */
74      public final IBeing getTarget() {
75          return target;
76      }
77  
78      /***
79       * Set the casting <code>IWizard</code> of this <code>ISpell</code>.
80       *
81       * @param theCaster
82       *            the casting <code>IWizard</code> of this <code>ISpell</code>..
83       */
84      private void setCaster(final IWizard theCaster) {
85          caster = theCaster;
86      }
87  
88      /***
89       * Set the description of this <code>ISpell</code>.
90       *
91       * @param theDescription
92       *            the description of this <code>ISpell</code>
93       *
94       */
95      private void setDescription(final String theDescription) {
96          description = theDescription;
97      }
98  
99      /***
100      * Set the <code>Gesture</code> s needed to cast this <code>ISpell</code>.
101      *
102      * @param theGestures
103      *            The <code>Gesture</code> s needed to cast this
104      *            <code>ISpell</code>.
105      */
106     private void setGestures(final Gesture[] theGestures) {
107         gestures = theGestures;
108     }
109 
110     /***
111      * Set the target <code>IBeing</code> of this <code>ISpell</code>.
112      *
113      * @param theTarget
114      *            the target <code>IBeing</code> of this <code>ISpell</code>.
115      */
116     private void setTarget(final IBeing theTarget) {
117         target = theTarget;
118     }
119 }