001    /*
002     * mesopotamia @mesopotamia.version@
003     * Multilingual parser and repository. 
004     * Copyright (C) 2005  Hammurapi Group
005     *
006     * This program is free software; you can redistribute it and/or
007     * modify it under the terms of the GNU Lesser General Public
008     * License as published by the Free Software Foundation; either
009     * version 2 of the License, or (at your option) any later version.
010     *
011     * This program is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014     * Lesser General Public License for more details.
015     *
016     * You should have received a copy of the GNU Lesser General Public
017     * License along with this library; if not, write to the Free Software
018     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019     *
020     * URL: http://http://www.hammurapi.biz
021     * e-Mail: support@hammurapi.biz
022     */
023    package org.mesopotamia;
024    
025    /**
026     * Represent language e.g. Java 1.3
027     * @author Pavel Vlasov
028     * @revision $Revision: 1.2 $
029     */
030    public class Language {
031            protected org.mesopotamia.sql.Language dbData;
032    
033            
034            public Language(String name, String version, String description) {
035                    dbData=new org.mesopotamia.sql.LanguageImpl();
036                    dbData.setName(name);
037                    dbData.setVersion(version);
038                    dbData.setDescription(description);
039            }
040            
041            /**
042             * Constructed by repository
043             * @param data
044             */
045            protected Language(org.mesopotamia.sql.Language data) {
046                    super();
047                    dbData = data;
048            }
049    
050            public String getDescription() {
051                    return dbData.getDescription();
052            }
053    
054            public String getName() {
055                    return dbData.getName();
056            }
057    
058            public String getVersion() {
059                    return dbData.getVersion();
060            }
061            
062            public int hashCode() {
063                    return dbData.getName().hashCode() ^ dbData.getVersion().hashCode();
064            }
065            
066            public boolean equals(Object obj) {
067                    if (obj==this) {
068                            return true;
069                    }
070                    
071                    if (obj instanceof Language) {
072                            return ((Language) obj).getName().equals(getName()) && ((Language) obj).getVersion().equals(getVersion()); 
073                    }
074                    
075                    return false;
076            }
077    }