cleanup: Fix more build warnings in DataStreamSuite

Alot more
This commit is contained in:
John Colvin committed 2026-01-11 15:15:13 -05:00
1 parent 989d103eef
commit bcd207f89e
118 files changed
+1812 -1597

No files matched your search

@@ -19,15 +19,15 @@ namespace BCG
public IBlueTableSchema schema { get { return mySchema; } }
public object this[int index] { get { return myRow[index]; } }
public object? this[int index] { get { return myRow[index]; } }
public object this[string colName] { get { return myRow[colName]; } }
public object? this[string colName] { get { return myRow[colName]; } }
#endregion
#region IDictionary Members
public void Add(object key, object value)
public void Add(object key, object? value)
{
throw new Exception("The method or operation is not implemented.");
}
@@ -54,7 +54,7 @@ namespace BCG
public ICollection Values { get { return myRow.Values; } }
public object this[object key]
public object? this[object key]
{
get { return myRow[key]; }
set { throw new Exception("The method or operation is not implemented."); }
@@ -82,7 +82,7 @@ namespace BCG
}
private string myNewName;
private IBlueTableSchema mySchema;
IBlueTableSchema? mySchema;
public ChangeTableNameStream (ViewStream vs, string name)
{
@@ -1,9 +1,9 @@
using Bts.ColumnMapExpressions;
using Spark.Core.Diagnostics;
using System;
using System.Collections;
using System.Data;
using System.Text.RegularExpressions;
using BCG.Utilities;
using Bts.ColumnMapExpressions;
namespace BCG
{
@@ -56,7 +56,7 @@ namespace BCG
{
IDictionary retVal = new Hashtable ();
foreach (DictionaryEntry de in dic)
retVal[de.Value] = de.Key;
retVal[ExceptionAssert.NotNull(de.Value)] = de.Key;
return retVal;
}
@@ -1,13 +1,11 @@
using Bts.ColumnMapExpressions;
using Bts.DataStream;
using mbts.config;
using Spark.Core.Diagnostics;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
// using BCG.Evaluator.ColumnMapExpression;
namespace BCG
{
@@ -26,7 +24,7 @@ namespace BCG
/// <param name="isch">original(unprojected) schema</param>
/// <param name="exp">expression defining the mapping</param>
/// <param name="tableName">table name of the new schema</param>
internal ProjectHelper (IBlueTableSchema isch, string exp, string tableName)
internal ProjectHelper (IBlueTableSchema isch, string exp, string? tableName)
: this (isch, myGetDictionary (isch, exp), tableName)
{}
@@ -36,7 +34,7 @@ namespace BCG
/// <param name="origToAlias">dictionary mapping unprojected names to their projected names, dropped cols should not be there</param>
/// <param name="tableName">table name of the new schema</param>
internal ProjectHelper (
IBlueTableSchema isch, IDictionary<string, string> origToAlias, string tableName)
IBlueTableSchema isch, IDictionary<string, string> origToAlias, string? tableName)
{
ArrayList colMapAl = new ArrayList (),
colInfoAl = new ArrayList ();
@@ -61,7 +59,7 @@ namespace BCG
schema = new BlueTableSchema (tableName == null ? isch.tableName : tableName,
colInfoAl.ToArray (typeof(ColumnInfo)) as ColumnInfo[]);
colMap = colMapAl.ToArray (typeof(int)) as int[];
colMap = (int[])colMapAl.ToArray(typeof(int));
}
/// <summary>
@@ -74,8 +72,8 @@ namespace BCG
private static IDictionary<string, string> myGetDictionary (IBlueTableSchema isch, string exp)
{
IDictionary<string, string> origToAlias = new Dictionary<string, string>();
var e = ColumnMapExpression.Parse(exp);
var e = ColumnMapExpression.Parse(exp)
?? throw new ArgumentException("Failed to parse ColumnMapExpression", nameof(exp));
if (e.IsInclusive) {
origToAlias = e.Columns.ToDictionary();
origToAlias["id"] = "id";
@@ -95,7 +93,7 @@ namespace BCG
{
IDictionary retVal = new Hashtable (dic.Count);
foreach (DictionaryEntry de in dic)
retVal.Add (de.Value, de.Key);
retVal.Add(ExceptionAssert.NotNull(de.Value), de.Key);
return retVal;
}
}
@@ -1,6 +1,10 @@
namespace BCG {
using Spark.Core.Collections;
using Bts.DataStreamCore;
using Spark.Core.Collections;
using Spark.Core.Diagnostics;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -8,10 +12,13 @@ namespace BCG {
[DataStreamUserRespresentation("oldproject")]
public class ProjectStream : ViewStream
{
private ProjectHelper myHelper;
private string myColExp, myTableName;
private ViewStream myVs;
private IDictionary<string, string> myDic;
private ProjectHelper? myHelper;
readonly string? myColExp;
readonly string? myTableName;
readonly ViewStream? myVs;
private IDictionary<string, string>? myDic;
IDisposable? subscription;
/// <summary>
/// </summary>
/// <param name="vs">stream to susbsribe to as the input stream</param>
@@ -52,14 +59,13 @@ namespace BCG {
myDic = dic.ToDictionary(kv => kv.Value, kv => kv.Key);
}
protected override void myOnFirstSubscriber()
{
myVs.onChange += new BCG.DataStream.ChangeDelegate (myHandleChange);
}
protected override void myOnFirstSubscriber() =>
subscription = ExceptionAssert.MemberNotNull(myVs).Subscribe(myHandleChange);
protected override void myOnLastSubscriber()
{
myVs.onChange -= new BCG.DataStream.ChangeDelegate (myHandleChange);;
subscription?.Dispose();
subscription = null;
}
internal void myHandleChange (object newValue)
@@ -79,7 +85,7 @@ namespace BCG {
else
{ //first time a callback is received
myHelper = myDic == null ?
new ProjectHelper (dp.Schema, myColExp, myTableName) :
new ProjectHelper(dp.Schema, ExceptionAssert.MemberNotNull(myColExp), myTableName) :
new ProjectHelper (dp.Schema, myDic, myTableName);
IBlueRowCollection temp;
@@ -1,6 +1,5 @@
using System;
using System.Collections;
using BCG.Utilities;
namespace BCG
{
@@ -22,9 +21,11 @@ namespace BCG
#region IBlueRow Members
public object this [string colName] {get {return this[myHelper.schema[colName].colNo];}}
public object? this [string colName] =>
this[myHelper.schema[colName].colNo];
public object this [int index] {get {return myRow[myHelper.colMap[index]];}}
public object? this [int index] =>
myRow[myHelper.colMap[index]];
public IBlueTableSchema schema {get {return myHelper.schema;}}
@@ -36,9 +37,13 @@ namespace BCG
public IDictionaryEnumerator GetEnumerator() {return new BlueRowDictionaryEnumerator (this);}
object System.Collections.IDictionary.this[object key]
object? IDictionary.this[object key]
{
get {return key is int ? this[(int)key] : this[key as string];}
get => key switch {
int i => this[i],
string s => this[s],
_ => throw new ArgumentException("Must be int or string", nameof(key)),
};
set {throw new ApplicationException ("Is read only");}
}
@@ -58,7 +63,8 @@ namespace BCG
}
}
public void Add (object key, object value) {throw new ApplicationException ("Is read only");}
public void Add(object key, object? value) =>
throw new NotSupportedException();
public ICollection Keys {get {return myHelper.schema.columnNames;}}
@@ -78,7 +84,7 @@ namespace BCG
array.SetValue (this[ci.colNo], index ++);
}
public object SyncRoot {get {return null;}}
public object SyncRoot => this;
#endregion
@@ -1,3 +1,5 @@
using Bts.DataStreamCore;
using System;
using System.Collections;
@@ -42,7 +44,7 @@ namespace BCG
public void CopyTo (Array array, int index)
{
foreach (IBlueRow r in myRows)
array.SetValue (this[(int)r["id"]], index++);
array.SetValue(this[r.Id()], index++);
}
@@ -72,14 +74,10 @@ namespace BCG
public void Reset() {myMaster.Reset();}
public object Current
{
get
{
return myMaster.Current == null ? null :
new ProjectedRow (myMaster.Current as IBlueRow, myHelper);
}
}
public object? Current =>
myMaster.Current is null
? null
: new ProjectedRow((IBlueRow)myMaster.Current, myHelper);
public bool MoveNext() {return myMaster.MoveNext ();}