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 SearchResult(IDataIndex<TIndexType> dataIndex)
|
||||
{
|
||||
this.DataIndex = dataIndex;
|
||||
}
|
||||
|
||||
public IDataIndex<TIndexType>? DataIndex { get; set; }
|
||||
}
|
||||
|
||||
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 int Length { get; set; }
|
||||
}
|
||||
@ -111,10 +122,7 @@ public abstract class DataSetManipulatorBase<TCollectedType, TDataType, TIndexTy
|
||||
}
|
||||
if (searchIndex == data.Count)
|
||||
{
|
||||
var result = new DirectionalSearchResult<TIndexType>();
|
||||
result.DataIndex = currentPosition;
|
||||
result.Direction = direction;
|
||||
result.Length = searchIndex;
|
||||
var result = new DirectionalSearchResult<TIndexType>(currentPosition, direction, searchIndex);
|
||||
results.Add(result);
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ public class DefaultOneDimensionalManipulator<TDataType> : DataSetManipulatorBas
|
||||
{
|
||||
if (EqualityComparer<TDataType>.Default.Equals(this.dataSet[i], data))
|
||||
{
|
||||
var singleResult = new SearchResult<int>();
|
||||
singleResult.DataIndex = new DefaultPositionalDataIndex(i);
|
||||
var singleResult = new SearchResult<int>(new DefaultPositionalDataIndex(i));
|
||||
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))
|
||||
{
|
||||
var singleResult = new SearchResult<int>();
|
||||
singleResult.DataIndex = new DefaultPositionalDataIndex(x, y);
|
||||
var singleResult = new SearchResult<int>(new DefaultPositionalDataIndex(x, y));
|
||||
results.Add(singleResult);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user