public ReportTableRowList SolveIt() { if (!_isInitialized) throw new Exception("Class is not Initialized yet"); var returnList = new ReportTableRowList(); switch (_solverMethod) { case SolvingMethod.Method1: returnList = Method1(_caseLength, _scriptReader); break; case SolvingMethod.Method2: returnList = Method2(_caseLength, _scriptReader); break; default: break; } return returnList; }
public static ReportTableRowList SolveIt(int length) { var returnList = new ReportTableRowList(); var scriptReader = new PythonScriptReader(); int cumulativeLifeTime = 0; while (length > 0) { int randomDelayNumber = scriptReader.GenerateNumber(1, 100); int mappedDelayTimeValue = scriptReader.MapDelayTime(randomDelayNumber); int life1 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int life2 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int life3 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int firstFailure = new List<int> {life1, life2, life3}.Min(); cumulativeLifeTime += firstFailure; returnList.PushRow(new ReportTableRowClass(life1, life2, life3, firstFailure, cumulativeLifeTime, randomDelayNumber, mappedDelayTimeValue)); length--; } return returnList; }
public static ReportTableRowList SolveIt(int length) { var returnList = new ReportTableRowList(); var scriptReader = new PythonScriptReader(); int cumulativeLifeTime = 0; while (length > 0) { int randomLifeTimeNumber = scriptReader.GenerateNumber(1, 100); int mappedLifeTimeValue = scriptReader.MapLifeTime(randomLifeTimeNumber); int randomDelayNumber = scriptReader.GenerateNumber(1, 100); int mappedDelayTimeValue = scriptReader.MapDelayTime(randomDelayNumber); cumulativeLifeTime += mappedLifeTimeValue; returnList.PushRow(new ReportTableRowClass(randomLifeTimeNumber, mappedLifeTimeValue, cumulativeLifeTime, randomDelayNumber, mappedDelayTimeValue)); length--; } return returnList; }
public Method1(ReportTableRowList dataList1, ReportTableRowList dataList2, ReportTableRowList dataList3, TimeSpan time) { InitializeComponent(); _eventList = new List<ReportTableRowList> {dataList1, dataList2, dataList3}; _time = time; }
private ReportTableRowList Method1(int length, IScriptReader scriptReader) { var list = new ReportTableRowList(); int cumulativeLifeTime = 0; while (length > 0) { int randomLifeTimeNumber = scriptReader.GenerateNumber(0, 100); int mappedLifeTimeValue = scriptReader.MapLifeTime(randomLifeTimeNumber); int randomDelayNumber = scriptReader.GenerateNumber(0, 100); int mappedDelayTimeValue = scriptReader.MapDelayTime(randomDelayNumber); cumulativeLifeTime += mappedLifeTimeValue; list.PushRow(new ReportTableRowClass(randomLifeTimeNumber, mappedLifeTimeValue, cumulativeLifeTime, randomDelayNumber, mappedDelayTimeValue)); length--; } return list; }
private ReportTableRowList Method2(int length, IScriptReader scriptReader) { var list = new ReportTableRowList(); int cumulativeLifeTime = 0; while (length > 0) { int randomDelayNumber = scriptReader.GenerateNumber(1, 100); int mappedDelayTimeValue = scriptReader.MapDelayTime(randomDelayNumber); int life1 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int life2 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int life3 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int firstFailure = new List<int> {life1, life2, life3}.Min(); cumulativeLifeTime += firstFailure; list.PushRow(new ReportTableRowClass(life1, life2, life3, firstFailure, cumulativeLifeTime, randomDelayNumber, mappedDelayTimeValue)); length--; } return list; }
public Method2(ReportTableRowList data) { InitializeComponent(); _eventList = new List<ReportTableRowList> {data}; }