001    /**
002     * 
003     * $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
004     *
005     * This file is part of ** M y C o R e **
006     * Visit our homepage at http://www.mycore.de/ for details.
007     *
008     * This program is free software; you can use it, redistribute it
009     * and / or modify it under the terms of the GNU General Public License
010     * (GPL) as published by the Free Software Foundation; either version 2
011     * of the License or (at your option) any later version.
012     *
013     * This program is distributed in the hope that it will be useful, but
014     * WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016     * GNU General Public License for more details.
017     *
018     * You should have received a copy of the GNU General Public License
019     * along with this program, normally in the file license.txt.
020     * If not, write to the Free Software Foundation Inc.,
021     * 59 Temple Place - Suite 330, Boston, MA  02111-1307 USA
022     *
023     **/
024    package org.mycore.datamodel.classifications2.impl;
025    
026    import org.mycore.datamodel.classifications2.MCRObjectReference;
027    
028    /**
029     * @author Thomas Scheffler (yagee)
030     * 
031     * @version $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
032     * @since 2.0
033     */
034    class MCRCategoryLink {
035    
036        int id;
037    
038        private MCRCategoryImpl category;
039    
040        private MCRObjectReference objectReference;
041    
042        MCRCategoryLink() {
043            super();
044        }
045    
046        MCRCategoryLink(MCRCategoryImpl category, MCRObjectReference objectReference) {
047            super();
048            this.category = category;
049            this.objectReference = objectReference;
050        }
051    
052        public MCRCategoryImpl getCategory() {
053            return category;
054        }
055    
056        public void setCategory(MCRCategoryImpl category) {
057            this.category = category;
058        }
059    
060        public MCRObjectReference getObjectReference() {
061            return objectReference;
062        }
063    
064        public void setObjectReference(MCRObjectReference objectReference) {
065            this.objectReference = objectReference;
066        }
067    
068        @Override
069        public int hashCode() {
070            final int prime = 31;
071            int result = 1;
072            result = prime * result + ((category == null) ? 0 : category.hashCode());
073            result = prime * result + ((objectReference == null) ? 0 : objectReference.hashCode());
074            return result;
075        }
076    
077        @Override
078        public boolean equals(Object obj) {
079            if (this == obj)
080                return true;
081            if (obj == null)
082                return false;
083            if (!(obj instanceof MCRCategoryLink))
084                return false;
085            final MCRCategoryLink other = (MCRCategoryLink) obj;
086            if (category == null) {
087                if (other.category != null)
088                    return false;
089            } else if (!category.equals(other.category))
090                return false;
091            if (objectReference == null) {
092                if (other.objectReference != null)
093                    return false;
094            } else if (!objectReference.equals(other.objectReference))
095                return false;
096            return true;
097        }
098    
099    }