A Release represents an identifiable version of a Specification.
Inheritance: IGrammar
 /// <summary>
 /// Constructs a <b>VersionRangePrecondition</b> using the two
 /// bounding release versions.
 /// </summary>
 /// <param name="minimum">The minimum version accepted.</param>
 /// <param name="maximum">The maximum version accepted.</param>
 public VersionRangePrecondition(Release minimum, Release maximum)
 {
     minimumVersion = ((this.minimum = minimum) != null)
         ? FpML.Util.Version.Parse (minimum.Version) : null;
     maximumVersion = ((this.maximum = maximum) != null)
         ? FpML.Util.Version.Parse (maximum.Version) : null;
 }
        /// <summary>
        /// Constructs a <b>DirectConversion</b> that will transform between
        /// the specified releases. 
        /// </summary>
        /// <param name="sourceRelease">The <see cref="Release"/> to convert from.</param>
        /// <param name="targetRelease">The <see cerf="Release"/> to convert to.</param>
        protected DirectConversion(Release sourceRelease, Release targetRelease)
        {
            this.sourceRelease = sourceRelease;
            this.targetRelease = targetRelease;

            if ((sourceRelease != null) && (targetRelease != null)) {
                sourceRelease.AddSourceConversion (this);
                targetRelease.AddTargetConversion (this);
            }
        }
        /// <summary>
        /// Removes the indicated <see cref="Release"/> instance from the set managed
        /// by the <b>Specification</b>.
        /// </summary>
        /// <param name="release">The <see cref="Release"/> to be removed.</param>
        /// <exception cref="ArgumentException">If the <see cref="Release"/> is associated
        /// with a different <b>Specification</b>.</exception>
        public void Remove(Release release)
        {
            if (release.Specification != this)
                throw new ArgumentException ("The provided release is for a different specification", "release");

            releases.Remove (release);
        }
 /// <summary>
 /// Constructs a <b>VersionPrecondition</b> that detects a specific
 /// version number.
 /// </summary>
 /// <param name="release">The required FpML release.</param>
 public VersionPrecondition(Release release)
 {
     this.release = release;
 }
 /// <summary>
 /// Attempts to find a <b>Conversion</b> that will transform a
 /// <see cref="XmlDocument"/> between the two specified releases. The releases
 /// must be different, null transformations are not allowed.
 /// </summary>
 /// <param name="source">The source <see cref="Release"/> to convert from.</param>
 /// <param name="target">The target <see cref="Release"/> to convert to.</param>
 /// <returns>A <b>Conversion</b> instance that implements the
 /// transformation or <c>null</c> if one could not be found.</returns>
 public static Conversion ConversionFor(Release source, Release target)
 {
     return ((source != target) ? DepthFirstSearch (source, target, new Stack ()) : null);
 }
        /// <summary>
        /// Recursively explores the <see cref="Release"/> definitions to determine
        /// the shortest conversion path between two releases.
        /// </summary>
        /// <param name="source">The source <see cref="Release"/> for the search.</param>
        /// <param name="target">The target <see cref="Release"/> for the search.</param>
        /// <param name="stack">A <see cref="Stack"/> used to detect cycles.</param>
        /// <returns>A <B>Conversion</B> that transforms between the source and
        /// target releases or <c>null</c> if no conversion is possible.</returns>
        private static Conversion DepthFirstSearch(Release source, Release target, Stack stack)
        {
            Conversion	best = null;

            if (!stack.Contains (source)) {
                stack.Push (source);

                foreach (Conversion first in source.SourceConversions) {
                    Release		release = first.TargetRelease;
                    Conversion	result	= null;

                    if (release == target)
                        result = first;
                    else {
                        Conversion second = DepthFirstSearch (release, target, stack);
                            if (second != null)
                        result = new IndirectConversion (first, second);
                    }

                    if (result != null) {
                        if ((best == null)||(result.Complexity < best.Complexity))
                            best = result;
                    }
                }
                stack.Pop ();
            }
            return (best);
        }
        /// <summary>
        /// Attempts to locate the <b>Specification</b> instance corresponding
        /// to the given <see cref="XmlDocument"/>.
        /// </summary>
        /// <param name="document">The <see cref="XmlDocument"/> to be examined.</param>
        /// <returns>The <b>Specification</b> instance corresponding to the
        /// <see cref="XmlDocument"/> or <c>null</c> if it is not recognized.</returns>
        public static Specification ForDocument(XmlDocument document)
        {
            Release release = ReleaseForDocument(document);

            return((release != null) ? release.Specification : null);
        }
 /// <summary>
 /// Attempts to find a <b>Conversion</b> that will transform a
 /// <see cref="XmlDocument"/> between the two specified releases. The releases
 /// must be different, null transformations are not allowed.
 /// </summary>
 /// <param name="source">The source <see cref="Release"/> to convert from.</param>
 /// <param name="target">The target <see cref="Release"/> to convert to.</param>
 /// <returns>A <b>Conversion</b> instance that implements the
 /// transformation or <c>null</c> if one could not be found.</returns>
 public static Conversion ConversionFor(Release source, Release target)
 {
     return((source != target) ? DepthFirstSearch(source, target, new Stack()) : null);
 }