001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    /**
018     * @author Brian Wing Shun Chan
019     */
020    public class ShortWrapper
021            extends PrimitiveWrapper implements Comparable<ShortWrapper> {
022    
023            public static final Class<?> TYPE = Short.TYPE;
024    
025            public ShortWrapper() {
026                    this((short)0);
027            }
028    
029            public ShortWrapper(short value) {
030                    _value = value;
031            }
032    
033            public int compareTo(ShortWrapper shortWrapper) {
034                    if (shortWrapper == null) {
035                            return 1;
036                    }
037    
038                    if (getValue() > shortWrapper.getValue()) {
039                            return 1;
040                    }
041                    else if (getValue() < shortWrapper.getValue()) {
042                            return -1;
043                    }
044                    else {
045                            return 0;
046                    }
047            }
048    
049            public short getValue() {
050                    return _value;
051            }
052    
053            public void setValue(short value) {
054                    _value = value;
055            }
056    
057            public short increment() {
058                    return ++_value;
059            }
060    
061            public short decrement() {
062                    return --_value;
063            }
064    
065            private short _value;
066    
067    }