package de.uka.ipd.consensus.foundation.schema;

import java.io.Serializable;
import java.util.Date;

/**
 * This interface represents one version of a versionable element.
 * @author Thomas Much
 * @version 2006-06-14
 * @see Versionable
 */
public interface Version extends Serializable,Comparable {

	/**
	 * Checks if this version has a timestamp later than the given version.
	 * @param ver the Version to check against
	 * @return <code>true</code> if this version's timestamp is newer than the given version's timestamp
	 * @see #getDate()
	 */
	public boolean after(Version ver);

	
	/**
	 * Checks if this version has a timestamp earlier than the given version.
	 * @param ver the Version to check against
	 * @return <code>true</code> if this version's timestamp is older than the given version's timestamp
	 * @see #getDate()
	 */
	public boolean before(Version ver);

	
	/**
	 * Checks if this and the given object are equal, i.e. if they represent the same version.
	 * @param obj the object to check against
	 * @return <code>true</code> if both objects are equal, <code>false</code> otherwise
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj);

	
	/**
	 * Returns the versionable element.
	 * @return the versionable element, never <code>null</code>
	 */
	public Versionable getVersionable();

	
	/**
	 * Returns the timestamp of this version, i.e. when this version was created.
	 * @return the timestamp Date object, never <code>null</code>
	 */
	public Date getDate();
}
