You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/02/26 01:41:18 UTC
cvs commit: jakarta-avalon/proposal/4.0/src/java/org/apache/aut Version.java
donaldp 01/02/25 16:41:18
Added: proposal/4.0/src/java/org/apache/aut Version.java
Log:
Added version object to aut
Revision Changes Path
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/aut/Version.java
Index: Version.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.aut;
/**
* This document is NOT RIGHT.
* <p />
*
* The version number of a <code>Block</code> is made up of three
* dot-separated fields:
* <p />
* "<b>major.minor.patchlevel</b>"
* <p />
* and (optionally) by a fourth field (always <b>"-dev"</b>)
* specifying that this version is under development.
* <p />
* The <b>major</b>, <b>minor</b> and <b>patchlevel</b> fields are
* <i>integer</i> numbers represented in decimal notation and have the
* following meaning:
* <ul>
* <p /><li><b>major</b> - When the major version changes (in ex. from
* "1.5.12" to "2.0.0"), then backward compatibility
* with previous releases is not granted (this usually happens this
* <code>Block</code> is implementing a new major version of an interface
* specified in <b>org.apache.avalon.blocks</b> package).
* </li><p />
* <p /><li><b>minor</b> - When the minor version changes (in ex. from
* "1.5.12" to "1.6.0"), then backward compatibility
* with previous releases is granted, but something changed in the
* implementation (in ex. new features were added, the configuration
* syntax may be different, or the <code>Block</code> is implementing a
* new minor version of an interface specified in
* <b>org.apache.avalon.blocks</b> package).
* </li><p />
* <p /><li><b>patchlevel</b> - When the patchlevel version changes (in ex.
* from "1.5.12" to "1.5.13"), then the only changed
* things are fixes in the code implementation, but no new features or
* changes were made to the behaviour of the code.
* </li>
* </ul>
* <p />
* The fourth field, optional and always "<b>-dev</b>" (in ex.
* "1.5.12-dev") specifies that current <code>Block</code>
* implementation is under development, and so may contain not-working
* code or not all features were implemented.
* <p />
* <p />
* <b>NOTE: The absence of the "-dev" tag does not endorse
* any warranty of particular stability, safety or compliancy.
* The only source for such informations is the (usually provided) license
* file accompaining the block itself.</b>
*
* The class defining versioning pattern.
* <p />
* <p />
* Any interface in <b>org.apache.avalon.blocks</b> package <b>MUST</b> provides
* a Version instance containing versioning informations on this interface.<p />
* Any BlockInfo returned by a Block implementation <b>MUST</b> provides a
* Version instances containing versioning informations on this implementation.
* <p /><p />
* Version numbers are:<p />
* "<b>major.minor.revision.dev</b>"
* <p />
* The <b>major</b> , <b>minor</b> and <b>revision</b>fields are <i>integer</i>
* numbers represented in decimal notation and have the following meaning:
* <ul><b> - Refering to an interface</b>
* <ul>
* <li><b>major</b> - When the major version changes (in ex. from
* "1.5" to "2.0"), then backward compatibility with
* previous releases is not granted.
* </li><p />
* <p /><li><b>minor</b> - When the minor version changes (in ex. from
* "1.5" to "1.6"), then backward compatibility
* with previous releases is granted, but something changed in the
* interface (in ex. new methods were added).
* </li><p />
* <li><b>revision</b> - When refering to an interface may represent a change
* in documentation or other minor changes. If some methods are modified a minor
* version changes is needed.<p />
* - When refering to a Block implementation this represent minor changes in
* implementation like bugs fix.
* </li><p />
* <li><b>dev</b> - The boolean dev field specify if this Block or interface
* is under development and not yet approved by the Java Apache org.apache.avalon.interfaces;
* developers group (mailing-list).
* </li><p />
* </ul>
* </ul>
* <ul><b> - Refering to a Block</b>
* <ul>
* <li><b>major</b> - When the major version changes (in ex. from
* "1.5" to "2.0"), then backward compatibility with
* previous releases is not granted.
* </li><p />
* <p /><li><b>minor</b> - When the minor version changes (in ex. from
* "1.5" to "1.6"), then backward compatibility
* with previous releases is granted, but something changed in the
* interface (in ex. new methods were added).
* </li><p />
* <li><b>revision</b> - When refering to an interface may represent a change
* in documentation or other minor changes. If some methods are modified a minor
* version changes is needed.<p />
* - When refering to a Block implementation this represent minor changes in
* implementation like bugs fix.
* </li><p />
* <li><b>dev</b> - The boolean dev field specify if this Block or interface
* is under development and not yet approved by the Java Apache org.apache.avalon.interfaces;
* developers group (mailing-list).
* </li><p />
* </ul>
* </ul>
* The third field, optional and always "<b>-dev</b>" (in ex.
* "1.5-dev") specifies that the interface is currently under
* development, or it was not yet approved by the Java Apache org.apache.avalon.interfaces;
* developers group (mailing-list) and so, not yet integrated with the
* org.apache.avalon.interfaces; distributions.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:rlogiacco@mail.com">Roberto Lo Giacco</a>
* @author <a href="http://java.apache.org/">Java Apache Project</a>
*/
public final class Version
{
protected int m_major;
protected int m_minor;
protected int m_revision;
/**
* Create a new instance of a <code>Version</code> object with the
* specified version numbers.
*
* @param major This <code>Version</code> major number.
* @param minor This <code>Version</code> minor number.
* @param rev This <code>Version</code> revision number.
*/
public Version( final int major, final int minor, final int revision )
{
m_major = major;
m_minor = minor;
m_revision = revision;
}
/**
* Check this <code>Version</code> against another for equality.
* <p />
* If this <code>Version</code> is compatible with the specified one, then
* <b>true</b> is returned, otherwise <b>false</b>.
*
* @param other The other <code>Version</code> object to be compared with this
* for equality.
*/
public boolean equals( final Version other )
{
if( m_major != other.m_major) return false;
else if( m_minor != other.m_minor) return false;
else if( m_revision != other.m_revision ) return false;
else return true;
}
/**
* Check this <code>Version</code> against another for compliancy
* (compatibility).
* <p />
* If this <code>Version</code> is compatible with the specified one, then
* <b>true</b> is returned, otherwise <b>false</b>. Be careful when using
* this method since, in example, version 1.3.7 is compliant to version
* 1.3.6, while the opposite is not.
*
* @param v The other <code>Version</code> object to be compared with this
* for compliancy (compatibility).
*/
public boolean complies( final Version other )
{
if( m_major != other.m_major) return false;
else if( m_minor < other.m_minor) return false;
else return true;
}
/**
* Overload toString to report version correctly.
*
* @return the dot seperated version string
*/
public String toString()
{
return m_major + "." + m_minor + "." + m_revision;
}
}