BuddhistChronology.java 4.22 KB
package org.joda.time.chrono;

import java.util.HashMap;
import java.util.Map;
import org.joda.time.Chronology;
import org.joda.time.DateTime;
import org.joda.time.DateTimeField;
import org.joda.time.DateTimeFieldType;
import org.joda.time.DateTimeZone;
import org.joda.time.field.DelegatedDateTimeField;
import org.joda.time.field.DividedDateTimeField;
import org.joda.time.field.OffsetDateTimeField;
import org.joda.time.field.RemainderDateTimeField;
import org.joda.time.field.SkipUndoDateTimeField;
import um;

public final class BuddhistChronology
  extends AssembledChronology
{
  public static final int BE = 1;
  private static final DateTimeField a = new um("BE");
  private static final Map<DateTimeZone, BuddhistChronology> b = new HashMap();
  private static final BuddhistChronology c = getInstance(DateTimeZone.UTC);
  private static final long serialVersionUID = -3474595157769370126L;
  
  private BuddhistChronology(Chronology paramChronology, Object paramObject)
  {
    super(paramChronology, paramObject);
  }
  
  public static BuddhistChronology getInstance()
  {
    return getInstance(DateTimeZone.getDefault());
  }
  
  public static BuddhistChronology getInstance(DateTimeZone paramDateTimeZone)
  {
    DateTimeZone localDateTimeZone = paramDateTimeZone;
    if (paramDateTimeZone == null) {}
    try
    {
      localDateTimeZone = DateTimeZone.getDefault();
      BuddhistChronology localBuddhistChronology = (BuddhistChronology)b.get(localDateTimeZone);
      paramDateTimeZone = localBuddhistChronology;
      if (localBuddhistChronology == null)
      {
        paramDateTimeZone = new BuddhistChronology(GJChronology.getInstance(localDateTimeZone, null), null);
        paramDateTimeZone = new BuddhistChronology(LimitChronology.getInstance(paramDateTimeZone, new DateTime(1, 1, 1, 0, 0, 0, 0, paramDateTimeZone), null), "");
        b.put(localDateTimeZone, paramDateTimeZone);
      }
      return paramDateTimeZone;
    }
    finally {}
  }
  
  public static BuddhistChronology getInstanceUTC()
  {
    return c;
  }
  
  private Object readResolve()
  {
    Chronology localChronology = getBase();
    if (localChronology == null) {
      return getInstanceUTC();
    }
    return getInstance(localChronology.getZone());
  }
  
  protected final void assemble(AssembledChronology.Fields paramFields)
  {
    if (getParam() == null)
    {
      paramFields.year = new OffsetDateTimeField(new SkipUndoDateTimeField(this, paramFields.year), 543);
      paramFields.yearOfEra = new DelegatedDateTimeField(paramFields.year, DateTimeFieldType.yearOfEra());
      paramFields.weekyear = new OffsetDateTimeField(new SkipUndoDateTimeField(this, paramFields.weekyear), 543);
      paramFields.centuryOfEra = new DividedDateTimeField(new OffsetDateTimeField(paramFields.yearOfEra, 99), DateTimeFieldType.centuryOfEra(), 100);
      paramFields.yearOfCentury = new OffsetDateTimeField(new RemainderDateTimeField((DividedDateTimeField)paramFields.centuryOfEra), DateTimeFieldType.yearOfCentury(), 1);
      paramFields.weekyearOfCentury = new OffsetDateTimeField(new RemainderDateTimeField(paramFields.weekyear, DateTimeFieldType.weekyearOfCentury(), 100), DateTimeFieldType.weekyearOfCentury(), 1);
      paramFields.era = a;
    }
  }
  
  public final boolean equals(Object paramObject)
  {
    return super.equals(paramObject);
  }
  
  public final int hashCode()
  {
    return "Buddhist".hashCode() * 11 + getZone().hashCode();
  }
  
  public final String toString()
  {
    String str = "BuddhistChronology";
    DateTimeZone localDateTimeZone = getZone();
    if (localDateTimeZone != null) {
      str = "BuddhistChronology" + '[' + localDateTimeZone.getID() + ']';
    }
    return str;
  }
  
  public final Chronology withUTC()
  {
    return c;
  }
  
  public final Chronology withZone(DateTimeZone paramDateTimeZone)
  {
    DateTimeZone localDateTimeZone = paramDateTimeZone;
    if (paramDateTimeZone == null) {
      localDateTimeZone = DateTimeZone.getDefault();
    }
    if (localDateTimeZone == getZone()) {
      return this;
    }
    return getInstance(localDateTimeZone);
  }
}


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