package com.worklight.location.internal.geo.triggerEvaluators;

import com.worklight.location.api.WLConfidenceLevel;
import com.worklight.location.api.geo.WLArea;
import com.worklight.location.api.geo.WLCoordinate;
import com.worklight.location.api.geo.WLGeoPosition;
import com.worklight.location.api.geo.WLGeoUtils;
import com.worklight.location.internal.geo.triggers.AbstractGeoAreaTrigger;

abstract class GeoAreaTriggerEvaluator extends GeoTriggerEvaluator
{
  private Boolean isInsideArea = null;
  protected final boolean shouldBeInside;

  protected GeoAreaTriggerEvaluator(AbstractGeoAreaTrigger paramAbstractGeoAreaTrigger, boolean paramBoolean)
  {
    super(paramAbstractGeoAreaTrigger);
    this.shouldBeInside = paramBoolean;
  }

  public AbstractGeoAreaTrigger getTriggerDefinition()
  {
    return (AbstractGeoAreaTrigger)super.getTriggerDefinition();
  }

  protected boolean isInLimbo()
  {
    return this.isInsideArea == null;
  }

  protected boolean isInsideArea()
  {
    return (!isInLimbo()) && (this.isInsideArea.booleanValue());
  }

  protected boolean isOutsideArea()
  {
    return (!isInLimbo()) && (!this.isInsideArea.booleanValue());
  }

  protected void updatePosition(WLGeoPosition paramWLGeoPosition)
  {
    WLArea localWLArea = getTriggerDefinition().getArea();
    WLConfidenceLevel localWLConfidenceLevel1 = getTriggerDefinition().getConfidenceLevel();
    double d = getTriggerDefinition().getBufferZoneWidth();
    WLCoordinate localWLCoordinate1 = paramWLGeoPosition.getCoordinate();
    WLConfidenceLevel localWLConfidenceLevel2;
    boolean bool1;
    boolean bool2;
    if (this.shouldBeInside)
    {
      localWLConfidenceLevel2 = localWLConfidenceLevel1;
      bool1 = WLGeoUtils.isInsideArea(localWLCoordinate1, localWLArea, d, localWLConfidenceLevel2);
      WLCoordinate localWLCoordinate2 = paramWLGeoPosition.getCoordinate();
      if (this.shouldBeInside)
        localWLConfidenceLevel1 = WLConfidenceLevel.LOW;
      bool2 = WLGeoUtils.isOutsideArea(localWLCoordinate2, localWLArea, d, localWLConfidenceLevel1);
      if (this.isInsideArea != null)
        break label124;
      if (!bool1)
        break label110;
      this.isInsideArea = Boolean.valueOf(true);
    }
    label110: label124: 
    do
    {
      do
      {
        do
        {
          return;
          localWLConfidenceLevel2 = WLConfidenceLevel.LOW;
          break;
        }
        while (!bool2);
        this.isInsideArea = Boolean.valueOf(false);
        return;
        if (!this.isInsideArea.booleanValue())
          break label148;
      }
      while (!bool2);
      this.isInsideArea = Boolean.valueOf(false);
      return;
    }
    while (!bool1);
    label148: this.isInsideArea = Boolean.valueOf(true);
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.worklight.location.internal.geo.triggerEvaluators.GeoAreaTriggerEvaluator
 * JD-Core Version:    0.6.2
 */