/// <summary> /// Add a new term for invocation /// </summary> /// <param name="term">The term</param> public void AddTerm(Term term) { _context.Logger.Log(this, String.Format("Adding a new term (time: {0}, state {1}, owner {2})", term.Time, term.State, LoggingHelpers.GetTypeOrName(term.Owner)), 8); if (term.Time < _time) { throw new ArgumentException("It's not possible to add a term based in past!"); } else if (term.Time == _time) { InvokeTerm(term); } else { _terms.Add(term); } }
public void RemoveTerm(Term term) { _context.Logger.Log(this, String.Format("Removing a term (time: {0}, state {1}, owner {2})", term.Time, term.State, LoggingHelpers.GetTypeOrName(term.Owner)), 10); foreach (Term t in _terms) { if (t.EqualsTo(term)) { _terms.Remove(t); } } }
/// <summary> /// Invokes a term /// </summary> /// <param name="term">The term</param> protected void InvokeTerm(Term term) { _time = term.Time; _context.Logger.Log(this, String.Format("Invoking a term (time: {0}, state {1}, owner {2})", term.Time, term.State, LoggingHelpers.GetTypeOrName(term.Owner)), 5); term.Owner.Notify(new Event.Event(term.State, term.Data), this); }
public bool EqualsTo(Term t) { return (t.Data == Data) && (t.Owner == Owner) && (t.State == State) && (t.Time == Time); }