< prev index next >

modules/graphics/src/main/java/javafx/animation/Animation.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -181,11 +181,11 @@
             if (accessCtrlCtx == null) {
                 throw new IllegalStateException("Error: AccessControlContext not captured");
             }
 
             AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
-                impl_timePulse(elapsedTime);
+                doTimePulse(elapsedTime);
                 return null;
             }, accessCtrlCtx);
         }
     };
 

@@ -309,21 +309,21 @@
                         if (Math.abs(newRate) < EPSILON) {
                             if (getStatus() == Status.RUNNING) {
                                 lastPlayedForward = (Math.abs(getCurrentRate()
                                         - oldRate) < EPSILON);
                             }
-                            setCurrentRate(0.0);
+                            doSetCurrentRate(0.0);
                             pauseReceiver();
                         } else {
                             if (getStatus() == Status.RUNNING) {
                                 final double currentRate = getCurrentRate();
                                 if (Math.abs(currentRate) < EPSILON) {
-                                    setCurrentRate(lastPlayedForward ? newRate : -newRate);
+                                    doSetCurrentRate(lastPlayedForward ? newRate : -newRate);
                                     resumeReceiver();
                                 } else {
                                     final boolean playingForward = Math.abs(currentRate - oldRate) < EPSILON;
-                                    setCurrentRate(playingForward ? newRate : -newRate);
+                                    doSetCurrentRate(playingForward ? newRate : -newRate);
                                 }
                             }
                             oldRate = newRate;
                         }
                         clipEnvelope.setRate(newRate);

@@ -364,11 +364,11 @@
      * @defaultValue 0.0
      */
     private ReadOnlyDoubleProperty currentRate;
     private static final double DEFAULT_CURRENT_RATE = 0.0;
 
-    private void setCurrentRate(double value) {
+    private void doSetCurrentRate(double value) {
         if ((currentRate != null) || (Math.abs(value - DEFAULT_CURRENT_RATE) > EPSILON)) {
             ((CurrentRateProperty)currentRateProperty()).set(value);
         }
     }
 

@@ -902,16 +902,16 @@
         if (parent != null) {
             throw new IllegalStateException("Cannot start when embedded in another animation");
         }
         switch (getStatus()) {
             case STOPPED:
-                if (impl_startable(true)) {
+                if (startable(true)) {
                     final double rate = getRate();
                     if (lastPlayedFinished) {
                         jumpTo((rate < 0)? getTotalDuration() : Duration.ZERO);
                     }
-                    impl_start(true);
+                    doStart(true);
                     startReceiver(TickCalculation.fromDuration(getDelay()));
                     if (Math.abs(rate) < EPSILON) {
                         pauseReceiver();
                     } else {
 

@@ -922,11 +922,11 @@
                         handler.handle(new ActionEvent(this, null));
                     }
                 }
                 break;
             case PAUSED:
-                impl_resume();
+                doResume();
                 if (Math.abs(getRate()) >= EPSILON) {
                     resumeReceiver();
                 }
                 break;
         }

@@ -976,11 +976,11 @@
         if (parent != null) {
             throw new IllegalStateException("Cannot stop when embedded in another animation");
         }
         if (getStatus() != Status.STOPPED) {
             clipEnvelope.abortCurrentPulse();
-            impl_stop();
+            doStop();
             jumpTo(Duration.ZERO);
         }
     }
 
     /**

@@ -999,11 +999,11 @@
             throw new IllegalStateException("Cannot pause when embedded in another animation");
         }
         if (getStatus() == Status.RUNNING) {
             clipEnvelope.abortCurrentPulse();
             pauseReceiver();
-            impl_pause();
+            doPause();
         }
     }
 
     /**
      * The constructor of {@code Animation}.

@@ -1045,16 +1045,16 @@
         this.targetFramerate = TickCalculation.TICKS_PER_SECOND / resolution;
         this.clipEnvelope = clipEnvelope;
         this.timer = timer;
     }
 
-    boolean impl_startable(boolean forceSync) {
+    boolean startable(boolean forceSync) {
         return (fromDuration(getCycleDuration()) > 0L)
                 || (!forceSync && clipEnvelope.wasSynched());
     }
 
-    void impl_sync(boolean forceSync) {
+    void sync(boolean forceSync) {
         if (forceSync || !clipEnvelope.wasSynched()) {
             syncClipEnvelope();
         }
     }
 

@@ -1065,69 +1065,69 @@
         clipEnvelope = clipEnvelope.setCycleCount(internalCycleCount);
         clipEnvelope.setCycleDuration(getCycleDuration());
         clipEnvelope.setAutoReverse(isAutoReverse());
     }
 
-    void impl_start(boolean forceSync) {
-        impl_sync(forceSync);
+    void doStart(boolean forceSync) {
+        sync(forceSync);
         setStatus(Status.RUNNING);
         clipEnvelope.start();
-        setCurrentRate(clipEnvelope.getCurrentRate());
+        doSetCurrentRate(clipEnvelope.getCurrentRate());
         lastPulse = 0;
     }
 
-    void impl_pause() {
+    void doPause() {
         final double currentRate = getCurrentRate();
         if (Math.abs(currentRate) >= EPSILON) {
             lastPlayedForward = Math.abs(getCurrentRate() - getRate()) < EPSILON;
         }
-        setCurrentRate(0.0);
+        doSetCurrentRate(0.0);
         setStatus(Status.PAUSED);
     }
 
-    void impl_resume() {
+    void doResume() {
         setStatus(Status.RUNNING);
-        setCurrentRate(lastPlayedForward ? getRate() : -getRate());
+        doSetCurrentRate(lastPlayedForward ? getRate() : -getRate());
     }
 
-    void impl_stop() {
+    void doStop() {
         if (!paused) {
             timer.removePulseReceiver(pulseReceiver);
         }
         setStatus(Status.STOPPED);
-        setCurrentRate(0.0);
+        doSetCurrentRate(0.0);
     }
 
-    void impl_timePulse(long elapsedTime) {
+    void doTimePulse(long elapsedTime) {
         if (resolution == 1) { // fullspeed
             clipEnvelope.timePulse(elapsedTime);
         } else if (elapsedTime - lastPulse >= resolution) {
             lastPulse = (elapsedTime / resolution) * resolution;
             clipEnvelope.timePulse(elapsedTime);
         }
     }
 
-    abstract void impl_playTo(long currentTicks, long cycleTicks);
+    abstract void doPlayTo(long currentTicks, long cycleTicks);
 
-    abstract void impl_jumpTo(long currentTicks, long cycleTicks, boolean forceJump);
+    abstract void doJumpTo(long currentTicks, long cycleTicks, boolean forceJump);
 
-    void impl_setCurrentTicks(long ticks) {
+    void setCurrentTicks(long ticks) {
         currentTicks = ticks;
         if (currentTime != null) {
             currentTime.fireValueChangedEvent();
         }
     }
 
-    void impl_setCurrentRate(double currentRate) {
+    void setCurrentRate(double currentRate) {
 //        if (getStatus() == Status.RUNNING) {
-            setCurrentRate(currentRate);
+            doSetCurrentRate(currentRate);
 //        }
     }
 
-    final void impl_finished() {
+    final void finished() {
         lastPlayedFinished = true;
-        impl_stop();
+        doStop();
         final EventHandler<ActionEvent> handler = getOnFinished();
         if (handler != null) {
             try {
                 handler.handle(new ActionEvent(this, null));
             } catch (Exception ex) {
< prev index next >