cleanup: Fix a ton of build warnings (cs)

All these warnings have been bothering me for a while. The work isn't done, but
this commit chops them down from ~1000 to ~600.

* AppendCollection.cs
* AppendStreamModified.cs
* BenzingaNewsStream.cs
* BenzingaNewsSymbolStateStream.cs
* BookStream.cs
* CSVSaverStream.cs
* ChartsUtils.cs
* ColumnInfo.cs
* ContractUtils.cs
* ContractUtils.cs
* DiffStream.cs
* FuturesActiveContractStream.cs
* FuzzyJoinOverTimeStream.cs
* HistoricalBarsStream.cs
* HistoricalBarsStream.cs
* InstrumentsStream.cs
* JoinOperandRowIndex.cs
* JoinRow.cs
* JoinStream.cs
* JoinTable.cs
* JoinTableSchema.cs
* LatencyStream.cs
* LeftInternalJoinStream.cs
* LightForeignJoinRow.cs
* LightForeignJoinRowList.cs
* LightLeftForeignJoinRow.cs
* LiteralStream.cs
* NLStream.cs
* NLToDSLStream.cs
* NLToIndexedFewShotPromptStream.cs
* NonIncGroupByStream.cs
* NonIncJoinBookkeeper.cs
* NonIncJoinSpec.cs
* OHLCVStream.cs
* OpenAIPromptStream.cs
* PriceStatsStream.cs
* PriceStatsStream.cs
* ProjectHelper.cs
* ProjectStream.cs
* PubSubServerStateStream.cs
* PubsubHeartbeatStream.cs
* SimpleNode.cs
* SortRow.cs
* SpatialArbStatsStream.cs
* SpatialFuturePairsStream.cs
* SpreadPerformanceEvaluator.cs
* SpreadPerformanceStream.cs
* StreamIOCommon.cs
* SuperJoinStream.cs
* TableMetaDataStream.cs
* TextWriterStream.cs
* TimeAverageStream.cs
This commit is contained in:
John Colvin committed 2025-11-15 12:16:33 -05:00
1 parent 54d7279832
commit c4f12be3e4
48 files changed
+610 -590

No files matched your search

@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Text.Json.Serialization;
@@ -6,10 +7,10 @@ namespace BCG {
/// Resprsents information about a column schema, ie its ordinal, the type, the name and constant value or expression. where applicable
/// </summary>
[Serializable]
public class ColumnInfo : IComparable {
public class ColumnInfo : IEquatable<ColumnInfo>, IComparable<ColumnInfo>, IComparable {
//the default column info does not cach values in a lookup table, therefore it is in group 0
public ColumnInfo(string colName, int colNo, Type colType, object colValue = null) {
public ColumnInfo(string colName, int colNo, Type colType, object? colValue = null) {
myColName = colName;
myColNo = colNo;
myColType = colType;
@@ -27,22 +28,23 @@ namespace BCG {
type == typeof(string) ||
type == typeof(DateTime);
public int CompareTo(object obj) {
int otherColNo = ((ColumnInfo)(obj)).colNo;
if (myColNo < otherColNo)
return -1;
else if (myColNo > otherColNo)
return 1;
return 0;
}
public int CompareTo(ColumnInfo? other) =>
other is null ? 1 : colNo.CompareTo(other.colNo);
public override bool Equals(object obj) {
if (obj is ColumnInfo) {
ColumnInfo other = obj as ColumnInfo;
return (colNo == other.colNo) && (colName == other.colName) && (colType == other.colType);
}
return false;
}
public int CompareTo(object? obj) =>
CompareTo(obj as ColumnInfo);
public bool Equals(ColumnInfo? other) =>
other is not null
&& colNo == other.colNo
&& colType == other.colType
&& colName == other.colName;
public override bool Equals(object? obj) =>
Equals(obj as ColumnInfo);
public override int GetHashCode() =>
HashCode.Combine(colNo, colType, colName);
public override string ToString() {
return colName + " " + colNo + " " + colType;
@@ -55,7 +57,7 @@ namespace BCG {
private int myColNo;
private string myColName;
private Type myColType;
private object myColValue;
private object? myColValue;
[JsonPropertyName("colNo")]
public int colNo { get { return myColNo; } }
@@ -67,6 +69,6 @@ namespace BCG {
public Type colType { get { return myColType; } }
[JsonIgnore]
public object colValue {get{return myColValue;}}
public object? colValue {get{return myColValue;}}
}
}
@@ -1,6 +1,7 @@
using System;
#nullable enable
using BCG;
using System.Collections;
using System;
using System.IO;
// common place for all serialization interfaces
@@ -14,7 +15,7 @@ namespace bts {
// other operations can be expressed with this
MULTIPLE_REMOVE_ADD = 1,
}
public class CreateMessage {
public class CreateMessage : IEquatable<CreateMessage> {
public IBlueRowCollection rows;
public CreateMessage(IBlueRowCollection rows_) {
rows = rows_;
@@ -30,15 +31,19 @@ namespace bts {
}
return rv;
}
public override bool Equals(object obj) {
if (obj != null && obj is CreateMessage) {
var other = obj as CreateMessage;
return BlueDataUtility.compute_equality(rows, other.rows);
}
return false;
}
public bool Equals(CreateMessage? other) =>
other is not null && BlueDataUtility.compute_equality(rows, other.rows);
public override bool Equals(object? obj) =>
Equals(obj as CreateMessage);
public override int GetHashCode() =>
// Not the most elegant hash, but it works with the Equals fn. CreateMessages that are
// 'Equal' are guaranteed to have the same hash.
HashCode.Combine(rows.Count, rows.schema.columnInfo.Length);
}
public class MultipleRemoveAddMessage {
public class MultipleRemoveAddMessage : IEquatable<MultipleRemoveAddMessage> {
public IBlueRowCollection removed_rows;
public IBlueRowCollection added_rows;
public MultipleRemoveAddMessage(IBlueRowCollection removed_rows_, IBlueRowCollection added_rows_) {
@@ -56,18 +61,23 @@ namespace bts {
}
return rv;
}
public override bool Equals(object obj) {
if (obj != null && obj is MultipleRemoveAddMessage) {
MultipleRemoveAddMessage other = obj as MultipleRemoveAddMessage;
return BlueDataUtility.compute_equality(removed_rows, other.removed_rows) &&
BlueDataUtility.compute_equality(added_rows, other.added_rows);
}
return false;
}
public bool Equals(MultipleRemoveAddMessage? other) =>
other is not null
&& BlueDataUtility.compute_equality(removed_rows, other.removed_rows)
&& BlueDataUtility.compute_equality(added_rows, other.added_rows);
public override bool Equals(object? obj) =>
Equals(obj as MultipleRemoveAddMessage);
public override int GetHashCode() =>
// Not the most elegant hash, but it works with the Equals fn. CreateMessages that are
// 'Equal' are guaranteed to have the same hash.
HashCode.Combine(
removed_rows.Count, removed_rows.schema.columnNames.Length, added_rows.Count, added_rows.schema.columnInfo.Length);
}
public StreamOp op;
public readonly CreateMessage create_message = null;
public readonly MultipleRemoveAddMessage multiple_remove_add_message = null;
public readonly CreateMessage? create_message = null;
public readonly MultipleRemoveAddMessage? multiple_remove_add_message = null;
public StreamIOMessage(CreateMessage create_message_) {
op = StreamOp.CREATE;
@@ -83,29 +93,26 @@ namespace bts {
public override string ToString() {
switch (op) {
case StreamIOMessage.StreamOp.CREATE:
return create_message.ToString();
case StreamIOMessage.StreamOp.MULTIPLE_REMOVE_ADD:
return multiple_remove_add_message.ToString();
case StreamOp.CREATE:
return create_message!.ToString();
case StreamOp.MULTIPLE_REMOVE_ADD:
return multiple_remove_add_message!.ToString();
}
bts.Log.assert(false);
return String.Empty;
}
public override bool Equals(object obj) {
if (obj != null && obj is StreamIOMessage) {
StreamIOMessage other = obj as StreamIOMessage;
if (op == other.op) {
switch (op) {
case StreamOp.CREATE:
return create_message.Equals(other.create_message);
case StreamOp.MULTIPLE_REMOVE_ADD:
return multiple_remove_add_message.Equals(other.multiple_remove_add_message);
}
}
}
return false;
}
public bool Equals(StreamIOMessage? other) =>
op == other?.op && op switch {
StreamOp.CREATE => create_message!.Equals(other.create_message),
StreamOp.MULTIPLE_REMOVE_ADD => multiple_remove_add_message!.Equals(other.multiple_remove_add_message),
_ => false,
};
public override bool Equals(object? obj) =>
Equals(obj as StreamIOMessage);
public override int GetHashCode() =>
HashCode.Combine((int)op, create_message?.GetHashCode() ?? multiple_remove_add_message?.GetHashCode() ?? 0);
}
#region serialization
// This helps putting stream callbacks (op + data) on the wire, to send it to the pubsubserver.
@@ -134,4 +141,4 @@ namespace bts {
}
#endregion
}
}