function Alpha() { this.onion = 'onion'; function Beta() { alert(this.onion); } Beta.call(this); } var alpha1 = new Alpha(); // Alerts 'onion'
Alpha al = head.getAlpha(); if (al.finished()) { //code }
/** * Pauses the animation. */ public void pauseAnimation() { animation.pause(); }
/** * This internal method returns a clone of the Alpha * * @return a duplicate of this Alpha */ Alpha cloneAlpha() { Alpha a = new Alpha(); a.setStartTime(getStartTime()); a.setLoopCount(getLoopCount()); a.setMode(getMode()); a.setTriggerTime(getTriggerTime()); a.setPhaseDelayDuration(getPhaseDelayDuration()); a.setIncreasingAlphaDuration(getIncreasingAlphaDuration()); a.setIncreasingAlphaRampDuration(getIncreasingAlphaRampDuration()); a.setAlphaAtOneDuration(getAlphaAtOneDuration()); a.setDecreasingAlphaDuration(getDecreasingAlphaDuration()); a.setDecreasingAlphaRampDuration(getDecreasingAlphaRampDuration()); a.setAlphaAtZeroDuration(getAlphaAtZeroDuration()); return a; }
@Override public void readObject( DataInput in ) throws IOException { super.readObject( in ); Alpha alpha = (Alpha)node; alpha.setAlphaAtOneDuration( in.readLong() ); alpha.setAlphaAtZeroDuration( in.readLong() ); alpha.setDecreasingAlphaDuration( in.readLong() ); alpha.setDecreasingAlphaRampDuration( in.readLong() ); alpha.setIncreasingAlphaDuration( in.readLong() ); alpha.setIncreasingAlphaRampDuration( in.readLong() ); alpha.setLoopCount( in.readInt() ); alpha.setMode( in.readInt() ); alpha.setPhaseDelayDuration( in.readLong() ); alpha.setStartTime( in.readLong() ); alpha.setTriggerTime( in.readLong() ); long x = in.readLong(); if (x!=0L) alpha.pause(x); }
@Override public void writeObject( DataOutput out ) throws IOException { super.writeObject( out ); Alpha alpha = (Alpha)node; out.writeLong( alpha.getAlphaAtOneDuration() ); out.writeLong( alpha.getAlphaAtZeroDuration() ); out.writeLong( alpha.getDecreasingAlphaDuration() ); out.writeLong( alpha.getDecreasingAlphaRampDuration() ); out.writeLong( alpha.getIncreasingAlphaDuration() ); out.writeLong( alpha.getIncreasingAlphaRampDuration() ); out.writeInt( alpha.getLoopCount() ); out.writeInt( alpha.getMode() ); out.writeLong( alpha.getPhaseDelayDuration() ); out.writeLong( alpha.getStartTime() ); out.writeLong( alpha.getTriggerTime() ); out.writeLong( alpha.getPauseTime() ); }
tg.addChild(sig); final Alpha alpha = new Alpha(); alpha.setStartTime(System.currentTimeMillis()); alpha.setMode(Alpha.DECREASING_ENABLE | Alpha.INCREASING_ENABLE); alpha.setIncreasingAlphaDuration(300); alpha.setDecreasingAlphaDuration(300); alpha.pause(); final ScaleInterpolator si = new ScaleInterpolator(alpha, sig); si.setMaximumScale(5 * radius);
/** * This method is invoked by the behavior scheduler every frame. It * maps the alpha value that corresponds to the current time into a * transparency value and updates the specified TransparencyAttributes * object with this new transparency value. * @param criteria an enumeration of the criteria that caused the * stimulus */ @Override public void processStimulus(Enumeration criteria) { // Handle stimulus WakeupCriterion criterion = passiveWakeupCriterion; if (alpha != null) { float value = alpha.value(); if (value != prevAlphaValue) { float val = (float)((1.0-value)*minimumTransparency + value*maximumTransparency); target.setTransparency(val); prevAlphaValue = value; } if (!alpha.finished() && !alpha.isPaused()) { criterion = defaultWakeupCriterion; } } wakeupOn(criterion); }
animation = new Alpha(-1, 4000); animation.pause(); animation.setStartTime(System.currentTimeMillis()); final BranchGroup bg = new BranchGroup(); rotpol = new RotationInterpolator(animation, animationTG) {
@RunWith(PowerMockRunner.class) //@PrepareOnlyThisForTest(Foo.class) // we aren't looking at the byte code, I think public class FooTest { @Test public void testBar_callsBarWithXray() throws Exception { Baz baz = new Baz(); //POJOs Alpha alpha = new Alpha(); alpha.set(new Xray()); Foo foo = new Foo(); Foo stub = PowerMockito.spy(foo); // using Mockito, as it's neither final nor "not spyable" // NPE at org.powermock.api.mockito.internal.expectation.PowerMockitoStubberImpl.addAnswersForStubbing(PowerMockitoStubberImpl.java:67) PowerMockito.doReturn("ok").when(stub, "bar", Matchers.any(Xray.class), Matchers.any(Baz.class)); String res = stub.bar(alpha, baz); Assert.assertEquals("ok", res); //Testing if bar(Xray, Baz) was called by bar(Alpha, Baz) PowerMockito.verifyPrivate(stub).invoke("bar", Matchers.any(Xray.class), Matchers.any(Baz.class)); // Mockito's equivalent for a public method: verify(stub, times(1)).bar(any(Xray.class), any(Baz.class)); } }
public static int addValues(ArrayList<? extends Alpha> arr, Gamma gam) { int sum = 0; for (Alpha alpha : arr) { try { sum += alpha.value(gam); } catch (ValueException e) { } } return sum; }
/** * @see PointList.PointListListener#highlighted */ @Override public void highlighted(final BenesNamedPoint p) { final int i = points.indexOf(p); final BranchGroup bg = (BranchGroup) getChild(i); final TransformGroup tg = (TransformGroup) bg.getChild(0); final ScaleInterpolator si = (ScaleInterpolator) tg.getChild(1); final Alpha a = si.getAlpha(); si.setEnable(true); a.resume(); try { Thread.sleep(600); } catch (final Exception e) {} a.pause(); si.setEnable(false); }
/** * Resumes this alpha object as of the specified time. If the alpha * object was paused, the difference between the specified * time and the pause time will be used to adjust the startTime of * this alpha. The equation is as follows: * * <ul><code>startTime += time - pauseTime</code></ul> * * Since the alpha object is no longer paused, this has the effect * of resuming the interpolator as of the specified time. If the * alpha object is not paused when this method is called, then this * method does nothing--the start time is not adjusted in this case. * * @param time the time at which to resume the alpha * * @exception IllegalArgumentException if time <= 0 * * @since Java 3D 1.3 */ public void resume(long time) { if (time <= 0L) { throw new IllegalArgumentException(J3dI18N.getString("Alpha0")); } if (paused) { long newStartTime = startTime + time - pauseTime; paused = false; pauseTime = 0L; setStartTime(newStartTime); } }
@Test public void testBar_callsBarWithXray() throws Exception { Baz baz = new Baz(); //POJOs Alpha alpha = new Alpha(); alpha.set(new Xray()); Foo stub = PowerMockito.spy(new Foo()); Method m = MemberMatcher.method(Foo.class, "bar", Xray.class, Baz.class); PowerMockito.doReturn("ok") .when(stub, m ) .withArguments(Matchers.any(Xray.class), Matchers.any(Baz.class)); stub.bar(alpha, baz); PowerMockito.verifyPrivate(stub, Mockito.times(1)).invoke("bar", Matchers.any(Xray.class), Matchers.any(Baz.class)); // Mockito's equivalent for a public method: verify(stub, times(1)).bar(any(Xray.class), any(Baz.class)); } output is : public bar ok
public static int addValues(ArrayList<? extends Alpha> arr, Gamma gam) { int sum = 0; for (Alpha alpha : arr) { try { sum += alpha.value(gam); } catch (Exception e) { } } return sum; }
/** * Called from the RotationInterpolator, indicating that the animation was * paused. */ private void animationPaused() { rotpol.setEnable(false); incorporateAnimationInRotation(); animation.setStartTime(System.currentTimeMillis()); fireTransformationUpdated(); fireTransformationFinished(); }
function Alpha() { this.onion = 'onion'; var Beta = function () { alert(this.onion); }.bind(this); Beta(); } var alpha1 = new Alpha(); // Alerts 'onion'
/** * This method is invoked by the behavior scheduler every frame. * First it gets the alpha value that corresponds to the current time. * Then it calls computeTransform() method to computes the transform based on this * alpha vaule, and updates the specified TransformGroup node with this new transform. * @param criteria an enumeration of the criteria that caused the * stimulus */ @Override public void processStimulus(Enumeration criteria) { // Handle stimulus WakeupCriterion criterion = passiveWakeupCriterion; if (alpha != null) { float value = alpha.value(); if (value != prevAlphaValue) { computeTransform(value, currentTransform); target.setTransform(currentTransform); prevAlphaValue = value; } if (!alpha.finished() && !alpha.isPaused()) { criterion = defaultWakeupCriterion; } } wakeupOn(criterion); }