public DateTime?GetDateTime(TRB_KIND kind, TRB_PART part, TRB_PART where, TRB_STATE whereState) { DateTime?dt = null; switch (kind) { case TRB_KIND.MINIMUM: dt = TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).Min(trb => trb.GetDateTime(part)); break; case TRB_KIND.MAXIMUM: dt = TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).Max(trb => trb.GetDateTime(part)); break; case TRB_KIND.FIRST: { var atrb = TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).FirstOrDefault(trb => null != trb.GetDateTime(part)); dt = atrb != null?atrb.GetDateTime(part) : null; } break; case TRB_KIND.LAST: { var atrb = TimeBoxCollection.Where(trb => trb.GetDateTime(where, whereState) != null).LastOrDefault(trb => null != trb.GetDateTime(part)); dt = atrb != null?atrb.GetDateTime(part) : null; } break; } return(dt); }
public DateTime?GetDateTime(TRB_KIND kind, TRB_PART part, TRB_PART where, TRB_STATE whereState) { DateTime?dt = null; switch (kind) { case TRB_KIND.MINIMUM: dt = ProjectCollection.Min(proj => proj.GetDateTime(kind, part, where, whereState)); break; case TRB_KIND.MAXIMUM: dt = ProjectCollection.Max(proj => proj.GetDateTime(kind, part, where, whereState)); break; case TRB_KIND.FIRST: break; case TRB_KIND.LAST: break; default: break; } return(dt); }
internal static TimeBox FromSetting(string txt) { try { var part = txt.Split(" ".ToCharArray(), StringSplitOptions.None); DateTime dt0 = _deserialize(part[0]); DateTime dt1 = _deserialize(part[1]); TRB_STATE startState = (TRB_STATE)Enum.Parse(typeof(TRB_STATE), part[2]); TRB_STATE endState = (TRB_STATE)Enum.Parse(typeof(TRB_STATE), part[3]); TRB_STATE wholeState = (TRB_STATE)Enum.Parse(typeof(TRB_STATE), part[4]); TimeBox tbox = new TimeBox(dt0, dt1); tbox.StartState = startState; tbox.EndState = endState; tbox.WholeState = wholeState; return(tbox); } catch { // ignored } return(null); }
public static void writeOut(TRB_STATE state, bool withHeader = true) { if (withHeader) { Console.WriteLine("a sWAS : aNY, sNAPPED, WARNING, ARMED, SELECTED"); } Console.WriteLine(Convert.ToString((int)state, 2).PadLeft(32, '0').Substring(25)); }
internal void TimeBoxClearContainedEdits(TRB_PART part, TRB_STATE state) { // edits within time boxes TimeBoxCollection.ForEach(trb => { if (trb.HasState(part, state)) { trb.ClearContainedEdits(); } }); }
internal void TimeBoxDelete(TRB_PART part, TRB_STATE state, bool visibleOnly = true) { ProjectCollection.ForEach(proj => { if (proj.Visible || !visibleOnly) { proj.DeleteTimeBoxes(part, state); } } ); ActivityTraceBuilder.Buildv2(this); }
internal List <DateTime> GetDateTimes(TRB_PART part, TRB_STATE partState) { List <DateTime> ret = new List <DateTime>(); foreach (var trb in TimeBoxCollection) { var tmp = trb.GetDateTimes(part, partState); if (tmp.Count > 0) { ret.AddRange(tmp); } } return(ret); }
internal void TimeBoxClearContainedEdits(TRB_PART part, TRB_STATE state, bool visibleOnly = true) { lock (tableLock) { ProjectCollection.ForEach(proj => { if (proj.Visible || !visibleOnly) { proj.TimeBoxClearContainedEdits(part, state); } } ); _sortAndSanitize(); _setTimeExtents(); _organizeIntoProjects(); ActivityTraceBuilder.Buildv2(this); } }
internal void UnsetState(TRB_PART part, TRB_PART where, TRB_STATE whereState, TRB_STATE state) { ProjectCollection.ForEach(proj => proj.UnsetState(part, where, whereState, state)); }
internal void SetState(TRB_PART part, TRB_STATE state) { ProjectCollection.ForEach(proj => proj.SetState(part, state)); }
internal void DeleteTimeBoxes(TRB_PART part, TRB_STATE state) { TimeBoxCollection.RemoveAll(trb => trb.HasState(part, state)); }
internal void ToggleState(TRB_PART part, TRB_PART where, TRB_STATE state) { TimeBoxCollection.ForEach(trb => trb.ToggleState(part, where, state)); }
internal void UnsetState(TRB_PART part, TRB_PART where, TRB_STATE whereState, TRB_STATE state) { TimeBoxCollection.ForEach(trb => trb.UnsetState(part, where, whereState, state)); }
internal void SetState(TRB_PART part, TRB_STATE state) { TimeBoxCollection.ForEach(trb => trb.SetState(part, state)); }
internal void SetDateTime(TRB_PART part, TRB_STATE partState, DateTime dt) { TimeBoxCollection.ForEach(trb => trb.SetDateTime(part, partState, dt)); }
internal void ToggleState(TRB_PART part, TRB_PART where, TRB_STATE state) { ProjectCollection.ForEach(proj => proj.ToggleState(part, where, state)); }
internal bool HasState(TRB_PART part, TRB_STATE state) { return(ProjectCollection.FirstOrDefault(proj => proj.HasState(part, state)) != null); }
internal bool HasState(TRB_PART part, TRB_STATE state) { return(TimeBoxCollection.FirstOrDefault(trb => trb.HasState(part, state)) != null); }