static DayRollConventions() { ImmutableMap.Builder <string, RollConvention> mapBuilder = ImmutableMap.builder(); foreach (RollConvention roll in Dom.CONVENTIONS) { mapBuilder.put(roll.Name, roll); mapBuilder.put(roll.Name.ToUpper(Locale.ENGLISH), roll); } foreach (RollConvention roll in Dow.CONVENTIONS) { mapBuilder.put(roll.Name, roll); mapBuilder.put(roll.Name.ToUpper(Locale.ENGLISH), roll); } MAP = mapBuilder.build(); for (int i = 0; i < 30; i++) { CONVENTIONS[i] = new Dom(i + 1); } for (int i = 0; i < 7; i++) { DayOfWeek dow = DayOfWeek.of(i + 1); string name = NAMES.substring(i * 6, ((i + 1) * 6) - (i * 6)); CONVENTIONS[i] = new Dow(dow, name); } }
public void UploadDowIndex(string path) { string DATE_HEADER = "Date"; string ADJ_CLOSE = "Adj Close"; dowIndex = new List <Dow>(); if (dowIndex == null) { dowIndex = new List <Dow>(); } else { dowIndex.Clear(); } using (CSV reader = new CSV(path)) { string value; int i = 0; while (reader.next()) { DateTime date = reader.getDate(DATE_HEADER); double amount = reader.getDouble(ADJ_CLOSE); Dow temp = new Dow(date, amount); dowIndex.Add(temp); if (amount > MaxDow) { MaxDow = amount; } if (amount < MinDow) { MinDow = amount; } } reader.close(); dowIndex.Sort(); } if (MaxDate > dowIndex[dowIndex.Count - 1].Date) { MaxDate = dowIndex[dowIndex.Count - 1].Date; } if (MinDate < dowIndex[0].Date) { MinDate = dowIndex[0].Date; } }
internal object readResolve() { return(Dow.of(day)); }