/
FileWriter.cs
106 lines (89 loc) · 3.41 KB
/
FileWriter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
using System.Collections.Generic;
using System.Text;
namespace StockAnalysis
{
internal class OutputFileWriter: ThreadProcRequest
{
internal CriteriaPostAggFiltered postAggFiltered;
internal CriteriaPostAggFilteredDetails postAggDetails;
internal CriteriaPostAggThreshold postAggThreshold;
private string outputDir;
public OutputFileWriter(string directory)
{
outputDir = directory;
postAggFiltered = new CriteriaPostAggFiltered();
postAggDetails = new CriteriaPostAggFilteredDetails();
postAggThreshold = new CriteriaPostAggThreshold();
}
public override void Execute(ref bool destory)
{
// TODO: write to directory the 3 files
}
}
internal class CriteriaPostAggFiltered
{
private Dictionary<string, AggValues> thresholdRelevantEntries = new Dictionary<string, AggValues>();
internal void AddToOutputEntry(string key, AggValues values)
{
thresholdRelevantEntries.Add(key, values);
}
internal IReadOnlyDictionary<string, AggValues> GetRefToFilteredDictionary()
{
return thresholdRelevantEntries;
}
}
internal class CriteriaPostAggFilteredDetails
{
private List<StockDataEntry> dividedSummedStockData = new List<StockDataEntry>();
internal void AddStockEntry(StockDataEntry sde)
{
dividedSummedStockData.Add(sde);
}
internal IReadOnlyList<StockDataEntry> GetReferenceToStockEntryList()
{
return dividedSummedStockData;
}
}
internal class CriteriaPostAggThreshold
{
private string criteriaSetName;
internal DateTime todaysDate { get; private set; } = DateTime.Today; // TODO: Check format of Today
private string commaSeparatedAggKeyColumns;
private string postAggColumn;
private List<ThresholdAggOutputValues> outputThresholdEntries = new List<ThresholdAggOutputValues>();
internal void AddCriteriaSetName(string name)
{
criteriaSetName = name;
}
internal string GetTodaysDate()
{
return todaysDate.ToString("MM/dd/yyyy");
}
internal void AddCommaSeparatedAggKeyColumns(string commaSeparatedColumns)
{
commaSeparatedAggKeyColumns = commaSeparatedColumns;
}
internal void AddThresholdOutputValue(string aggKey, double columnValue, double thresholdCrossed)
{
ThresholdAggOutputValues taov = new ThresholdAggOutputValues(aggKey, columnValue, thresholdCrossed);
outputThresholdEntries.Add(taov);
}
internal IReadOnlyList<ThresholdAggOutputValues> GetRefToOutputThresholdList()
{
return outputThresholdEntries;
}
}
internal class ThresholdAggOutputValues
{
internal string aggKey { get; private set; }
internal double columnValue { get; private set; }
internal double crossedThreshold { get; private set; }
internal ThresholdAggOutputValues(string key, double column, double threshold)
{
aggKey = key;
columnValue = column;
crossedThreshold = threshold;
}
}
}