/* Test.IntervalSec.cs Copyright © 2008 Diversified Technical Systems, Inc. All Rights Reserved */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTS.Utilities; using DTS.Utilities.DotNetProgrammingConstructs; namespace DTS.Serialization { // *** see test.cs *** public partial class Test { /// /// Get/set the begin value. /// public class IntervalSec : Exceptional { /// /// Create an instance of the IntervalSec class. /// public IntervalSec() { // // Note that calling the parameterless constructor will leave the begin and // end properties "uninitialized". } // /// /// Create an instance of the IntervalSec class. /// /// /// /// The begin time of this interval. /// /// /// /// The end time of this interval. /// /// public IntervalSec(double begin, double end) { try { Begin = begin; End = end; } catch (System.Exception ex) { throw new Exception("encountered problem constructing \"IntervalSec\" object", ex); } } /// /// Get/set whether or not Begin and End values are automatically rounded. /// public bool DoRoundOffValues { get; set; } /// /// Get/set the number of decimal places Begin and End values will automatically be rounded /// to if DoRoundOffValues property is true. /// public int NumberRoundingDecimalPlaces { get { return _NumberOfRoundingDecimalPlaces.Value; } set { _NumberOfRoundingDecimalPlaces.Value = value; } } private Property _NumberOfRoundingDecimalPlaces = new Property( typeof( IntervalSec ).Namespace + ".IntervalSec.NumberOfRoundingDecimalPlaces", 6, true ); /// /// Get/set the begin time of the interval. /// public double Begin { get { return DoRoundOffValues ? Math.Round( _Begin.Value, NumberRoundingDecimalPlaces ) : _Begin.Value; } set { _Begin.Value = value; } } private Property _Begin = new Property( typeof( IntervalSec ).Namespace + ".Test.IntervalSec.Begin", 0, false); /// /// Get/set the end time of the interval. /// public double End { get { return DoRoundOffValues ? Math.Round( _End.Value, NumberRoundingDecimalPlaces ) : _End.Value ; } set { _End.Value = value; } } private Property _End = new Property( typeof( IntervalSec ).Namespace + ".Test.IntervalSec.End", 0, false); /// /// Determine whether or not this object and the one specified are equal. /// /// /// /// The to be equality-checked. /// /// /// /// true if the object is equal; false otherwise. /// /// public override bool Equals( object obj ) { try { IntervalSec that = obj as IntervalSec; return null != obj && this.Begin.Equals( that.Begin ) && this.End.Equals( that.End ); } catch ( System.Exception ex ) { throw new Test.IntervalSec.Exception( "encountered problem equality checking " + this.GetType( ).FullName, ex ); } } /// /// Get has code for this object. /// /// /// /// The hash code for this object. /// /// public override int GetHashCode( ) { try { return base.GetHashCode( ); } catch ( System.Exception ex ) { throw new Exception( "encountered problem generating hash code for " + this.GetType( ).FullName, ex ); } } } } }