BaseInterval.java 5.16 KB
package org.joda.time.base;

import java.io.Serializable;
import org.joda.time.Chronology;
import org.joda.time.DateTimeUtils;
import org.joda.time.MutableInterval;
import org.joda.time.ReadWritableInterval;
import org.joda.time.ReadableDuration;
import org.joda.time.ReadableInstant;
import org.joda.time.ReadableInterval;
import org.joda.time.ReadablePeriod;
import org.joda.time.chrono.ISOChronology;
import org.joda.time.convert.ConverterManager;
import org.joda.time.convert.IntervalConverter;
import org.joda.time.field.FieldUtils;

public abstract class BaseInterval
  extends AbstractInterval
  implements Serializable, ReadableInterval
{
  private static final long serialVersionUID = 576586928732749278L;
  private volatile Chronology a;
  private volatile long b;
  private volatile long c;
  
  protected BaseInterval(long paramLong1, long paramLong2, Chronology paramChronology)
  {
    this.a = DateTimeUtils.getChronology(paramChronology);
    checkInterval(paramLong1, paramLong2);
    this.b = paramLong1;
    this.c = paramLong2;
  }
  
  protected BaseInterval(Object paramObject, Chronology paramChronology)
  {
    IntervalConverter localIntervalConverter = ConverterManager.getInstance().getIntervalConverter(paramObject);
    if (localIntervalConverter.isReadableInterval(paramObject, paramChronology))
    {
      paramObject = (ReadableInterval)paramObject;
      if (paramChronology != null)
      {
        this.a = paramChronology;
        this.b = ((ReadableInterval)paramObject).getStartMillis();
        this.c = ((ReadableInterval)paramObject).getEndMillis();
      }
    }
    for (;;)
    {
      checkInterval(this.b, this.c);
      return;
      paramChronology = ((ReadableInterval)paramObject).getChronology();
      break;
      if ((this instanceof ReadWritableInterval))
      {
        localIntervalConverter.setInto((ReadWritableInterval)this, paramObject, paramChronology);
      }
      else
      {
        MutableInterval localMutableInterval = new MutableInterval();
        localIntervalConverter.setInto(localMutableInterval, paramObject, paramChronology);
        this.a = localMutableInterval.getChronology();
        this.b = localMutableInterval.getStartMillis();
        this.c = localMutableInterval.getEndMillis();
      }
    }
  }
  
  protected BaseInterval(ReadableDuration paramReadableDuration, ReadableInstant paramReadableInstant)
  {
    this.a = DateTimeUtils.getInstantChronology(paramReadableInstant);
    this.c = DateTimeUtils.getInstantMillis(paramReadableInstant);
    long l = DateTimeUtils.getDurationMillis(paramReadableDuration);
    this.b = FieldUtils.safeAdd(this.c, -l);
    checkInterval(this.b, this.c);
  }
  
  protected BaseInterval(ReadableInstant paramReadableInstant, ReadableDuration paramReadableDuration)
  {
    this.a = DateTimeUtils.getInstantChronology(paramReadableInstant);
    this.b = DateTimeUtils.getInstantMillis(paramReadableInstant);
    long l = DateTimeUtils.getDurationMillis(paramReadableDuration);
    this.c = FieldUtils.safeAdd(this.b, l);
    checkInterval(this.b, this.c);
  }
  
  protected BaseInterval(ReadableInstant paramReadableInstant1, ReadableInstant paramReadableInstant2)
  {
    if ((paramReadableInstant1 == null) && (paramReadableInstant2 == null))
    {
      long l = DateTimeUtils.currentTimeMillis();
      this.c = l;
      this.b = l;
      this.a = ISOChronology.getInstance();
      return;
    }
    this.a = DateTimeUtils.getInstantChronology(paramReadableInstant1);
    this.b = DateTimeUtils.getInstantMillis(paramReadableInstant1);
    this.c = DateTimeUtils.getInstantMillis(paramReadableInstant2);
    checkInterval(this.b, this.c);
  }
  
  protected BaseInterval(ReadableInstant paramReadableInstant, ReadablePeriod paramReadablePeriod)
  {
    Chronology localChronology = DateTimeUtils.getInstantChronology(paramReadableInstant);
    this.a = localChronology;
    this.b = DateTimeUtils.getInstantMillis(paramReadableInstant);
    if (paramReadablePeriod == null) {}
    for (this.c = this.b;; this.c = localChronology.add(paramReadablePeriod, this.b, 1))
    {
      checkInterval(this.b, this.c);
      return;
    }
  }
  
  protected BaseInterval(ReadablePeriod paramReadablePeriod, ReadableInstant paramReadableInstant)
  {
    Chronology localChronology = DateTimeUtils.getInstantChronology(paramReadableInstant);
    this.a = localChronology;
    this.c = DateTimeUtils.getInstantMillis(paramReadableInstant);
    if (paramReadablePeriod == null) {}
    for (this.b = this.c;; this.b = localChronology.add(paramReadablePeriod, this.c, -1))
    {
      checkInterval(this.b, this.c);
      return;
    }
  }
  
  public Chronology getChronology()
  {
    return this.a;
  }
  
  public long getEndMillis()
  {
    return this.c;
  }
  
  public long getStartMillis()
  {
    return this.b;
  }
  
  protected void setInterval(long paramLong1, long paramLong2, Chronology paramChronology)
  {
    checkInterval(paramLong1, paramLong2);
    this.b = paramLong1;
    this.c = paramLong2;
    this.a = DateTimeUtils.getChronology(paramChronology);
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/org/joda/time/base/BaseInterval.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */