Source for org.jfree.base.Library

   1: /* ========================================================================
   2:  * JCommon : a free general purpose class library for the Java(tm) platform
   3:  * ========================================================================
   4:  *
   5:  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
   6:  *
   7:  * Project Info:  http://www.jfree.org/jcommon/index.html
   8:  *
   9:  * This library is free software; you can redistribute it and/or modify it
  10:  * under the terms of the GNU Lesser General Public License as published by
  11:  * the Free Software Foundation; either version 2.1 of the License, or
  12:  * (at your option) any later version.
  13:  *
  14:  * This library is distributed in the hope that it will be useful, but
  15:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16:  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  17:  * License for more details.
  18:  *
  19:  * You should have received a copy of the GNU Lesser General Public
  20:  * License along with this library; if not, write to the Free Software
  21:  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
  22:  * USA.
  23:  *
  24:  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  25:  * in the United States and other countries.]
  26:  *
  27:  * ------------
  28:  * Library.java
  29:  * ------------
  30:  * (C) Copyright 2002-2004, by Object Refinery Limited.
  31:  *
  32:  * Original Author:  David Gilbert (for Object Refinery Limited);
  33:  * Contributor(s):   -;
  34:  *
  35:  * $Id: Library.java,v 1.7 2008/09/10 09:23:34 mungady Exp $
  36:  *
  37:  * Changes
  38:  * -------
  39:  * 21-Feb-2002 : Version 1 (DG);
  40:  * 25-Mar-2002 : Added a new constructor (DG);
  41:  * 02-Nov-2005 : Minor API doc updates (DG);
  42:  *
  43:  */
  44: 
  45: package org.jfree.base;
  46: 
  47: import org.jfree.ui.about.AboutFrame;
  48: 
  49: /**
  50:  * A simple class representing a library in a software project.  For use in
  51:  * the {@link AboutFrame} class.
  52:  *
  53:  * @author David Gilbert
  54:  */
  55: public class Library {
  56: 
  57:     /** The name. */
  58:     private String name;
  59: 
  60:     /** The version. */
  61:     private String version;
  62: 
  63:     /** The licenceName. */
  64:     private String licenceName;
  65: 
  66:     /** The version. */
  67:     private String info;
  68: 
  69:     /**
  70:      * Creates a new library reference.
  71:      *
  72:      * @param name  the name.
  73:      * @param version  the version.
  74:      * @param licence  the licenceName.
  75:      * @param info  the web address or other info.
  76:      */
  77:     public Library(final String name, final String version,
  78:                    final String licence, final String info) {
  79: 
  80:         this.name = name;
  81:         this.version = version;
  82:         this.licenceName = licence;
  83:         this.info = info;
  84:     }
  85: 
  86:     /**
  87:      * Creates a new library reference.
  88:      */
  89:     protected Library() {
  90:         // nothing required
  91:     }
  92: 
  93:     /**
  94:      * Returns the library name.
  95:      *
  96:      * @return the library name.
  97:      */
  98:     public String getName() {
  99:         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: }