@@ -58,9 +58,7 @@ public IInterval<T> Clamp( IInterval<T> range )
5858 /// <param name = "after">The interval in which to store the part after the point, if any, null otherwise.</param>
5959 public void Split ( T atPoint , SplitOption option , out IInterval < T > before , out IInterval < T > after )
6060 {
61- IInterval < T , T > beforeInner ;
62- IInterval < T , T > afterInner ;
63- Split ( atPoint , option , out beforeInner , out afterInner ) ;
61+ Split ( atPoint , option , out IInterval < T , T > beforeInner , out IInterval < T , T > afterInner ) ;
6462 before = ReduceGenerics ( beforeInner ) ;
6563 after = ReduceGenerics ( afterInner ) ;
6664 }
@@ -164,26 +162,22 @@ public abstract partial class AbstractInterval<T, TSize> : IInterval<T, TSize>
164162 /// <summary>
165163 /// The start of the interval.
166164 /// </summary>
167- public T Start { get { return IsReversed ? _end : _start ; } }
168-
165+ public T Start => IsReversed ? _end : _start ;
169166 readonly T _end ;
170167 /// <summary>
171168 /// The end of the interval.
172169 /// </summary>
173- public T End { get { return IsReversed ? _start : _end ; } }
174-
170+ public T End => IsReversed ? _start : _end ;
175171 readonly bool _isStartIncluded ;
176172 /// <summary>
177173 /// Is the value at the start of the interval included in the interval.
178174 /// </summary>
179- public bool IsStartIncluded { get { return IsReversed ? _isEndIncluded : _isStartIncluded ; } }
180-
175+ public bool IsStartIncluded => IsReversed ? _isEndIncluded : _isStartIncluded ;
181176 readonly bool _isEndIncluded ;
182177 /// <summary>
183178 /// Is the value at the end of the interval included in the interval.
184179 /// </summary>
185- public bool IsEndIncluded { get { return IsReversed ? _isStartIncluded : _isEndIncluded ; } }
186-
180+ public bool IsEndIncluded => IsReversed ? _isStartIncluded : _isEndIncluded ;
187181 /// <summary>
188182 /// Determines whether the start of the interval lies before or after the end of the interval. true when after, false when before.
189183 /// </summary>
@@ -192,13 +186,11 @@ public abstract partial class AbstractInterval<T, TSize> : IInterval<T, TSize>
192186 /// <summary>
193187 /// Get the value in the center of the interval. Rounded to the nearest correct value.
194188 /// </summary>
195- public T Center { get { return GetValueAt ( 0.5 ) ; } }
196-
189+ public T Center => GetValueAt ( 0.5 ) ;
197190 /// <summary>
198191 /// Get the size of the interval.
199192 /// </summary>
200- public TSize Size { get { return Subtract ( _end , _start ) ; } }
201-
193+ public TSize Size => Subtract ( _end , _start ) ;
202194
203195 /// <summary>
204196 /// Create a new interval with a specified start and end.
@@ -262,7 +254,7 @@ public double GetPercentageFor( T position )
262254 return LiesInInterval ( position ) ? 1.0 : - 1.0 ;
263255 }
264256
265- var positionRange = CreateInstance ( Start , true , position , true ) ;
257+ IInterval < T , TSize > positionRange = CreateInstance ( Start , true , position , true ) ;
266258 double percentage = Convert ( positionRange . Size ) / size ;
267259
268260 // Negate percentage when position lies before the interval.
@@ -363,7 +355,7 @@ public T Clamp( T value )
363355 /// <returns>The given range, which excludes all parts lying outside of this range. Null when empty.</returns>
364356 public IInterval < T , TSize > Clamp ( IInterval < T , TSize > range )
365357 {
366- var intersection = Intersection ( range ) ;
358+ IInterval < T , TSize > intersection = Intersection ( range ) ;
367359 if ( intersection == null )
368360 {
369361 return null ;
@@ -381,7 +373,7 @@ public IInterval<T, TSize> Clamp( IInterval<T, TSize> range )
381373
382374 bool thisIsSmaller = _start . CompareTo ( range . Start ) <= 0 ;
383375 bool thisIsBigger = _end . CompareTo ( range . End ) >= 0 ;
384- var clamped = CreateInstance (
376+ IInterval < T , TSize > clamped = CreateInstance (
385377 thisIsSmaller ? range . Start : _start ,
386378 thisIsSmaller ? intersection . IsStartIncluded : _isStartIncluded ,
387379 thisIsBigger ? range . End : _end ,
@@ -525,7 +517,7 @@ public IInterval<T, TSize> Intersection( IInterval<T, TSize> interval )
525517 int startCompare = _start . CompareTo ( interval . Start ) ;
526518 int endCompare = _end . CompareTo ( interval . End ) ;
527519
528- var intersection = CreateInstance (
520+ IInterval < T , TSize > intersection = CreateInstance (
529521 startCompare > 0 ? _start : interval . Start ,
530522 startCompare == 0
531523 ? _isStartIncluded && interval . IsStartIncluded // On matching boundary, only include when they both include the boundary.
@@ -604,7 +596,7 @@ public IEnumerable<T> GetValues( TSize step, T anchor )
604596 /// <param name = "stepAction">The operation to execute.</param>
605597 public void EveryStepOf ( TSize step , Action < T > stepAction )
606598 {
607- foreach ( var i in GetValues ( step ) )
599+ foreach ( T i in GetValues ( step ) )
608600 {
609601 stepAction ( i ) ;
610602 }
@@ -652,7 +644,7 @@ public IInterval<T, TSize> ExpandTo( T value, bool include )
652644 isEndIncluded |= include ;
653645 }
654646
655- var extended = CreateInstance ( start , isStartIncluded , end , isEndIncluded ) ;
647+ IInterval < T , TSize > extended = CreateInstance ( start , isStartIncluded , end , isEndIncluded ) ;
656648 return IsReversed ? extended . Reverse ( ) : extended ;
657649 }
658650
@@ -715,7 +707,7 @@ public IInterval<T, TSize> Scale( double scale, IInterval<T, TSize> limit, doubl
715707 }
716708 T end = endExceeded ? limit . End : SubtractSize ( _end , endSubtraction ) ;
717709
718- var scaled = CreateInstance ( start , _isStartIncluded , end , _isEndIncluded ) ;
710+ IInterval < T , TSize > scaled = CreateInstance ( start , _isStartIncluded , end , _isEndIncluded ) ;
719711 return IsReversed ? scaled . Reverse ( ) : scaled ;
720712 }
721713
0 commit comments