General cleanup and refactor.

This commit is contained in:
2022-03-07 07:36:32 +00:00
parent 27900ec144
commit 8d40f3e395
60 changed files with 1034 additions and 1156 deletions

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="byte" /></summary>
public class ExtentsByte
{
@@ -72,7 +72,7 @@ public class ExtentsByte
Tuple<byte, byte> removeTwo = null;
Tuple<byte, byte> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&

View File

@@ -36,13 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
using Schemas;
namespace Aaru.CommonTypes.Extents;
/// <summary>Converts extents</summary>
public static class ExtentsConverter
{
@@ -55,7 +54,7 @@ public static class ExtentsConverter
return null;
Tuple<ulong, ulong>[] tuples = extents.ToArray();
ExtentType[] array = new ExtentType[tuples.Length];
var array = new ExtentType[tuples.Length];
for(ulong i = 0; i < (ulong)array.LongLength; i++)
array[i] = new ExtentType
@@ -75,8 +74,7 @@ public static class ExtentsConverter
if(extents == null)
return null;
List<Tuple<ulong, ulong>> tuples =
extents.Select(extent => new Tuple<ulong, ulong>(extent.Start, extent.End)).ToList();
var tuples = extents.Select(extent => new Tuple<ulong, ulong>(extent.Start, extent.End)).ToList();
return new ExtentsULong(tuples);
}

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="int" /></summary>
public class ExtentsInt
{
@@ -72,7 +72,7 @@ public class ExtentsInt
Tuple<int, int> removeTwo = null;
Tuple<int, int> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="long" /></summary>
public class ExtentsLong
{
@@ -72,7 +72,7 @@ public class ExtentsLong
Tuple<long, long> removeTwo = null;
Tuple<long, long> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="sbyte" /></summary>
public class ExtentsSByte
{
@@ -72,7 +72,7 @@ public class ExtentsSByte
Tuple<sbyte, sbyte> removeTwo = null;
Tuple<sbyte, sbyte> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&
@@ -241,8 +241,7 @@ public class ExtentsSByte
{
start = 0;
foreach(Tuple<sbyte, sbyte> extent in
_backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
foreach(Tuple<sbyte, sbyte> extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
{
start = extent.Item1;

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="short" /></summary>
public class ExtentsShort
{
@@ -72,7 +72,7 @@ public class ExtentsShort
Tuple<short, short> removeTwo = null;
Tuple<short, short> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&
@@ -241,8 +241,7 @@ public class ExtentsShort
{
start = 0;
foreach(Tuple<short, short> extent in
_backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
foreach(Tuple<short, short> extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
{
start = extent.Item1;

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="uint" /></summary>
public class ExtentsUInt
{
@@ -72,7 +72,7 @@ public class ExtentsUInt
Tuple<uint, uint> removeTwo = null;
Tuple<uint, uint> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="ulong" /></summary>
public class ExtentsULong
{
@@ -72,7 +72,7 @@ public class ExtentsULong
Tuple<ulong, ulong> removeTwo = null;
Tuple<ulong, ulong> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&
@@ -241,8 +241,7 @@ public class ExtentsULong
{
start = 0;
foreach(Tuple<ulong, ulong> extent in
_backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
foreach(Tuple<ulong, ulong> extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
{
start = extent.Item1;

View File

@@ -36,12 +36,12 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.CommonTypes.Extents;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Aaru.CommonTypes.Extents;
/// <summary>Implements extents for <see cref="ushort" /></summary>
public class ExtentsUShort
{
@@ -72,7 +72,7 @@ public class ExtentsUShort
Tuple<ushort, ushort> removeTwo = null;
Tuple<ushort, ushort> itemToAdd = null;
for(int i = 0; i < _backend.Count; i++)
for(var i = 0; i < _backend.Count; i++)
{
// Already contained in an extent
if(item >= _backend[i].Item1 &&
@@ -241,8 +241,7 @@ public class ExtentsUShort
{
start = 0;
foreach(Tuple<ushort, ushort> extent in _backend.Where(extent => item >= extent.Item1 &&
item <= extent.Item2))
foreach(Tuple<ushort, ushort> extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2))
{
start = extent.Item1;