Skip to content

Commit

Permalink
Cleaned up code based on code analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
katieb1 committed Apr 28, 2023
1 parent 888ccbe commit 410215c
Show file tree
Hide file tree
Showing 49 changed files with 177 additions and 180 deletions.
10 changes: 5 additions & 5 deletions src/DataFeedViews/FlowPathwayDataFeedView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public FlowPathwayDataFeedView()
}

private bool m_IsEnabled;
private ToolTip m_TooltipZoomOut = new ToolTip();
private ToolTip m_TooltipZoomIn = new ToolTip();
private FlowPathwayTabStripItem m_DiagramTab = new FlowPathwayTabStripItem("Diagram");
private FlowPathwayTabStripItem m_StockTab = new FlowPathwayTabStripItem("Stocks");
private FlowPathwayTabStripItem m_FlowTab = new FlowPathwayTabStripItem("Flows");
private readonly ToolTip m_TooltipZoomOut = new ToolTip();
private readonly ToolTip m_TooltipZoomIn = new ToolTip();
private readonly FlowPathwayTabStripItem m_DiagramTab = new FlowPathwayTabStripItem("Diagram");
private readonly FlowPathwayTabStripItem m_StockTab = new FlowPathwayTabStripItem("Stocks");
private readonly FlowPathwayTabStripItem m_FlowTab = new FlowPathwayTabStripItem("Flows");
private DiagramFilterCriteria m_FilterCriteria = new DiagramFilterCriteria();

protected override void InitializeView()
Expand Down
2 changes: 1 addition & 1 deletion src/DataSheets/FlowTypeDataSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FlowTypeDataSheet : DataSheet
private DataTable m_FlowTypeDataTable;
private DataSheet m_FlowGroupDataSheet;
private DataTable m_FlowGroupDataTable;
private Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();
private readonly Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();

protected override void OnDataFeedsRefreshed()
{
Expand Down
2 changes: 1 addition & 1 deletion src/DataSheets/StockTypeDataSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class StockTypeDataSheet : DataSheet
private DataTable m_StockTypeDataTable;
private DataSheet m_StockGroupDataSheet;
private DataTable m_StockGroupDataTable;
private Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();
private readonly Dictionary<int, string> m_PrevNames = new Dictionary<int, string>();

protected override void OnDataFeedsRefreshed()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Diagram/DiagramFilterCriteria.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class DiagramFilterCriteria
{
private Dictionary<int, bool> m_FlowTypes = new Dictionary<int, bool>();
private readonly Dictionary<int, bool> m_FlowTypes = new Dictionary<int, bool>();

public Dictionary<int, bool> FlowTypes
{
Expand Down
2 changes: 1 addition & 1 deletion src/Diagram/FlowPathwayDiagram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class FlowPathwayDiagram : BoxArrowDiagram
private DataTable m_FlowDiagramData;
private DataSheet m_FlowPathwaySheet;
private DataTable m_FlowPathwayData;
private Dictionary<int, StockTypeShape> m_ShapeLookup = new Dictionary<int, StockTypeShape>();
private readonly Dictionary<int, StockTypeShape> m_ShapeLookup = new Dictionary<int, StockTypeShape>();
private bool m_IsFilterApplied;

public FlowPathwayDiagram()
Expand Down
2 changes: 1 addition & 1 deletion src/Diagram/FlowPathwayLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowPathwayLine : ConnectorLine
{
private FlowPathway m_Pathway;
private readonly FlowPathway m_Pathway;

public FlowPathwayLine(Color lineColor, FlowPathway pathway) : base(lineColor)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Diagram/StockTypeShape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace SyncroSim.STSimStockFlow
{
internal class StockTypeShape : BoxDiagramShape
{
private int m_StockTypeId;
private List<FlowPathway> m_OutgoingPathways = new List<FlowPathway>();
private List<FlowPathway> m_IncomingPathways = new List<FlowPathway>();
private readonly int m_StockTypeId;
private readonly List<FlowPathway> m_OutgoingPathways = new List<FlowPathway>();
private readonly List<FlowPathway> m_IncomingPathways = new List<FlowPathway>();
private bool m_IsReadOnly;

public StockTypeShape(int stockTypeId, string displayName) :
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/FlowGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowGroup : StockFlowType
{
private FlowTypeLinkageCollection m_FlowTypeLinkages = new FlowTypeLinkageCollection();
private readonly FlowTypeLinkageCollection m_FlowTypeLinkages = new FlowTypeLinkageCollection();

public FlowGroup(int id, string name) : base(id, name)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/FlowGroupLinkage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace SyncroSim.STSimStockFlow
{
class FlowGroupLinkage
{
private FlowGroup m_FlowGroup;
private double m_Value;
private readonly FlowGroup m_FlowGroup;
private readonly double m_Value;

public FlowGroupLinkage(FlowGroup flowGroup, double value)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Runtime/FlowLateralMultiplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowLateralMultiplier
{
private int m_FlowGroupId;
private int? m_FlowMultiplierTypeId;
private int? m_Iteration;
private int? m_Timestep;
private string m_Filename;
private readonly int m_FlowGroupId;
private readonly int? m_FlowMultiplierTypeId;
private readonly int? m_Iteration;
private readonly int? m_Timestep;
private readonly string m_Filename;

public FlowLateralMultiplier(
int flowGroupId,
Expand Down
10 changes: 5 additions & 5 deletions src/Runtime/FlowMultiplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowMultiplier : STSimDistributionBase
{
private int? m_StateClassId;
private int m_AgeMin;
private int m_AgeMax = int.MaxValue;
private int? m_FlowMultiplierTypeId;
private int m_FlowGroupId;
private readonly int? m_StateClassId;
private readonly int m_AgeMin;
private readonly int m_AgeMax = int.MaxValue;
private readonly int? m_FlowMultiplierTypeId;
private readonly int m_FlowGroupId;

public FlowMultiplier(
int? iteration,
Expand Down
10 changes: 5 additions & 5 deletions src/Runtime/FlowMultiplierByStock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowMultiplierByStock : STSimDistributionBase
{
private int? m_StateClassId;
private int? m_FlowMultiplierTypeId;
private int m_FlowGroupID;
private int m_StockGroupId;
private double m_StockValue;
private readonly int? m_StateClassId;
private readonly int? m_FlowMultiplierTypeId;
private readonly int m_FlowGroupID;
private readonly int m_StockGroupId;
private readonly double m_StockValue;

public FlowMultiplierByStock(
int? iteration, int? timestep, int? stratumId, int? secondaryStratumId, int? tertiaryStratumId,
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/FlowMultiplierByStockMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowMultiplierByStockMap : StockFlowMapBase6<SortedList<double, FlowMultiplierByStock>>
{
private STSimDistributionProvider m_DistributionProvider;
private readonly STSimDistributionProvider m_DistributionProvider;

public FlowMultiplierByStockMap(
Scenario scenario,
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/FlowMultiplierMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowMultiplierMap : StockFlowMapBase5<List<FlowMultiplier>>
{
private STSimDistributionProvider m_DistributionProvider;
private readonly STSimDistributionProvider m_DistributionProvider;

public FlowMultiplierMap(Scenario scenario, FlowMultiplierCollection items, STSimDistributionProvider provider) : base(scenario)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Runtime/FlowMultiplierType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ namespace SyncroSim.STSimStockFlow
{
class FlowMultiplierType
{
private Scenario m_Scenario;
private STSimDistributionProvider m_Provider;
private int? m_FlowMultiplierTypeId;
private FlowMultiplierCollection m_FlowMultipliers = new FlowMultiplierCollection();
private readonly Scenario m_Scenario;
private readonly STSimDistributionProvider m_Provider;
private readonly int? m_FlowMultiplierTypeId;
private readonly FlowMultiplierCollection m_FlowMultipliers = new FlowMultiplierCollection();
private FlowMultiplierMap m_FlowMultiplierMap;
private FlowSpatialMultiplierCollection m_FlowSpatialMultipliers = new FlowSpatialMultiplierCollection();
private readonly FlowSpatialMultiplierCollection m_FlowSpatialMultipliers = new FlowSpatialMultiplierCollection();
private FlowSpatialMultiplierMap m_FlowSpatialMultiplierMap;
private FlowLateralMultiplierCollection m_FlowLateralMultipliers = new FlowLateralMultiplierCollection();
private readonly FlowLateralMultiplierCollection m_FlowLateralMultipliers = new FlowLateralMultiplierCollection();
private FlowLateralMultiplierMap m_FlowLateralMultiplierMap;
private FlowMultiplierByStockCollection m_FlowMultipliersByStock = new FlowMultiplierByStockCollection();
private readonly FlowMultiplierByStockCollection m_FlowMultipliersByStock = new FlowMultiplierByStockCollection();
private FlowMultiplierByStockMap m_FlowMultiplierByStockMap;

public FlowMultiplierType(
Expand Down
8 changes: 4 additions & 4 deletions src/Runtime/FlowOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowOrder
{
private int? m_iteration;
private int? m_timestep;
private int m_flowTypeId;
private double m_Order = Constants.DEFAULT_FLOW_ORDER;
private readonly int? m_iteration;
private readonly int? m_timestep;
private readonly int m_flowTypeId;
private readonly double m_Order = Constants.DEFAULT_FLOW_ORDER;

public FlowOrder(int? iteration, int? timestep, int flowTypeId, double? order)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/FlowOrderMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace SyncroSim.STSimStockFlow
internal class FlowOrderMap
{
private bool m_HasItems;
private SortedKeyMap2<FlowOrderCollection> m_Map = new SortedKeyMap2<FlowOrderCollection>(SearchMode.ExactPrev);
private readonly SortedKeyMap2<FlowOrderCollection> m_Map = new SortedKeyMap2<FlowOrderCollection>(SearchMode.ExactPrev);

public FlowOrderMap(FlowOrderCollection orders)
{
Expand Down
46 changes: 23 additions & 23 deletions src/Runtime/FlowPathway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowPathway
{
private int? m_Iteration;
private int? m_Timestep;
private int? m_FromStratumId;
private int? m_FromSecondaryStratumId;
private int? m_FromTertiaryStratumId;
private int? m_FromStateClassId;
private int? m_FromMinimumAge;
private int? m_FromStockTypeId;
private int? m_ToStratumId;
private int? m_ToStateClassId;
private int? m_ToMinimumAge;
private int? m_ToStockTypeId;
private int m_TransitionGroupId;
private int? m_StateAttributeTypeId;
private int m_FlowTypeId;
private Constants.TargetType m_TargetType = Constants.TargetType.Flow;
private double m_Multiplier;
private int? m_TransferToStratumId;
private int? m_TransferToSecondaryStratumId;
private int? m_TransferToTertiaryStratumId;
private int? m_TransferToStateClassId;
private int? m_TransferToMinimumAge;
private readonly int? m_Iteration;
private readonly int? m_Timestep;
private readonly int? m_FromStratumId;
private readonly int? m_FromSecondaryStratumId;
private readonly int? m_FromTertiaryStratumId;
private readonly int? m_FromStateClassId;
private readonly int? m_FromMinimumAge;
private readonly int? m_FromStockTypeId;
private readonly int? m_ToStratumId;
private readonly int? m_ToStateClassId;
private readonly int? m_ToMinimumAge;
private readonly int? m_ToStockTypeId;
private readonly int m_TransitionGroupId;
private readonly int? m_StateAttributeTypeId;
private readonly int m_FlowTypeId;
private readonly Constants.TargetType m_TargetType = Constants.TargetType.Flow;
private readonly double m_Multiplier;
private readonly int? m_TransferToStratumId;
private readonly int? m_TransferToSecondaryStratumId;
private readonly int? m_TransferToTertiaryStratumId;
private readonly int? m_TransferToStateClassId;
private readonly int? m_TransferToMinimumAge;
private float m_FlowAmount;
private bool m_IsLateral;
private readonly bool m_IsLateral;

public FlowPathway(
int? iteration,
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/FlowPathwayMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace SyncroSim.STSimStockFlow
internal class FlowPathwayMap
{
private bool m_HasRecords;
private MultiLevelKeyMap9<SortedKeyMap4<List<FlowPathway>>> m_Map = new MultiLevelKeyMap9<SortedKeyMap4<List<FlowPathway>>>();
private readonly MultiLevelKeyMap9<SortedKeyMap4<List<FlowPathway>>> m_Map = new MultiLevelKeyMap9<SortedKeyMap4<List<FlowPathway>>>();

public FlowPathwayMap(FlowPathwayCollection pathways)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Runtime/FlowSpatialMultiplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowSpatialMultiplier
{
private int m_FlowGroupId;
private int? m_FlowMultiplierTypeId;
private int? m_Iteration;
private int? m_Timestep;
private string m_Filename;
private readonly int m_FlowGroupId;
private readonly int? m_FlowMultiplierTypeId;
private readonly int? m_Iteration;
private readonly int? m_Timestep;
private readonly string m_Filename;

public FlowSpatialMultiplier(
int flowGroupId,
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/FlowType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace SyncroSim.STSimStockFlow
{
internal class FlowType : StockFlowType
{
private FlowGroupLinkageCollection m_FlowGroupLinkages = new FlowGroupLinkageCollection();
private readonly FlowGroupLinkageCollection m_FlowGroupLinkages = new FlowGroupLinkageCollection();
private double m_Order = Constants.DEFAULT_FLOW_ORDER;

public FlowType(int id, string name) : base(id, name)
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/FlowTypeLinkage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace SyncroSim.STSimStockFlow
{
class FlowTypeLinkage
{
private FlowType m_FlowType;
private float m_Value;
private readonly FlowType m_FlowType;
private readonly float m_Value;

public FlowTypeLinkage(FlowType flowType, float value)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Runtime/InitialStockNonSpatial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace SyncroSim.STSimStockFlow
{
internal class InitialStockNonSpatial
{
private int m_Id;
private int m_StockTypeId;
private int m_StateAttributeTypeId;
private readonly int m_Id;
private readonly int m_StockTypeId;
private readonly int m_StateAttributeTypeId;

public InitialStockNonSpatial(int id, int stockTypeId, int stateAttributeTypeId)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Runtime/InitialStockSpatial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace SyncroSim.STSimStockFlow
{
internal class InitialStockSpatial
{
private int? m_Iteration = null;
private int m_StockTypeId;
private string m_filename;
private readonly int? m_Iteration = null;
private readonly int m_StockTypeId;
private readonly string m_filename;

public InitialStockSpatial(int? iteration, int stockTypeId, string filename)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/InitialStockSpatialMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace SyncroSim.STSimStockFlow
internal class InitialStockSpatialMap
{
private bool m_HasItems;
private SortedKeyMap1<InitialStockSpatialCollection> m_Map = new SortedKeyMap1<InitialStockSpatialCollection>(SearchMode.ExactPrev);
private readonly SortedKeyMap1<InitialStockSpatialCollection> m_Map = new SortedKeyMap1<InitialStockSpatialCollection>(SearchMode.ExactPrev);

public InitialStockSpatialMap(InitialStockSpatialCollection icd)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/LateralFlowAmountMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace SyncroSim.STSimStockFlow
{
class LateralFlowAmountMap
{
private List<LateralFlowAmountRecord> m_AllRecords = new List<LateralFlowAmountRecord>();
private readonly List<LateralFlowAmountRecord> m_AllRecords = new List<LateralFlowAmountRecord>();

private MultiLevelKeyMap6<SortedKeyMap1<LateralFlowAmountRecord>> m_Map =
private readonly MultiLevelKeyMap6<SortedKeyMap1<LateralFlowAmountRecord>> m_Map =
new MultiLevelKeyMap6<SortedKeyMap1<LateralFlowAmountRecord>>();

public List<LateralFlowAmountRecord> AllRecords
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/LateralFlowCoupletMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace SyncroSim.STSimStockFlow
{
class LateralFlowCoupletMap
{
private List<LateralFlowCouplet> m_Couplets = new List<LateralFlowCouplet>();
private Dictionary<string, LateralFlowCouplet> m_LookAside = new Dictionary<string, LateralFlowCouplet>();
private readonly List<LateralFlowCouplet> m_Couplets = new List<LateralFlowCouplet>();
private readonly Dictionary<string, LateralFlowCouplet> m_LookAside = new Dictionary<string, LateralFlowCouplet>();

public void AddCouplet(int? stockTypeId, int flowTypeId)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/OutputFilterCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace SyncroSim.STSimStockFlow
{
class OutputFilterCollection
{
Dictionary<int, OutputFilterBase> m_Items = new Dictionary<int, OutputFilterBase>();
readonly Dictionary<int, OutputFilterBase> m_Items = new Dictionary<int, OutputFilterBase>();

public bool HasItems
{
Expand Down
Loading

0 comments on commit 410215c

Please sign in to comment.