Compare commits
5 Commits
0.7.1
...
e83e99758a
| Author | SHA1 | Date | |
|---|---|---|---|
| e83e99758a | |||
| 81ac797b4c | |||
| e9aa60524c | |||
| 7e5ab9f799 | |||
| fc137ebd03 |
20
HISTORY.md
20
HISTORY.md
@@ -4,12 +4,32 @@ Changelog
|
|||||||
|
|
||||||
(unreleased)
|
(unreleased)
|
||||||
------------
|
------------
|
||||||
|
- Feat: adding sensible index constructors refs: NOISSUE. [Simon
|
||||||
|
Diesenreiter]
|
||||||
|
|
||||||
|
|
||||||
|
0.7.2 (2024-12-05)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Fix
|
||||||
|
~~~
|
||||||
|
- Add some missing API methods, ref: NOISSUE. [Simon Diesenreiter]
|
||||||
|
|
||||||
|
Other
|
||||||
|
~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
0.7.1 (2024-12-05)
|
||||||
|
------------------
|
||||||
|
|
||||||
Fix
|
Fix
|
||||||
~~~
|
~~~
|
||||||
- Allow for parsing single chars as input, ref: NOISSUE. [Simon
|
- Allow for parsing single chars as input, ref: NOISSUE. [Simon
|
||||||
Diesenreiter]
|
Diesenreiter]
|
||||||
|
|
||||||
|
Other
|
||||||
|
~~~~~
|
||||||
|
|
||||||
|
|
||||||
0.7.0 (2024-12-05)
|
0.7.0 (2024-12-05)
|
||||||
------------------
|
------------------
|
||||||
|
|||||||
@@ -20,4 +20,24 @@ public static class DataManipulationHelpers
|
|||||||
{
|
{
|
||||||
return reducer(data);
|
return reducer(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<TNewType> TransformData<TType, TNewType>(this List<TType> data, Func<TType, TNewType> transformer)
|
||||||
|
{
|
||||||
|
var newList = new List<TNewType>();
|
||||||
|
foreach (TType dataItem in data)
|
||||||
|
{
|
||||||
|
newList.Add(transformer(dataItem));
|
||||||
|
}
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<TNewType> TransformData<TType, TNewType>(this List<List<TType>> data, Func<List<TType>, TNewType> transformer)
|
||||||
|
{
|
||||||
|
var newList = new List<TNewType>();
|
||||||
|
foreach (List<TType> dataItemList in data)
|
||||||
|
{
|
||||||
|
newList.Add(transformer(dataItem));
|
||||||
|
}
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +131,7 @@ public abstract class DataSetManipulatorBase<TCollectedType, TDataType, TIndexTy
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DirectionalSearchResult<TIndexType>> FindInSet(List<TDataType> data)
|
public List<DirectionalSearchResult<TIndexType>> FindInSet(List<TDataType> data, Direction directions)
|
||||||
{
|
{
|
||||||
var result = new List<DirectionalSearchResult<TIndexType>>();
|
var result = new List<DirectionalSearchResult<TIndexType>>();
|
||||||
|
|
||||||
@@ -131,11 +139,16 @@ public abstract class DataSetManipulatorBase<TCollectedType, TDataType, TIndexTy
|
|||||||
var startingPoints = this.FindInSet(data[0]);
|
var startingPoints = this.FindInSet(data[0]);
|
||||||
foreach (var startingPoint in startingPoints)
|
foreach (var startingPoint in startingPoints)
|
||||||
{
|
{
|
||||||
foreach (var results in this.FindAtPosition(startingPoint.DataIndex, data))
|
foreach (var results in this.FindAtPosition(startingPoint.DataIndex, data, directions))
|
||||||
{
|
{
|
||||||
result.AddRange(results);
|
result.AddRange(results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DirectionalSearchResult<TIndexType>> FindInSet(List<TDataType> data)
|
||||||
|
{
|
||||||
|
return this.FindInSet(data, this.ValidDirections());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,4 +156,21 @@ public class TokenConverter
|
|||||||
|
|
||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TokenConverter Filter<T>(params InputType[] inputTypes)
|
||||||
|
{
|
||||||
|
var newTokenList = new List<List<IToken>>()
|
||||||
|
|
||||||
|
foreach(var token in rawTokens)
|
||||||
|
{
|
||||||
|
if(inputTypes.Contains(token.GetInputType()))
|
||||||
|
{
|
||||||
|
newTokenList.Add(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rawTokens = newTokenList;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0.7.1
|
0.8.0
|
||||||
|
|||||||
Reference in New Issue
Block a user