1 16 package org.joda.time.tz; 17 18 import org.joda.time.DateTimeZone; 19 20 28 public final class FixedDateTimeZone extends DateTimeZone { 29 30 private static final long serialVersionUID = -3513011772763289092L; 31 32 private final String iNameKey; 33 private final int iWallOffset; 34 private final int iStandardOffset; 35 36 public FixedDateTimeZone(String id, String nameKey, 37 int wallOffset, int standardOffset) { 38 super(id); 39 iNameKey = nameKey; 40 iWallOffset = wallOffset; 41 iStandardOffset = standardOffset; 42 } 43 44 public String getNameKey(long instant) { 45 return iNameKey; 46 } 47 48 public int getOffset(long instant) { 49 return iWallOffset; 50 } 51 52 public int getStandardOffset(long instant) { 53 return iStandardOffset; 54 } 55 56 public int getOffsetFromLocal(long instantLocal) { 57 return iWallOffset; 58 } 59 60 public boolean isFixed() { 61 return true; 62 } 63 64 public long nextTransition(long instant) { 65 return instant; 66 } 67 68 public long previousTransition(long instant) { 69 return instant; 70 } 71 72 public boolean equals(Object obj) { 73 if (this == obj) { 74 return true; 75 } 76 if (obj instanceof FixedDateTimeZone) { 77 FixedDateTimeZone other = (FixedDateTimeZone)obj; 78 return 79 getID().equals(other.getID()) && 80 iStandardOffset == other.iStandardOffset && 81 iWallOffset == other.iWallOffset; 82 } 83 return false; 84 } 85 86 public int hashCode() { 87 return getID().hashCode() + 37 * iStandardOffset + 31 * iWallOffset; 88 } 89 90 } 91 | Popular Tags |