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     * BasicProjectInfo.java
029     * ---------------------
030     * (C)opyright 2004, by Thomas Morgner and Contributors.
031     *
032     * Original Author:  Thomas Morgner;
033     * Contributor(s):   David Gilbert (for Object Refinery Limited);
034     *
035     * $Id: BasicProjectInfo.java,v 1.4 2005/10/18 13:13:58 mungady Exp $
036     *
037     * Changes
038     * -------
039     * 07-Jun-2004 : Added source headers (DG);
040     *
041     */
042    
043    package org.jfree.base;
044    
045    import java.util.ArrayList;
046    import java.util.List;
047    
048    /**
049     * Basic project info.
050     *
051     * @author Thomas Morgner
052     */
053    public class BasicProjectInfo extends Library {
054    
055        /** The project copyright statement. */
056        private String copyright;
057    
058        /** A list of libraries used by the project. */
059        private List libraries;
060    
061        /**
062         * Default constructor.
063         */
064        public BasicProjectInfo() {
065            this.libraries = new ArrayList();
066        }
067    
068        /**
069         * Creates a new library reference.
070         *
071         * @param name    the name.
072         * @param version the version.
073         * @param licence the licence.
074         * @param info    the web address or other info.
075         */
076        public BasicProjectInfo(final String name, final String version,
077                                final String licence, final String info) {
078            this();
079            setName(name);
080            setVersion(version);
081            setLicenceName(licence);
082            setInfo(info);
083        }
084    
085        /**
086         * Creates a new project info instance.
087         * 
088         * @param name  the project name.
089         * @param version  the project version.
090         * @param info  the project info (web site for example).
091         * @param copyright  the copyright statement.
092         * @param licenceName  the license name.
093         */
094        public BasicProjectInfo(final String name, final String version,
095                                final String info, final String copyright,
096                                final String licenceName) {
097            this(name, version, licenceName, info);
098            setCopyright(copyright);
099        }
100    
101        /**
102         * Returns the copyright statement.
103         *
104         * @return The copyright statement.
105         */
106        public String getCopyright() {
107            return this.copyright;
108        }
109    
110        /**
111         * Sets the project copyright statement.
112         *
113         * @param copyright  the project copyright statement.
114         */
115        public void setCopyright(final String copyright) {
116            this.copyright = copyright;
117        }
118    
119        /**
120         * Sets the project info string (for example, this could be the project URL).
121         * 
122         * @param info  the info string.
123         */
124        public void setInfo(final String info) {
125            super.setInfo(info);
126        }
127    
128        /**
129         * Sets the license name.
130         * 
131         * @param licence  the license name.
132         */
133        public void setLicenceName(final String licence) {
134            super.setLicenceName(licence);
135        }
136    
137        /**
138         * Sets the project name.
139         * 
140         * @param name  the project name.
141         */
142        public void setName(final String name) {
143            super.setName(name);
144        }
145    
146        /**
147         * Sets the project version number.
148         * 
149         * @param version  the version number.
150         */
151        public void setVersion(final String version) {
152            super.setVersion(version);
153        }
154    
155        /**
156         * Returns a list of libraries used by the project.
157         *
158         * @return the list of libraries.
159         */
160        public Library[] getLibraries() {
161            return (Library[]) this.libraries.toArray(new Library[this.libraries.size()]);
162        }
163    
164        /**
165         * Adds a library.
166         * 
167         * @param library  the library.
168         */
169        public void addLibrary (final Library library) {
170            if (library == null) {
171                throw new NullPointerException();
172            }
173            this.libraries.add(library);
174        }
175        
176    }