当前位置: 首页>>代码示例>>C#>>正文


C# Interval类代码示例

本文整理汇总了C#中Interval的典型用法代码示例。如果您正苦于以下问题:C# Interval类的具体用法?C# Interval怎么用?C# Interval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Interval类属于命名空间,在下文中一共展示了Interval类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Intervals_Are_Constructable_From_Semitones

        public void Intervals_Are_Constructable_From_Semitones()
        {
            var i = new Interval(5);

            Assert.Equal(5, i.Semitones);
            Assert.Equal(IntervalDistance.PerfectFourth, i.Distance);
        }
开发者ID:deejaygraham,项目名称:tedesco,代码行数:7,代码来源:IntervalTests.cs

示例2: AxisAlignedBoxEnvironmentComponentOld

 /// <summary>
 /// Initializes a new instance of the AbstractEnvironmentComponent class.
 /// </summary>
 public AxisAlignedBoxEnvironmentComponentOld()
   : base(RS.AABoxEnvName, RS.AABoxEnvNickName,
       RS.AABoxEnvDescription, RS.icon_AABoxEnvironment, RS.AABoxEnvOldGuid)
 {
   Interval interval = new Interval(-RS.boxBoundsDefault, RS.boxBoundsDefault);
   box = new Box(Plane.WorldXY, interval, interval, interval);
 }
开发者ID:lxfschr,项目名称:Quelea,代码行数:10,代码来源:AxisAlignedBoxEnvironmentComponentOld.cs

示例3: Create

 /// <summary>
 /// Método estático encargado de la creación de objetos valor <see cref="IInterval"/>
 /// </summary>
 /// <remarks>
 /// Sin comentarios adicionales.
 /// </remarks>
 /// <param name="fromTime">
 /// Parámetro que indica la hora inicial del intervalo.
 /// </param>
 /// <param name="duration">
 /// Parámetro que indica la duración del intervalo.
 /// </param>
 /// <returns>
 /// Devuelve objeto de tipo <see cref="IInterval"/> creado.
 /// </returns>
 public static IInterval Create(DateTime? fromTime, TimeSpan duration)
 {
     // Creamos el objeto valor de periodo de vigencia.
     IInterval interval = new Interval(fromTime, duration);
     // Devolvemos el objeto valor creado.
     return interval;
 }
开发者ID:llenroc,项目名称:Inflexion2,代码行数:22,代码来源:IntervalFactory.cs

示例4: Insert

 public IList<Interval> Insert(IList<Interval> intervals, Interval newInterval) {
     IList<Interval> result = new List<Interval>();
     if(intervals.Count == 0){
         result.Add(newInterval);
         return result; 
     }
     bool first = true;
     for(int i=0; i<intervals.Count; i++){
         if(intervals[i].end<newInterval.start){
             result.Add(intervals[i]);
         }
         else if(intervals[i].start>newInterval.end){
             if(first){
                 result.Add(newInterval);
                 first = false;
             }
             result.Add(intervals[i]);
         }
         else{
             newInterval = new Interval(Math.Min(newInterval.start, intervals[i].start), Math.Max(newInterval.end, intervals[i].end));
         }
     }
         
         if(first){
             result.Add(newInterval);
             first = false;
         }
     return result;
 }
开发者ID:zhamx1995,项目名称:LeetCode,代码行数:29,代码来源:LC57-Insert_Interval.cs

示例5: CompareDecimals

        protected ComparerResult CompareDecimals(Interval interval, decimal actual)
        {
            if (interval.Contains(actual))
                return ComparerResult.Equality;

            return new ComparerResult(interval.ToString());
        }
开发者ID:zyh329,项目名称:nbi,代码行数:7,代码来源:NumericComparer.cs

示例6: Construct1

 public void Construct1()
 {
     var interval = new Interval();
     Assert.AreEqual(IntervalMode.Interpolate, interval.Mode);
     Assert.AreEqual(0, interval.Time);
     Assert.IsNull(interval.Value);
 }
开发者ID:Supermortal,项目名称:MusicianHelper,代码行数:7,代码来源:IntervalFixture.cs

示例7: GetIntersectionTest

        public void GetIntersectionTest()
        {
            var A = new Interval(0.0f, 5.0f);
            var B = new Interval(2.5f, 7.5f);
            var C = new Interval(6.0f, 10.0f);

            Interval Temp;

            Assert.IsTrue(A.GetIntersection(B, out Temp));
            Assert.AreEqual(new float[] { 2.5f, 5.0f }, Temp.ToArray());
            Assert.IsTrue(B.GetIntersection(A, out Temp));
            Assert.AreEqual(new float[] { 2.5f, 5.0f }, Temp.ToArray());

            Assert.IsTrue(A.GetIntersection(A, out Temp));
            Assert.AreEqual(A.ToArray(), Temp.ToArray());

            Assert.IsTrue(B.GetIntersection(C, out Temp));
            Assert.AreEqual(new float[] { 6.0f, 7.5f }, Temp.ToArray());
            Assert.IsTrue(C.GetIntersection(B, out Temp));
            Assert.AreEqual(new float[] { 6.0f, 7.5f }, Temp.ToArray());

            Assert.IsTrue(B.GetIntersection(B, out Temp));
            Assert.AreEqual(B.ToArray(), Temp.ToArray());

            A.GetIntersection(C, out Temp);
            C.GetIntersection(A, out Temp);

            Assert.IsFalse(A.GetIntersection(C, out Temp));
            Assert.IsFalse(C.GetIntersection(A, out Temp));
        }
开发者ID:sq,项目名称:Fracture,代码行数:30,代码来源:TupleTests.cs

示例8: ConstructorDefault

        public void ConstructorDefault()
        {
            IInterval<int> interval = new Interval<int>(5, 10);

            Assert.AreEqual(5, interval.LowerBound);
            Assert.AreEqual(10, interval.UpperBound);
        }
开发者ID:andipaetzold,项目名称:IntervalDictionary,代码行数:7,代码来源:IntervalTest.cs

示例9: ConstructorWrongOrder

        public void ConstructorWrongOrder()
        {
            IInterval<int> interval = new Interval<int>(10, 5);

            Assert.AreEqual(5, interval.LowerBound);
            Assert.AreEqual(10, interval.UpperBound);
        }
开发者ID:andipaetzold,项目名称:IntervalDictionary,代码行数:7,代码来源:IntervalTest.cs

示例10: CheckRoomTouch

    //If touching, returns unit vector pointing from A towards B
    //else returns 0,0,0
    public static Vector3 CheckRoomTouch(Bounds a, Bounds b, float minOverlap)
    {
        Interval a_x = new Interval(a.min.x, a.max.x);
        Interval a_y = new Interval(a.min.y, a.max.y);
        Interval a_z = new Interval(a.min.z, a.max.z);

        Interval b_x = new Interval(b.min.x, b.max.x);
        Interval b_y = new Interval(b.min.y, b.max.y);
        Interval b_z = new Interval(b.min.z, b.max.z);

        int roomTouchX = Interval.CheckTouching(a_x, b_x);
        int roomTouchY = Interval.CheckTouching(a_y, b_y);
        int roomTouchZ = Interval.CheckTouching(a_z, b_z);

        bool roomOverlapX = Interval.CheckOverlap(a_x, b_x, minOverlap);
        bool roomOverlapY = Interval.CheckOverlap(a_y, b_y, minOverlap);
        bool roomOverlapZ = Interval.CheckOverlap(a_z, b_z, minOverlap);

        //-.-- -.-- --..
        if(roomOverlapX && roomOverlapY) return Vector3.forward * roomTouchZ;
        if(roomOverlapZ && roomOverlapY) return Vector3.right * roomTouchX;
        if(roomOverlapX && roomOverlapZ) return Vector3.up * roomTouchY;

        return Vector3.zero;
    }
开发者ID:Vorren,项目名称:DunGen,代码行数:27,代码来源:RoomNode.cs

示例11: Construction_EqualStartAndEnd

 public void Construction_EqualStartAndEnd()
 {
     var interval = new Interval(SampleStart, SampleStart);
     Assert.AreEqual(SampleStart, interval.Start);
     Assert.AreEqual(SampleStart, interval.End);
     Assert.AreEqual(new Duration(0), interval.Duration);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:7,代码来源:IntervalTest.cs

示例12: SurfaceEmitterType

 // Constructor with initial values.
 public SurfaceEmitterType(Surface srf)
 {
   Interval interval = new Interval(0,1);
   srf.SetDomain(0, interval);
   srf.SetDomain(1, interval);
   this.srf = srf;
 }
开发者ID:lxfschr,项目名称:Quelea,代码行数:8,代码来源:SurfaceEmitterType.cs

示例13: Test_AddInterval

        public void Test_AddInterval()
        {
            Interval[] empty = new Interval[] { };
            Interval[] result;
            SortingAlgorithms algo = new SortingAlgorithms();

            result = algo.AddInterval(empty,
                new Interval { start = 0, end = 2 }
                );
            Assert.AreEqual(1, result.Length);

            result = algo.AddInterval(result,
                new Interval { start = 3, end = 5 }
                );
            Assert.AreEqual(2, result.Length);

            result = algo.AddInterval(result,
                new Interval { start = 4, end = 6 }
                );
            Assert.AreEqual(2, result.Length);

            result = algo.AddInterval(result,
                new Interval { start = 1, end = 4 }
                );
            Assert.AreEqual(1, result.Length);
        }
开发者ID:sanjug01,项目名称:Tests,代码行数:26,代码来源:SortingUnitTest.cs

示例14: CrossingVehicleTimes

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="originalArrivingTime">Time when the vehicle originally planned to arrive at the intersection.</param>
 /// <param name="remainingDistance">Remaining distance of the vehicle to the intersection.</param>
 /// <param name="blockingTime">Time interval when the vehicle is going to block the intersection.</param>
 /// <param name="willWaitInFrontOfIntersection">Flag whether vehicle will wait befor intersection or proceed crossing it.</param>
 public CrossingVehicleTimes(double originalArrivingTime, double remainingDistance, Interval<double> blockingTime, bool willWaitInFrontOfIntersection)
 {
     this.originalArrivingTime = originalArrivingTime;
     this.remainingDistance = remainingDistance;
     this.blockingTime = blockingTime;
     this.willWaitInFrontOfIntersection = willWaitInFrontOfIntersection;
 }
开发者ID:chenysh,项目名称:CTS-Develop,代码行数:14,代码来源:Intersection.cs

示例15: Box

 /// <summary>
 /// Initializes a new Box that mimics a BoundingBox struct. 
 /// <para>The orientation plane of the Box is coincident with the 
 /// World XY plane.</para>
 /// </summary>
 /// <param name="bbox">BoundingBox to mimic.</param>
 public Box(BoundingBox bbox)
 {
   m_plane = Plane.WorldXY;
   m_dx = new Interval(bbox.m_min.m_x, bbox.m_max.m_x);
   m_dy = new Interval(bbox.m_min.m_y, bbox.m_max.m_y);
   m_dz = new Interval(bbox.m_min.m_z, bbox.m_max.m_z);
 }
开发者ID:austinlaw,项目名称:rhinocommon,代码行数:13,代码来源:opennurbs_box.cs


注:本文中的Interval类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。