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


C# Interval.Contains方法代码示例

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


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

示例1: Contains

 public void Contains()
 {
     Interval interval = new Interval(0, 1, IntervalEndpoint.Closed, IntervalEndpoint.Open);
     Assert.IsFalse(interval.Contains(-1));
     Assert.IsTrue(interval.Contains(0));
     Assert.IsTrue(interval.Contains(0.5));
     Assert.IsFalse(interval.Contains(1));
     Assert.IsFalse(interval.Contains(2));
 }
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:9,代码来源:IntervalTests.cs

示例2: Contains

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

            Assert.IsTrue(interval.Contains(5));
            Assert.IsTrue(interval.Contains(7));
            Assert.IsTrue(interval.Contains(10));

            Assert.IsFalse(interval.Contains(4));
            Assert.IsFalse(interval.Contains(11));
        }
开发者ID:andipaetzold,项目名称:IntervalDictionary,代码行数:11,代码来源:IntervalTest.cs

示例3: ContainsValue

        public void ContainsValue()
        {
            var epsilon = 1E-12;
            Interval x;

            x = new Interval();
            Assert.IsTrue(x.Contains(0));
            Assert.IsFalse(x.Contains(0 + 2 * epsilon));

            x = new Interval(-1, 1, epsilon);
            Assert.IsTrue(x.Contains(0));
            Assert.IsTrue(x.Contains(-1 - epsilon / 2));
            Assert.IsFalse(x.Contains(3));
            Assert.IsFalse(x.Contains(1 + 2 * epsilon));
        }
开发者ID:dzibma,项目名称:FuzzyMath,代码行数:15,代码来源:IntervalTest.cs

示例4: 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

示例5: Overlaps

 private bool Overlaps(Interval interval, Interval resInterval)
 {
     if (interval.Contains(resInterval.Start)) return true;
     if (interval.Contains(resInterval.End)) return true;
     if (resInterval.Contains(interval.Start)) return true;
     if (resInterval.Contains(interval.End)) return true;
     return false;
 }
开发者ID:qualifood,项目名称:EasyResourceShare,代码行数:8,代码来源:ReservationsController.cs

示例6: ContainsTest_Bound_ExclusiveOnUpperExclusive

 public void ContainsTest_Bound_ExclusiveOnUpperExclusive()
 {
     int lowerBound = 2;
     BoundType lowerBoundType = BoundType.Inclusive;
     int upperBound = 5;
     BoundType upperBoundType = BoundType.Exclusive;
     Interval<int> target = new Interval<int>(lowerBound, lowerBoundType, upperBound, upperBoundType);
     IBound<int> bound = new Bound<int>(5, BoundType.Exclusive);
     bool expected = true;
     bool actual;
     actual = target.Contains(bound);
     Assert.AreEqual(expected, actual);
 }
开发者ID:skonves,项目名称:Collections,代码行数:13,代码来源:IntervalTest.cs

示例7: AtLeast

        public void AtLeast()
        {
            var list = new int[] { 1, 2, 3 };
            Assert.True(list.AtLeast(2));
            Assert.True(list.AtLeast(3));
            Assert.False(list.AtLeast(4));

            Assert.True(list.AtLeast(2, i => i < 3));
            Assert.False(list.AtLeast(3, i => i < 3));

            // Should work for infinite sequences as well
            Assert.True(1.Inc().AtLeast(2));
            var interval = new Interval<int>(3, 7);
            Assert.True(1.Inc().AtLeast(2, i => interval.Contains(i)));
        }
开发者ID:jeremiahredekop,项目名称:Nvelope,代码行数:15,代码来源:ListExtensionTests.cs

示例8: IntervalContainment

		public void IntervalContainment(int s1, int e1, int v, bool expected)
		{
			Interval<int> a = new Interval<int>(s1, e1);

			if (expected)
				Assert.True(a.Contains(v));
			else
				Assert.False(a.Contains(v));
		}
开发者ID:Tinister,项目名称:IntervalTree,代码行数:9,代码来源:IntervalTests.cs

示例9: GetIntersectionsWithinTime

		/// <summary>
		/// Liefert alle Intersections im Zeitintervall interval
		/// </summary>
		/// <param name="interval">Intervall in dem nach Intersections gesucht werden soll</param>
		/// <returns>Eine Liste von Intersections die im Zeitintervall interval auf dieser Linie vorkommen</returns>
		public List<Intersection> GetIntersectionsWithinTime(Interval<double> interval)
			{
			List<Intersection> toReturn = new List<Intersection>();

			foreach (Intersection i in this.intersections)
				{
				if (this == i._aConnection)
					{
					if (interval.Contains(i._aTime))
						{
						toReturn.Add(i);
						}
					}
				else
					{
					if (interval.Contains(i._bTime))
						{
						toReturn.Add(i);
						}
					}
				}

			return toReturn;
			}
开发者ID:chenysh,项目名称:CTS-Develop,代码行数:29,代码来源:NodeConnection.cs

示例10: CheckContains

 private void CheckContains(Interval interval1, Interval interval2, bool expextedResult)
 {
     Assert.AreEqual(interval1.Contains(interval2), expextedResult);
 }
开发者ID:julkwiec,项目名称:Julas.Utils,代码行数:4,代码来源:IntervalTest.cs

示例11: Contains_EmptyInterval_MaxValue

 public void Contains_EmptyInterval_MaxValue()
 {
     var instant = Instant.MaxValue;
     var interval = new Interval(instant, instant);
     // This would have been true under Noda Time 1.x
     Assert.IsFalse(interval.Contains(instant));
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:7,代码来源:IntervalTest.cs

示例12: Contains_EmptyInterval

 public void Contains_EmptyInterval()
 {
     var instant = NodaConstants.UnixEpoch;
     var interval = new Interval(instant, instant);
     Assert.IsFalse(interval.Contains(instant));
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:6,代码来源:IntervalTest.cs

示例13: Contains_Infinite

 public void Contains_Infinite()
 {
     var interval = new Interval(null, null);
     Assert.IsTrue(interval.Contains(Instant.MaxValue));
     Assert.IsTrue(interval.Contains(Instant.MinValue));
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:6,代码来源:IntervalTest.cs

示例14: Contains

 public void Contains(string candidateText, bool expectedResult)
 {
     var start = Instant.FromUtc(2000, 1, 1, 0, 0);
     var end = Instant.FromUtc(2020, 1, 1, 0, 0);
     var interval = new Interval(start, end);
     var candidate = InstantPattern.ExtendedIsoPattern.Parse(candidateText).Value;
     Assert.AreEqual(expectedResult, interval.Contains(candidate));
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:8,代码来源:IntervalTest.cs

示例15: GetIntersectionsWithinArcLength

		/// <summary>
		/// Liefert alle Intersections im Bogenlängenintervall intervall
		/// </summary>
		/// <param name="interval">Bogenlängeintervall in dem die Intersections liegen sollen</param>
		/// <returns>Eine Liste von Intersections, die im Bogenlängenintervall intervall liegen</returns>
		public List<SpecificIntersection> GetIntersectionsWithinArcLength(Interval<double> interval)
			{
			List<SpecificIntersection> toReturn = new List<SpecificIntersection>();

			foreach (Intersection i in this.intersections)
				{
				if (this == i._aConnection)
					{
					if (interval.Contains(i.aArcPosition))
						{
						toReturn.Add(new SpecificIntersection(this, i));
						}
					}
				else
					{
					if (interval.Contains(i.bArcPosition))
						{
						toReturn.Add(new SpecificIntersection(this, i));
						}
					}
				}

			return toReturn;
			}
开发者ID:chenysh,项目名称:CTS-Develop,代码行数:29,代码来源:NodeConnection.cs


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