26 * <code>StopTimeControl</code> allows one to specify a preset stop time for |
26 * <code>StopTimeControl</code> allows one to specify a preset stop time for |
27 * a <code>Player</code>. |
27 * a <code>Player</code>. |
28 * <p> |
28 * <p> |
29 */ |
29 */ |
30 public class StopTimeControl extends ControlImpl implements |
30 public class StopTimeControl extends ControlImpl implements |
31 javax.microedition.media.control.StopTimeControl { |
31 javax.microedition.media.control.StopTimeControl |
|
32 { |
32 |
33 |
33 private long iStopTime=RESET; |
34 private long iStopTime=RESET; |
34 /** |
35 /** |
35 * |
36 * |
36 */ |
37 */ |
37 public StopTimeControl(Player aPlayer) { |
38 public StopTimeControl(Player aPlayer) |
38 this.iPlayer=aPlayer; |
39 { |
39 } |
40 this.iPlayer=aPlayer; |
|
41 } |
40 |
42 |
41 /** |
43 /** |
42 * Gets the last value successfully set by <CODE>setStopTime</CODE>. |
44 * Gets the last value successfully set by <CODE>setStopTime</CODE>. |
43 * |
45 * |
44 * Returns the constant <CODE>RESET</CODE> if no stop time is set. |
46 * Returns the constant <CODE>RESET</CODE> if no stop time is set. |
45 * This is the default. |
47 * This is the default. |
46 * |
48 * |
47 * @return The current stop time in microseconds. |
49 * @return The current stop time in microseconds. |
48 * @see #setStopTime |
50 * @see #setStopTime |
49 */ |
51 */ |
50 public long getStopTime() { |
52 public long getStopTime() |
51 checkState(); |
53 { |
52 return iStopTime; |
54 checkState(); |
53 } |
55 return iStopTime; |
|
56 } |
54 |
57 |
55 /** |
58 /** |
56 * |
59 * |
57 * Sets the <i>media time</i> at which you want the <code>Player</code> |
60 * Sets the <i>media time</i> at which you want the <code>Player</code> |
58 * to stop. |
61 * to stop. |
59 * The <code>Player</code> will stop when its <i>media time</i> |
62 * The <code>Player</code> will stop when its <i>media time</i> |
60 * reaches the stop-time. |
63 * reaches the stop-time. |
87 * <code>aStopTime</code> is called on a started |
90 * <code>aStopTime</code> is called on a started |
88 * <code>Player</code> and the |
91 * <code>Player</code> and the |
89 * <i>media stop-time</i> has already been set. |
92 * <i>media stop-time</i> has already been set. |
90 * @see #getStopTime |
93 * @see #getStopTime |
91 */ |
94 */ |
92 public void setStopTime(long aStopTime) { |
95 public void setStopTime(long aStopTime) |
93 checkState(); |
96 { |
94 if (iPlayer.getState() == Player.STARTED && getStopTime() != RESET) { |
97 checkState(); |
95 throw new IllegalStateException( |
98 if (iPlayer.getState() == Player.STARTED && getStopTime() != RESET) |
96 "Player is STARTED or setStopTime() is already called successfully"); |
99 { |
97 } |
100 throw new IllegalStateException( |
98 iStopTime = aStopTime; |
101 "Player is STARTED or setStopTime() is already called successfully"); |
99 ((AnimationPlayer)iPlayer).setiStopTime(iStopTime); |
102 } |
100 } |
103 iStopTime = aStopTime; |
|
104 ((AnimationPlayer)iPlayer).setiStopTime(iStopTime); |
|
105 } |
101 } |
106 } |