001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.tools.sourceformatter;
016    
017    /**
018     * @author Carlos Sierra Andr??s
019     */
020    public class ImportPackage implements Comparable<ImportPackage> {
021    
022            @Override
023            public int compareTo(ImportPackage importPackage) {
024                    return _import.compareTo(importPackage._import);
025            }
026    
027            @Override
028            public boolean equals(Object obj) {
029                    if (this == obj) {
030                            return true;
031                    }
032    
033                    if (!(obj instanceof ImportPackage)) {
034                            return false;
035                    }
036    
037                    ImportPackage importPackage = (ImportPackage)obj;
038    
039                    return _import.equals(importPackage._import);
040            }
041    
042            public String getImport() {
043                    return _import;
044            }
045    
046            public String getLine() {
047                    return _line;
048            }
049    
050            @Override
051            public int hashCode() {
052                    return _import.hashCode();
053            }
054    
055            protected ImportPackage(String importString, String line) {
056                    _import = importString;
057                    _line = line;
058            }
059    
060            private String _import;
061            private String _line;
062    
063    }