    001    /* ========================================================================
    002     * JCommon : a free general purpose class library for the Java(tm) platform
    003     * ========================================================================
    004     *
    005     * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
    006     *
    007     * Project Info:  http://www.jfree.org/jcommon/index.html
    008     *
    009     * This library is free software; you can redistribute it and/or modify it
    010     * under the terms of the GNU Lesser General Public License as published by
    011     * the Free Software Foundation; either version 2.1 of the License, or
    012     * (at your option) any later version.
    013     *
    014     * This library is distributed in the hope that it will be useful, but
    015     * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    016     * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
    017     * License for more details.
    018     *
    019     * You should have received a copy of the GNU Lesser General Public
    020     * License along with this library; if not, write to the Free Software
    021     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
    022     * USA.
    023     *
    024     * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
    025     * in the United States and other countries.]
    026     *
    027     * ------------
    028     * Library.java
    029     * ------------
    030     * (C) Copyright 2002-2004, by Object Refinery Limited.
    031     *
    032     * Original Author:  David Gilbert (for Object Refinery Limited);
    033     * Contributor(s):   -;
    034     *
    035     * $Id: Library.java,v 1.7 2008/09/10 09:23:34 mungady Exp $
    036     *
    037     * Changes
    038     * -------
    039     * 21-Feb-2002 : Version 1 (DG);
    040     * 25-Mar-2002 : Added a new constructor (DG);
    041     * 02-Nov-2005 : Minor API doc updates (DG);
    042     *
    043     */
    044
    045    package org.jfree.base;
    046
    047    import org.jfree.ui.about.AboutFrame;
    048
    049    /**
    050     * A simple class representing a library in a software project.  For use in
    051     * the {@link AboutFrame} class.
    052     *
    053     * @author David Gilbert
    054     */
    055    public class Library {
    056
    057        /** The name. */
    058        private String name;
    059
    060        /** The version. */
    061        private String version;
    062
    063        /** The licenceName. */
    064        private String licenceName;
    065
    066        /** The version. */
    067        private String info;
    068
    069        /**
    070         * Creates a new library reference.
    071         *
    072         * @param name  the name.
    073         * @param version  the version.
    074         * @param licence  the licenceName.
    075         * @param info  the web address or other info.
    076         */
    077        public Library(final String name, final String version,
    078                       final String licence, final String info) {
    079
    080            this.name = name;
    081            this.version = version;
    082            this.licenceName = licence;
    083            this.info = info;
    084        }
    085
    086        /**
    087         * Creates a new library reference.
    088         */
    089        protected Library() {
    090            // nothing required
    091        }
    092
    093        /**
    094         * Returns the library name.
    095         *
    096         * @return the library name.
    097         */
    098        public String getName() {
    099            return this.name;
    100        }
    101
    102        /**
    103         * Returns the library version.
    104         *
    105         * @return the library version.
    106         */
    107        public String getVersion() {
    108            return this.version;
    109        }
    110
    111        /**
    112         * Returns the licenceName text.
    113         *
    114         * @return the licenceName text.
    115         */
    116        public String getLicenceName() {
    117            return this.licenceName;
    118        }
    119
    120        /**
    121         * Returns the project info for the library.
    122         *
    123         * @return the project info.
    124         */
    125        public String getInfo() {
    126            return this.info;
    127        }
    128
    129        /**
    130         * Sets the project info.
    131         *
    132         * @param info  the project info.
    133         */
    134        protected void setInfo(final String info) {
    135            this.info = info;
    136        }
    137
    138        /**
    139         * Sets the licence name.
    140         *
    141         * @param licenceName  the licence name.
    142         */
    143        protected void setLicenceName(final String licenceName) {
    144            this.licenceName = licenceName;
    145        }
    146
    147        /**
    148         * Sets the project name.
    149         *
    150         * @param name  the project name.
    151         */
    152        protected void setName(final String name) {
    153            this.name = name;
    154        }
    155
    156        /**
    157         * Sets the version identifier.
    158         *
    159         * @param version  the version identifier.
    160         */
    161        protected void setVersion(final String version) {
    162            this.version = version;
    163        }
    164
    165        /**
    166         * Tests this object for equality with an arbitrary object.
    167         *
    168         * @param o  the object.
    169         *
    170         * @return A boolean.
    171         */
    172        public boolean equals(final Object o)
    173        {
    174          if (this == o)
    175          {
    176            return true;
    177          }
    178          if (o == null || getClass() != o.getClass())
    179          {
    180            return false;
    181          }
    182
    183          final Library library = (Library) o;
    184
    185          if (this.name != null ? !this.name.equals(library.name) : library.name != null)
    186          {
    187            return false;
    188          }
    189
    190          return true;
    191        }
    192
    193        /**
    194         * Returns a hash code for this instance.
    195         *
    196         * @return A hash code.
    197         */
    198        public int hashCode()
    199        {
    200          return (this.name != null ? this.name.hashCode() : 0);
    201        }
    202    }