MonitorState.java 1.44 KB
package com.radiusnetworks.ibeacon.service;

import java.util.Date;

public class MonitorState
{
  public static long INSIDE_EXPIRATION_MILLIS = 10000L;
  private boolean a = false;
  private long b = 0L;
  private Callback c;
  
  public MonitorState(Callback paramCallback)
  {
    this.c = paramCallback;
  }
  
  public Callback getCallback()
  {
    return this.c;
  }
  
  public boolean isInside()
  {
    return (this.a) && (!isNewlyOutside());
  }
  
  public boolean isNewlyOutside()
  {
    boolean bool2 = false;
    boolean bool1 = bool2;
    if (this.a)
    {
      bool1 = bool2;
      if (this.b > 0L)
      {
        bool1 = bool2;
        if (new Date().getTime() - this.b > INSIDE_EXPIRATION_MILLIS)
        {
          this.a = false;
          new StringBuilder("We are newly outside the region because the lastSeenTime of ").append(this.b).append(" was ").append(new Date().getTime() - this.b).append(" seconds ago, and that is over the expiration duration of  ").append(INSIDE_EXPIRATION_MILLIS);
          this.b = 0L;
          bool1 = true;
        }
      }
    }
    return bool1;
  }
  
  public boolean markInside()
  {
    this.b = new Date().getTime();
    if (!this.a)
    {
      this.a = true;
      return true;
    }
    return false;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/radiusnetworks/ibeacon/service/MonitorState.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */