/// <summary>
 /// Initializes a new instance of the <see cref="OrdinalEra" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 public OrdinalEra(String identifier, String name, OrdinalReferenceSystem referenceSystem) : base(identifier, name)
 {
     _group          = null;
     _eras           = new List <OrdinalEra>();
     ReferenceSystem = referenceSystem;
     Begin           = End = null;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OrdinalEra" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="referenceSystem">The reference system.</param>
 /// <param name="begin">The begin of the era.</param>
 /// <param name="end">The end of the era.</param>
 public OrdinalEra(String identifier, String name, OrdinalReferenceSystem referenceSystem, DateAndTime begin, DateAndTime end)
     : base(identifier, name)
 {
     _group          = null;
     _eras           = new List <OrdinalEra>();
     ReferenceSystem = referenceSystem;
     Begin           = begin;
     End             = end;
 }
        /// <summary>
        /// Determines whether the specified era is a member of this instance.
        /// </summary>
        /// <param name="era">The era.</param>
        /// <returns><c>true</c> if <paramref name="era" /> is a member; otherwise, <c>false</c>.</returns>
        /// <exception cref="System.ArgumentNullException">The era is null.</exception>
        public Boolean IsMember(OrdinalEra era)
        {
            if (era == null)
            {
                throw new ArgumentNullException("era", "The era is null.");
            }

            return(era._group == this);
        }
        /// <summary>
        /// Adds an era.
        /// </summary>
        /// <param name="era">The era.</param>
        /// <exception cref="System.ArgumentNullException">The era is null.</exception>
        /// <exception cref="System.ArgumentException">The era is already in a group.</exception>
        public void AddEra(OrdinalEra era)
        {
            if (era == null)
            {
                throw new ArgumentNullException("era", "The era is null.");
            }
            if (era._group != null)
            {
                throw new ArgumentException("The era is already in a group.", "era");
            }

            era._group = this;
            _eras.Add(era);
        }
        /// <summary>
        /// Adds an era.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="begin">The beginning date.</param>
        /// <param name="end">The ending date.</param>
        /// <exception cref="System.ArgumentException">
        /// The beginning date has a different reference system to the eras.
        /// or
        /// The ending date has a different reference system to the eras.
        /// </exception>
        public void AddEra(String identifier, String name, Positioning.DateAndTime begin, Positioning.DateAndTime end)
        {
            if (!Begin.ReferenceSystem.Equals(begin.ReferenceSystem))
            {
                throw new ArgumentException("The beginning date has a different reference system to the era.", "begin");
            }
            if (!Begin.ReferenceSystem.Equals(end.ReferenceSystem))
            {
                throw new ArgumentException("The ending date has a different reference system to the era.", "end");
            }

            OrdinalEra era = new OrdinalEra(identifier, name, this.ReferenceSystem, begin, end);

            era._group = this;
            _eras.Add(era);
        }