Beispiel #1
0
        public void Add(T eventData)
        {
            String   uid      = uidFunction(eventData);
            DateTime dateTime = dateFunction(eventData);

            if (uids.Contains(uid))
            {
                return;
            }
            historyEntry <T> entry = new historyEntry <T>(eventData, dateTime, uid);

            events.Add(entry);
            uids.Add(uid);
            if (first_entry == null)
            {
                first_entry = entry;
            }
            else if (last_entry == null)
            {
                last_entry = entry;
            }
            else
            {
                if (first_entry.dateTime > dateTime)
                {
                    first_entry = entry;
                }
                if (last_entry.dateTime < dateTime)
                {
                    last_entry = entry;
                }
            }
        }
Beispiel #2
0
        public T GetEntryData(String uid)
        {
            historyEntry <T> entry = GetEntry(uid);

            if (entry != null)
            {
                return(entry.data);
            }
            return(null);
        }
Beispiel #3
0
        public Boolean Remove(String uid)
        {
            historyEntry <T> entry = GetEntry(uid);

            if (entry != null)
            {
                events.Remove(entry);
                uids.Remove(uid);
                if (entry == last_entry)
                {
                    last_entry = null;
                }
                if (entry == first_entry)
                {
                    first_entry = null;
                }
                return(true);
            }
            return(false);
        }