1   /*
2    *  Copyright 2001-2007 Stephen Colebourne
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
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 : winterOffset + 3600000);
31      }
32  
33      public int getStandardOffset(long instant) {
34          return winterOffset;
35      }
36  
37      public long nextTransition(long instant) {
38          return (instant < transition ? transition : transition + 180L * DateTimeConstants.MILLIS_PER_DAY);
39      }
40  
41      public long previousTransition(long instant) {
42          return (instant > transition ? transition : transition - 180L * DateTimeConstants.MILLIS_PER_DAY);
43      }
44  
45      public boolean isFixed() {
46          return false;
47      }
48  
49      public String getNameKey(long instant) {
50          return null;
51      }
52  
53      public boolean equals(Object object) {
54          return false;
55      }
56  }