01: /*
02: * Copyright 2001-2007 Stephen Colebourne
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.joda.time;
17:
18: public class MockZone extends DateTimeZone {
19:
20: long transition;
21: int winterOffset;
22:
23: public MockZone(long transition, int winterOffset) {
24: super ("MockZone");
25: this .transition = transition;
26: this .winterOffset = winterOffset;
27: }
28:
29: public int getOffset(long instant) {
30: return (instant < transition ? winterOffset
31: : winterOffset + 3600000);
32: }
33:
34: public int getStandardOffset(long instant) {
35: return winterOffset;
36: }
37:
38: public long nextTransition(long instant) {
39: return (instant < transition ? transition : transition + 180L
40: * DateTimeConstants.MILLIS_PER_DAY);
41: }
42:
43: public long previousTransition(long instant) {
44: return (instant > transition ? transition : transition - 180L
45: * DateTimeConstants.MILLIS_PER_DAY);
46: }
47:
48: public boolean isFixed() {
49: return false;
50: }
51:
52: public String getNameKey(long instant) {
53: return null;
54: }
55:
56: public boolean equals(Object object) {
57: return false;
58: }
59: }
|