Library.java 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. package org.jfree.base;
  45. import org.jfree.ui.about.AboutFrame;
  46. /**
  47. * A simple class representing a library in a software project. For use in
  48. * the {@link AboutFrame} class.
  49. *
  50. * @author David Gilbert
  51. */
  52. public class Library {
  53. /** The name. */
  54. private String name;
  55. /** The version. */
  56. private String version;
  57. /** The licenceName. */
  58. private String licenceName;
  59. /** The version. */
  60. private String info;
  61. /**
  62. * Creates a new library reference.
  63. *
  64. * @param name the name.
  65. * @param version the version.
  66. * @param licence the licenceName.
  67. * @param info the web address or other info.
  68. */
  69. public Library(final String name, final String version,
  70. final String licence, final String info) {
  71. this.name = name;
  72. this.version = version;
  73. this.licenceName = licence;
  74. this.info = info;
  75. }
  76. /**
  77. * Creates a new library reference.
  78. */
  79. protected Library() {
  80. // nothing required
  81. }
  82. /**
  83. * Returns the library name.
  84. *
  85. * @return the library name.
  86. */
  87. public String getName() {
  88. return this.name;
  89. }
  90. /**
  91. * Returns the library version.
  92. *
  93. * @return the library version.
  94. */
  95. public String getVersion() {
  96. return this.version;
  97. }
  98. /**
  99. * Returns the licenceName text.
  100. *
  101. * @return the licenceName text.
  102. */
  103. public String getLicenceName() {
  104. return this.licenceName;
  105. }
  106. /**
  107. * Returns the project info for the library.
  108. *
  109. * @return the project info.
  110. */
  111. public String getInfo() {
  112. return this.info;
  113. }
  114. /**
  115. * Sets the project info.
  116. *
  117. * @param info the project info.
  118. */
  119. protected void setInfo(final String info) {
  120. this.info = info;
  121. }
  122. /**
  123. * Sets the licence name.
  124. *
  125. * @param licenceName the licence name.
  126. */
  127. protected void setLicenceName(final String licenceName) {
  128. this.licenceName = licenceName;
  129. }
  130. /**
  131. * Sets the project name.
  132. *
  133. * @param name the project name.
  134. */
  135. protected void setName(final String name) {
  136. this.name = name;
  137. }
  138. /**
  139. * Sets the version identifier.
  140. *
  141. * @param version the version identifier.
  142. */
  143. protected void setVersion(final String version) {
  144. this.version = version;
  145. }
  146. /**
  147. * Tests this object for equality with an arbitrary object.
  148. *
  149. * @param o the object.
  150. *
  151. * @return A boolean.
  152. */
  153. public boolean equals(final Object o)
  154. {
  155. if (this == o)
  156. {
  157. return true;
  158. }
  159. if (o == null || getClass() != o.getClass())
  160. {
  161. return false;
  162. }
  163. final Library library = (Library) o;
  164. if (this.name != null ? !this.name.equals(library.name) : library.name != null)
  165. {
  166. return false;
  167. }
  168. return true;
  169. }
  170. /**
  171. * Returns a hash code for this instance.
  172. *
  173. * @return A hash code.
  174. */
  175. public int hashCode()
  176. {
  177. return (this.name != null ? this.name.hashCode() : 0);
  178. }
  179. }