001    /*
002     * Copyright 1999,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.apache.commons.feedparser;
018    
019    
020    /**
021     *
022     * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
023     * @version $Id: FeedVersion.java 373614 2006-01-30 22:31:21Z mvdb $
024     */
025    public class FeedVersion {
026    
027        /**
028         * True if this is an Atom feed.
029         */
030        public boolean isAtom;
031    
032        /**
033         * True if this is an RSS feed
034         */
035        public boolean isRSS;
036        
037        /**
038         * True when this is a Friend of a Friend FOAF file.
039         */
040        public boolean isFOAF;
041    
042        public boolean isOPML;
043    
044        public boolean isXFN;
045    
046        /**
047         * True if this is a changes.xml file.
048         */
049        public boolean isChanges;
050    
051        /**
052         * The version of this specification.  If this is RSS 1.0 the version will
053         * be "1.0".  If this is Atom 0.5 the version will be "0.5" (and so
054         * forth). If the version is unknown the value is simply null.  The format
055         * of this is unstructured text and in many situations is mirrored right
056         * form the 'version' attribute in some RSS/Atom specifications.  See
057         * version_major, version_minor, and version_sub for more info.
058         *
059         * 
060         */
061        public String version = null;
062    
063        public int version_major = 0;
064        public int version_minor = 0;
065        public int version_sub = 0;
066    
067        public String toString() {
068    
069            String result = "";
070    
071            if ( isAtom ) 
072                result = "atom"; 
073            else if ( isRSS )
074                result = "rss";
075            else if ( isFOAF )
076                result = "foaf";
077            else if ( isOPML )
078                result = "opml";
079            else if ( isXFN )
080                result = "xfn";
081            else if ( isChanges )
082                result = "changes";
083    
084            return result += ":" + version;
085    
086        }
087        
088    }