001    /*
002     *  Copyright 2001-2007 Stephen Colebourne
003     *
004     *  Licensed under the Apache License, Version 2.0 (the "License");
005     *  you may not use this file except in compliance with the License.
006     *  You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     *  Unless required by applicable law or agreed to in writing, software
011     *  distributed under the License is distributed on an "AS IS" BASIS,
012     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     *  See the License for the specific language governing permissions and
014     *  limitations under the License.
015     */
016    package org.joda.time;
017    
018    public class MockZone extends DateTimeZone {
019    
020        long transition;
021        int winterOffset;
022        int sizeMillis;
023    
024        public MockZone(long transition, int winterOffset, int sizeSecs) {
025            super("MockZone");
026            this.transition = transition;
027            this.winterOffset = winterOffset;
028            this.sizeMillis = sizeSecs * 1000;
029        }
030    
031        public int getOffset(long instant) {
032            return (instant < transition ? winterOffset : winterOffset + sizeMillis);
033        }
034    
035        public int getStandardOffset(long instant) {
036            return winterOffset;
037        }
038    
039        public long nextTransition(long instant) {
040            return (instant < transition ? transition : transition + 180L * DateTimeConstants.MILLIS_PER_DAY);
041        }
042    
043        public long previousTransition(long instant) {
044            return (instant > transition ? transition : transition - 180L * DateTimeConstants.MILLIS_PER_DAY);
045        }
046    
047        public boolean isFixed() {
048            return false;
049        }
050    
051        public String getNameKey(long instant) {
052            return null;
053        }
054    
055        public boolean equals(Object object) {
056            return false;
057        }
058    }