generated from Templates/Dotnet_Library
feat: adding sensible index constructors refs: NOISSUE
This commit is contained in:
parent
7e5ab9f799
commit
e9aa60524c
@ -4,11 +4,22 @@ namespace Parsing.Data;
|
|||||||
|
|
||||||
public class SearchResult<TIndexType>
|
public class SearchResult<TIndexType>
|
||||||
{
|
{
|
||||||
|
public SearchResult(IDataIndex<TIndexType> dataIndex)
|
||||||
|
{
|
||||||
|
this.DataIndex = dataIndex;
|
||||||
|
}
|
||||||
|
|
||||||
public IDataIndex<TIndexType>? DataIndex { get; set; }
|
public IDataIndex<TIndexType>? DataIndex { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DirectionalSearchResult<TIndexType> : SearchResult<TIndexType>
|
public class DirectionalSearchResult<TIndexType> : SearchResult<TIndexType>
|
||||||
{
|
{
|
||||||
|
public DirectionalSearchResult(IDataIndex<TIndexType> dataIndex, Direction direction, int length): base(dataIndex)
|
||||||
|
{
|
||||||
|
this.Direction = direction;
|
||||||
|
this.Length = length;
|
||||||
|
}
|
||||||
|
|
||||||
public Direction Direction { get; set; }
|
public Direction Direction { get; set; }
|
||||||
public int Length { get; set; }
|
public int Length { get; set; }
|
||||||
}
|
}
|
||||||
@ -111,10 +122,7 @@ public abstract class DataSetManipulatorBase<TCollectedType, TDataType, TIndexTy
|
|||||||
}
|
}
|
||||||
if (searchIndex == data.Count)
|
if (searchIndex == data.Count)
|
||||||
{
|
{
|
||||||
var result = new DirectionalSearchResult<TIndexType>();
|
var result = new DirectionalSearchResult<TIndexType>(currentPosition, direction, searchIndex);
|
||||||
result.DataIndex = currentPosition;
|
|
||||||
result.Direction = direction;
|
|
||||||
result.Length = searchIndex;
|
|
||||||
results.Add(result);
|
results.Add(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,7 @@ public class DefaultOneDimensionalManipulator<TDataType> : DataSetManipulatorBas
|
|||||||
{
|
{
|
||||||
if (EqualityComparer<TDataType>.Default.Equals(this.dataSet[i], data))
|
if (EqualityComparer<TDataType>.Default.Equals(this.dataSet[i], data))
|
||||||
{
|
{
|
||||||
var singleResult = new SearchResult<int>();
|
var singleResult = new SearchResult<int>(new DefaultPositionalDataIndex(i));
|
||||||
singleResult.DataIndex = new DefaultPositionalDataIndex(i);
|
|
||||||
results.Add(singleResult);
|
results.Add(singleResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,7 @@ public class DefaultTwoDimensionalManipulator<TDataType> : DataSetManipulatorBas
|
|||||||
{
|
{
|
||||||
if (EqualityComparer<TDataType>.Default.Equals(this.dataSet[this.dataSet.Count - y - 1][x], data))
|
if (EqualityComparer<TDataType>.Default.Equals(this.dataSet[this.dataSet.Count - y - 1][x], data))
|
||||||
{
|
{
|
||||||
var singleResult = new SearchResult<int>();
|
var singleResult = new SearchResult<int>(new DefaultPositionalDataIndex(x, y));
|
||||||
singleResult.DataIndex = new DefaultPositionalDataIndex(x, y);
|
|
||||||
results.Add(singleResult);
|
results.Add(singleResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user