.class public Lcom/facebook/rebound/Spring; .super Ljava/lang/Object; .source "Spring.java" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/facebook/rebound/Spring$PhysicsState; } .end annotation # static fields .field private static ID:I = 0x0 .field private static final MAX_DELTA_TIME_SEC:D = 0.064 .field private static final SOLVER_TIMESTEP_SEC:D = 0.001 # instance fields .field private final mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; .field private mDisplacementFromRestThreshold:D .field private mEndValue:D .field private final mId:Ljava/lang/String; .field private mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/concurrent/CopyOnWriteArraySet", "<", "Lcom/facebook/rebound/SpringListener;", ">;" } .end annotation .end field .field private mOvershootClampingEnabled:Z .field private final mPreviousState:Lcom/facebook/rebound/Spring$PhysicsState; .field private mRestSpeedThreshold:D .field private mSpringConfig:Lcom/facebook/rebound/SpringConfig; .field private final mSpringSystem:Lcom/facebook/rebound/BaseSpringSystem; .field private mStartValue:D .field private final mTempState:Lcom/facebook/rebound/Spring$PhysicsState; .field private mTimeAccumulator:D .field private mWasAtRest:Z # direct methods .method static constructor ()V .locals 1 .prologue .line 21 const/4 v0, 0x0 sput v0, Lcom/facebook/rebound/Spring;->ID:I return-void .end method .method constructor (Lcom/facebook/rebound/BaseSpringSystem;)V .locals 4 .prologue const-wide v2, 0x3f747ae147ae147bL # 0.005 const/4 v1, 0x0 .line 56 invoke-direct {p0}, Ljava/lang/Object;->()V .line 39 new-instance v0, Lcom/facebook/rebound/Spring$PhysicsState; invoke-direct {v0, v1}, Lcom/facebook/rebound/Spring$PhysicsState;->(Lcom/facebook/rebound/Spring$1;)V iput-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; .line 40 new-instance v0, Lcom/facebook/rebound/Spring$PhysicsState; invoke-direct {v0, v1}, Lcom/facebook/rebound/Spring$PhysicsState;->(Lcom/facebook/rebound/Spring$1;)V iput-object v0, p0, Lcom/facebook/rebound/Spring;->mPreviousState:Lcom/facebook/rebound/Spring$PhysicsState; .line 41 new-instance v0, Lcom/facebook/rebound/Spring$PhysicsState; invoke-direct {v0, v1}, Lcom/facebook/rebound/Spring$PhysicsState;->(Lcom/facebook/rebound/Spring$1;)V iput-object v0, p0, Lcom/facebook/rebound/Spring;->mTempState:Lcom/facebook/rebound/Spring$PhysicsState; .line 44 const/4 v0, 0x1 iput-boolean v0, p0, Lcom/facebook/rebound/Spring;->mWasAtRest:Z .line 46 iput-wide v2, p0, Lcom/facebook/rebound/Spring;->mRestSpeedThreshold:D .line 47 iput-wide v2, p0, Lcom/facebook/rebound/Spring;->mDisplacementFromRestThreshold:D .line 48 new-instance v0, Ljava/util/concurrent/CopyOnWriteArraySet; invoke-direct {v0}, Ljava/util/concurrent/CopyOnWriteArraySet;->()V iput-object v0, p0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; .line 49 const-wide/16 v0, 0x0 iput-wide v0, p0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D .line 57 if-nez p1, :cond_0 .line 58 new-instance v0, Ljava/lang/IllegalArgumentException; const-string v1, "Spring cannot be created outside of a BaseSpringSystem" invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw v0 .line 60 :cond_0 iput-object p1, p0, Lcom/facebook/rebound/Spring;->mSpringSystem:Lcom/facebook/rebound/BaseSpringSystem; .line 61 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;->()V const-string v1, "spring:" invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 sget v1, Lcom/facebook/rebound/Spring;->ID:I add-int/lit8 v2, v1, 0x1 sput v2, Lcom/facebook/rebound/Spring;->ID:I invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 iput-object v0, p0, Lcom/facebook/rebound/Spring;->mId:Ljava/lang/String; .line 62 sget-object v0, Lcom/facebook/rebound/SpringConfig;->defaultConfig:Lcom/facebook/rebound/SpringConfig; invoke-virtual {p0, v0}, Lcom/facebook/rebound/Spring;->setSpringConfig(Lcom/facebook/rebound/SpringConfig;)Lcom/facebook/rebound/Spring; .line 63 return-void .end method .method private getDisplacementDistanceForState(Lcom/facebook/rebound/Spring$PhysicsState;)D .locals 4 .prologue .line 151 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mEndValue:D iget-wide v2, p1, Lcom/facebook/rebound/Spring$PhysicsState;->position:D sub-double/2addr v0, v2 invoke-static {v0, v1}, Ljava/lang/Math;->abs(D)D move-result-wide v0 return-wide v0 .end method .method private interpolate(D)V .locals 11 .prologue const-wide/high16 v8, 0x3ff0000000000000L # 1.0 .line 468 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-object v1, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v2, v1, Lcom/facebook/rebound/Spring$PhysicsState;->position:D mul-double/2addr v2, p1 iget-object v1, p0, Lcom/facebook/rebound/Spring;->mPreviousState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v4, v1, Lcom/facebook/rebound/Spring$PhysicsState;->position:D sub-double v6, v8, p1 mul-double/2addr v4, v6 add-double/2addr v2, v4 iput-wide v2, v0, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 469 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-object v1, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v2, v1, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D mul-double/2addr v2, p1 iget-object v1, p0, Lcom/facebook/rebound/Spring;->mPreviousState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v4, v1, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D sub-double v6, v8, p1 mul-double/2addr v4, v6 add-double/2addr v2, v4 iput-wide v2, v0, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 470 return-void .end method # virtual methods .method public addListener(Lcom/facebook/rebound/SpringListener;)Lcom/facebook/rebound/Spring; .locals 2 .prologue .line 480 if-nez p1, :cond_0 .line 481 new-instance v0, Ljava/lang/IllegalArgumentException; const-string v1, "newListener is required" invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw v0 .line 483 :cond_0 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; invoke-virtual {v0, p1}, Ljava/util/concurrent/CopyOnWriteArraySet;->add(Ljava/lang/Object;)Z .line 484 return-object p0 .end method .method advance(D)V .locals 33 .prologue .line 272 invoke-virtual/range {p0 .. p0}, Lcom/facebook/rebound/Spring;->isAtRest()Z move-result v10 .line 274 if-eqz v10, :cond_1 move-object/from16 v0, p0 iget-boolean v2, v0, Lcom/facebook/rebound/Spring;->mWasAtRest:Z if-eqz v2, :cond_1 .line 421 :cond_0 return-void .line 284 :cond_1 const-wide v2, 0x3fb0624dd2f1a9fcL # 0.064 cmpl-double v2, p1, v2 if-lez v2, :cond_2 .line 285 const-wide p1, 0x3fb0624dd2f1a9fcL # 0.064 .line 293 :cond_2 move-object/from16 v0, p0 iget-wide v2, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D add-double v2, v2, p1 move-object/from16 v0, p0 iput-wide v2, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D .line 295 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mSpringConfig:Lcom/facebook/rebound/SpringConfig; iget-wide v12, v2, Lcom/facebook/rebound/SpringConfig;->tension:D .line 296 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mSpringConfig:Lcom/facebook/rebound/SpringConfig; iget-wide v14, v2, Lcom/facebook/rebound/SpringConfig;->friction:D .line 298 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v8, v2, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 299 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v6, v2, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 300 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mTempState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v4, v2, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 301 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mTempState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v2, v2, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 311 :goto_0 move-object/from16 v0, p0 iget-wide v0, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D move-wide/from16 v16, v0 const-wide v18, 0x3f50624dd2f1a9fcL # 0.001 cmpl-double v11, v16, v18 if-ltz v11, :cond_4 .line 315 move-object/from16 v0, p0 iget-wide v2, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D const-wide v16, 0x3f50624dd2f1a9fcL # 0.001 sub-double v2, v2, v16 move-object/from16 v0, p0 iput-wide v2, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D .line 317 move-object/from16 v0, p0 iget-wide v2, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D const-wide v16, 0x3f50624dd2f1a9fcL # 0.001 cmpg-double v2, v2, v16 if-gez v2, :cond_3 .line 320 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mPreviousState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide v8, v2, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 321 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mPreviousState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide v6, v2, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 333 :cond_3 move-object/from16 v0, p0 iget-wide v2, v0, Lcom/facebook/rebound/Spring;->mEndValue:D sub-double/2addr v2, v4 mul-double/2addr v2, v12 mul-double v4, v14, v6 sub-double v16, v2, v4 .line 337 const-wide v2, 0x3f50624dd2f1a9fcL # 0.001 mul-double/2addr v2, v6 const-wide/high16 v4, 0x3fe0000000000000L # 0.5 mul-double/2addr v2, v4 add-double/2addr v2, v8 .line 338 const-wide v4, 0x3f50624dd2f1a9fcL # 0.001 mul-double v4, v4, v16 const-wide/high16 v18, 0x3fe0000000000000L # 0.5 mul-double v4, v4, v18 add-double v18, v6, v4 .line 340 move-object/from16 v0, p0 iget-wide v4, v0, Lcom/facebook/rebound/Spring;->mEndValue:D sub-double v2, v4, v2 mul-double/2addr v2, v12 mul-double v4, v14, v18 sub-double v20, v2, v4 .line 342 const-wide v2, 0x3f50624dd2f1a9fcL # 0.001 mul-double v2, v2, v18 const-wide/high16 v4, 0x3fe0000000000000L # 0.5 mul-double/2addr v2, v4 add-double/2addr v2, v8 .line 343 const-wide v4, 0x3f50624dd2f1a9fcL # 0.001 mul-double v4, v4, v20 const-wide/high16 v22, 0x3fe0000000000000L # 0.5 mul-double v4, v4, v22 add-double v22, v6, v4 .line 345 move-object/from16 v0, p0 iget-wide v4, v0, Lcom/facebook/rebound/Spring;->mEndValue:D sub-double v2, v4, v2 mul-double/2addr v2, v12 mul-double v4, v14, v22 sub-double v24, v2, v4 .line 347 const-wide v2, 0x3f50624dd2f1a9fcL # 0.001 mul-double v2, v2, v22 add-double v4, v8, v2 .line 348 const-wide v2, 0x3f50624dd2f1a9fcL # 0.001 mul-double v2, v2, v24 add-double/2addr v2, v6 .line 350 move-object/from16 v0, p0 iget-wide v0, v0, Lcom/facebook/rebound/Spring;->mEndValue:D move-wide/from16 v26, v0 sub-double v26, v26, v4 mul-double v26, v26, v12 mul-double v28, v14, v2 sub-double v26, v26, v28 .line 353 const-wide v28, 0x3fc5555555555555L # 0.16666666666666666 const-wide/high16 v30, 0x4000000000000000L # 2.0 add-double v18, v18, v22 mul-double v18, v18, v30 add-double v18, v18, v6 add-double v18, v18, v2 mul-double v18, v18, v28 .line 354 const-wide v22, 0x3fc5555555555555L # 0.16666666666666666 const-wide/high16 v28, 0x4000000000000000L # 2.0 add-double v20, v20, v24 mul-double v20, v20, v28 add-double v16, v16, v20 add-double v16, v16, v26 mul-double v16, v16, v22 .line 356 const-wide v20, 0x3f50624dd2f1a9fcL # 0.001 mul-double v18, v18, v20 add-double v8, v8, v18 .line 357 const-wide v18, 0x3f50624dd2f1a9fcL # 0.001 mul-double v16, v16, v18 add-double v6, v6, v16 goto/16 :goto_0 .line 360 :cond_4 move-object/from16 v0, p0 iget-object v11, v0, Lcom/facebook/rebound/Spring;->mTempState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide v4, v11, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 361 move-object/from16 v0, p0 iget-object v4, v0, Lcom/facebook/rebound/Spring;->mTempState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide v2, v4, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 363 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide v8, v2, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 364 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide v6, v2, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 366 move-object/from16 v0, p0 iget-wide v2, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D const-wide/16 v4, 0x0 cmpl-double v2, v2, v4 if-lez v2, :cond_5 .line 367 move-object/from16 v0, p0 iget-wide v2, v0, Lcom/facebook/rebound/Spring;->mTimeAccumulator:D const-wide v4, 0x3f50624dd2f1a9fcL # 0.001 div-double/2addr v2, v4 move-object/from16 v0, p0 invoke-direct {v0, v2, v3}, Lcom/facebook/rebound/Spring;->interpolate(D)V .line 373 :cond_5 invoke-virtual/range {p0 .. p0}, Lcom/facebook/rebound/Spring;->isAtRest()Z move-result v2 if-nez v2, :cond_6 move-object/from16 v0, p0 iget-boolean v2, v0, Lcom/facebook/rebound/Spring;->mOvershootClampingEnabled:Z if-eqz v2, :cond_b invoke-virtual/range {p0 .. p0}, Lcom/facebook/rebound/Spring;->isOvershooting()Z move-result v2 if-eqz v2, :cond_b .line 375 :cond_6 move-object/from16 v0, p0 iget-wide v2, v0, Lcom/facebook/rebound/Spring;->mEndValue:D move-object/from16 v0, p0 iput-wide v2, v0, Lcom/facebook/rebound/Spring;->mStartValue:D .line 376 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; move-object/from16 v0, p0 iget-wide v4, v0, Lcom/facebook/rebound/Spring;->mEndValue:D iput-wide v4, v2, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 377 const-wide/16 v2, 0x0 move-object/from16 v0, p0 invoke-virtual {v0, v2, v3}, Lcom/facebook/rebound/Spring;->setVelocity(D)Lcom/facebook/rebound/Spring; .line 378 const/4 v2, 0x1 .line 397 :goto_1 const/4 v3, 0x0 .line 398 move-object/from16 v0, p0 iget-boolean v4, v0, Lcom/facebook/rebound/Spring;->mWasAtRest:Z if-eqz v4, :cond_a .line 399 const/4 v3, 0x0 move-object/from16 v0, p0 iput-boolean v3, v0, Lcom/facebook/rebound/Spring;->mWasAtRest:Z .line 400 const/4 v3, 0x1 move v4, v3 .line 402 :goto_2 const/4 v3, 0x0 .line 403 if-eqz v2, :cond_7 .line 404 const/4 v2, 0x1 move-object/from16 v0, p0 iput-boolean v2, v0, Lcom/facebook/rebound/Spring;->mWasAtRest:Z .line 405 const/4 v2, 0x1 move v3, v2 .line 407 :cond_7 move-object/from16 v0, p0 iget-object v2, v0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; invoke-virtual {v2}, Ljava/util/concurrent/CopyOnWriteArraySet;->iterator()Ljava/util/Iterator; move-result-object v5 :cond_8 :goto_3 invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z move-result v2 if-eqz v2, :cond_0 invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v2 check-cast v2, Lcom/facebook/rebound/SpringListener; .line 409 if-eqz v4, :cond_9 .line 410 move-object/from16 v0, p0 invoke-interface {v2, v0}, Lcom/facebook/rebound/SpringListener;->onSpringActivate(Lcom/facebook/rebound/Spring;)V .line 414 :cond_9 move-object/from16 v0, p0 invoke-interface {v2, v0}, Lcom/facebook/rebound/SpringListener;->onSpringUpdate(Lcom/facebook/rebound/Spring;)V .line 417 if-eqz v3, :cond_8 .line 418 move-object/from16 v0, p0 invoke-interface {v2, v0}, Lcom/facebook/rebound/SpringListener;->onSpringAtRest(Lcom/facebook/rebound/Spring;)V goto :goto_3 :cond_a move v4, v3 goto :goto_2 :cond_b move v2, v10 goto :goto_1 .end method .method public currentValueIsApproximately(D)Z .locals 5 .prologue .line 517 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getCurrentValue()D move-result-wide v0 sub-double/2addr v0, p1 invoke-static {v0, v1}, Ljava/lang/Math;->abs(D)D move-result-wide v0 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getRestDisplacementThreshold()D move-result-wide v2 cmpg-double v0, v0, v2 if-gtz v0, :cond_0 const/4 v0, 0x1 :goto_0 return v0 :cond_0 const/4 v0, 0x0 goto :goto_0 .end method .method public destroy()V .locals 1 .prologue .line 71 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArraySet;->clear()V .line 72 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mSpringSystem:Lcom/facebook/rebound/BaseSpringSystem; invoke-virtual {v0, p0}, Lcom/facebook/rebound/BaseSpringSystem;->deregisterSpring(Lcom/facebook/rebound/Spring;)V .line 73 return-void .end method .method public getCurrentDisplacementDistance()D .locals 2 .prologue .line 142 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; invoke-direct {p0, v0}, Lcom/facebook/rebound/Spring;->getDisplacementDistanceForState(Lcom/facebook/rebound/Spring$PhysicsState;)D move-result-wide v0 return-wide v0 .end method .method public getCurrentValue()D .locals 2 .prologue .line 134 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v0, v0, Lcom/facebook/rebound/Spring$PhysicsState;->position:D return-wide v0 .end method .method public getEndValue()D .locals 2 .prologue .line 177 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mEndValue:D return-wide v0 .end method .method public getId()Ljava/lang/String; .locals 1 .prologue .line 80 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mId:Ljava/lang/String; return-object v0 .end method .method public getRestDisplacementThreshold()D .locals 2 .prologue .line 232 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mDisplacementFromRestThreshold:D return-wide v0 .end method .method public getRestSpeedThreshold()D .locals 2 .prologue .line 214 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mRestSpeedThreshold:D return-wide v0 .end method .method public getSpringConfig()Lcom/facebook/rebound/SpringConfig; .locals 1 .prologue .line 101 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mSpringConfig:Lcom/facebook/rebound/SpringConfig; return-object v0 .end method .method public getStartValue()D .locals 2 .prologue .line 126 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mStartValue:D return-wide v0 .end method .method public getVelocity()D .locals 2 .prologue .line 196 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v0, v0, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D return-wide v0 .end method .method public isAtRest()Z .locals 4 .prologue .line 446 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v0, v0, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D invoke-static {v0, v1}, Ljava/lang/Math;->abs(D)D move-result-wide v0 iget-wide v2, p0, Lcom/facebook/rebound/Spring;->mRestSpeedThreshold:D cmpg-double v0, v0, v2 if-gtz v0, :cond_0 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; .line 447 invoke-direct {p0, v0}, Lcom/facebook/rebound/Spring;->getDisplacementDistanceForState(Lcom/facebook/rebound/Spring$PhysicsState;)D move-result-wide v0 iget-wide v2, p0, Lcom/facebook/rebound/Spring;->mDisplacementFromRestThreshold:D cmpg-double v0, v0, v2 if-gtz v0, :cond_0 const/4 v0, 0x1 :goto_0 return v0 :cond_0 const/4 v0, 0x0 goto :goto_0 .end method .method public isOvershootClampingEnabled()Z .locals 1 .prologue .line 250 iget-boolean v0, p0, Lcom/facebook/rebound/Spring;->mOvershootClampingEnabled:Z return v0 .end method .method public isOvershooting()Z .locals 4 .prologue .line 258 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mStartValue:D iget-wide v2, p0, Lcom/facebook/rebound/Spring;->mEndValue:D cmpg-double v0, v0, v2 if-gez v0, :cond_0 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getCurrentValue()D move-result-wide v0 iget-wide v2, p0, Lcom/facebook/rebound/Spring;->mEndValue:D cmpl-double v0, v0, v2 if-gtz v0, :cond_1 :cond_0 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mStartValue:D iget-wide v2, p0, Lcom/facebook/rebound/Spring;->mEndValue:D cmpl-double v0, v0, v2 if-lez v0, :cond_2 .line 259 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getCurrentValue()D move-result-wide v0 iget-wide v2, p0, Lcom/facebook/rebound/Spring;->mEndValue:D cmpg-double v0, v0, v2 if-gez v0, :cond_2 :cond_1 const/4 v0, 0x1 :goto_0 return v0 :cond_2 const/4 v0, 0x0 goto :goto_0 .end method .method public removeAllListeners()Lcom/facebook/rebound/Spring; .locals 1 .prologue .line 505 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArraySet;->clear()V .line 506 return-object p0 .end method .method public removeListener(Lcom/facebook/rebound/SpringListener;)Lcom/facebook/rebound/Spring; .locals 2 .prologue .line 493 if-nez p1, :cond_0 .line 494 new-instance v0, Ljava/lang/IllegalArgumentException; const-string v1, "listenerToRemove is required" invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw v0 .line 496 :cond_0 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; invoke-virtual {v0, p1}, Ljava/util/concurrent/CopyOnWriteArraySet;->remove(Ljava/lang/Object;)Z .line 497 return-object p0 .end method .method public setAtRest()Lcom/facebook/rebound/Spring; .locals 4 .prologue .line 456 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v0, v0, Lcom/facebook/rebound/Spring$PhysicsState;->position:D iput-wide v0, p0, Lcom/facebook/rebound/Spring;->mEndValue:D .line 457 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mTempState:Lcom/facebook/rebound/Spring$PhysicsState; iget-object v1, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iget-wide v2, v1, Lcom/facebook/rebound/Spring$PhysicsState;->position:D iput-wide v2, v0, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 458 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; const-wide/16 v2, 0x0 iput-wide v2, v0, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 459 return-object p0 .end method .method public setCurrentValue(D)Lcom/facebook/rebound/Spring; .locals 3 .prologue .line 112 iput-wide p1, p0, Lcom/facebook/rebound/Spring;->mStartValue:D .line 113 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide p1, v0, Lcom/facebook/rebound/Spring$PhysicsState;->position:D .line 114 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mSpringSystem:Lcom/facebook/rebound/BaseSpringSystem; invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getId()Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Lcom/facebook/rebound/BaseSpringSystem;->activateSpring(Ljava/lang/String;)V .line 115 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArraySet;->iterator()Ljava/util/Iterator; move-result-object v1 :goto_0 invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z move-result v0 if-eqz v0, :cond_0 invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v0 check-cast v0, Lcom/facebook/rebound/SpringListener; .line 116 invoke-interface {v0, p0}, Lcom/facebook/rebound/SpringListener;->onSpringUpdate(Lcom/facebook/rebound/Spring;)V goto :goto_0 .line 118 :cond_0 return-object p0 .end method .method public setEndValue(D)Lcom/facebook/rebound/Spring; .locals 3 .prologue .line 160 iget-wide v0, p0, Lcom/facebook/rebound/Spring;->mEndValue:D cmpl-double v0, v0, p1 if-nez v0, :cond_1 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->isAtRest()Z move-result v0 if-eqz v0, :cond_1 .line 169 :cond_0 return-object p0 .line 163 :cond_1 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getCurrentValue()D move-result-wide v0 iput-wide v0, p0, Lcom/facebook/rebound/Spring;->mStartValue:D .line 164 iput-wide p1, p0, Lcom/facebook/rebound/Spring;->mEndValue:D .line 165 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mSpringSystem:Lcom/facebook/rebound/BaseSpringSystem; invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getId()Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Lcom/facebook/rebound/BaseSpringSystem;->activateSpring(Ljava/lang/String;)V .line 166 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mListeners:Ljava/util/concurrent/CopyOnWriteArraySet; invoke-virtual {v0}, Ljava/util/concurrent/CopyOnWriteArraySet;->iterator()Ljava/util/Iterator; move-result-object v1 :goto_0 invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z move-result v0 if-eqz v0, :cond_0 invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v0 check-cast v0, Lcom/facebook/rebound/SpringListener; .line 167 invoke-interface {v0, p0}, Lcom/facebook/rebound/SpringListener;->onSpringEndStateChange(Lcom/facebook/rebound/Spring;)V goto :goto_0 .end method .method public setOvershootClampingEnabled(Z)Lcom/facebook/rebound/Spring; .locals 0 .prologue .line 241 iput-boolean p1, p0, Lcom/facebook/rebound/Spring;->mOvershootClampingEnabled:Z .line 242 return-object p0 .end method .method public setRestDisplacementThreshold(D)Lcom/facebook/rebound/Spring; .locals 1 .prologue .line 223 iput-wide p1, p0, Lcom/facebook/rebound/Spring;->mDisplacementFromRestThreshold:D .line 224 return-object p0 .end method .method public setRestSpeedThreshold(D)Lcom/facebook/rebound/Spring; .locals 1 .prologue .line 205 iput-wide p1, p0, Lcom/facebook/rebound/Spring;->mRestSpeedThreshold:D .line 206 return-object p0 .end method .method public setSpringConfig(Lcom/facebook/rebound/SpringConfig;)Lcom/facebook/rebound/Spring; .locals 2 .prologue .line 89 if-nez p1, :cond_0 .line 90 new-instance v0, Ljava/lang/IllegalArgumentException; const-string v1, "springConfig is required" invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw v0 .line 92 :cond_0 iput-object p1, p0, Lcom/facebook/rebound/Spring;->mSpringConfig:Lcom/facebook/rebound/SpringConfig; .line 93 return-object p0 .end method .method public setVelocity(D)Lcom/facebook/rebound/Spring; .locals 3 .prologue .line 186 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mCurrentState:Lcom/facebook/rebound/Spring$PhysicsState; iput-wide p1, v0, Lcom/facebook/rebound/Spring$PhysicsState;->velocity:D .line 187 iget-object v0, p0, Lcom/facebook/rebound/Spring;->mSpringSystem:Lcom/facebook/rebound/BaseSpringSystem; invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->getId()Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Lcom/facebook/rebound/BaseSpringSystem;->activateSpring(Ljava/lang/String;)V .line 188 return-object p0 .end method .method public systemShouldAdvance()Z .locals 1 .prologue .line 429 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->isAtRest()Z move-result v0 if-eqz v0, :cond_0 invoke-virtual {p0}, Lcom/facebook/rebound/Spring;->wasAtRest()Z move-result v0 if-nez v0, :cond_1 :cond_0 const/4 v0, 0x1 :goto_0 return v0 :cond_1 const/4 v0, 0x0 goto :goto_0 .end method .method public wasAtRest()Z .locals 1 .prologue .line 438 iget-boolean v0, p0, Lcom/facebook/rebound/Spring;->mWasAtRest:Z return v0 .end method