External/OxyPlot/OxyPlot.WindowsForms/HashSet.cs
author StephaneLenclud
Thu, 18 Apr 2013 19:51:05 +0200
branchMiniDisplay
changeset 443 8c139748f179
permissions -rw-r--r--
FrontView can now display time when not packed.
Now waiting 4 ticks before cycling.
moel@392
     1

moel@392
     2
namespace OxyPlot.WindowsForms {
moel@392
     3
  using System;
moel@392
     4
  using System.Collections.Generic;
moel@392
     5
  using System.Text;
moel@392
     6
moel@392
     7
  public class HashSet<T> {
moel@392
     8
moel@392
     9
    private readonly Dictionary<T, object> set = new Dictionary<T, object>();
moel@392
    10
moel@392
    11
    public bool Add(T value) {
moel@392
    12
      if (set.ContainsKey(value))
moel@392
    13
        return true;
moel@392
    14
moel@392
    15
      set.Add(value, null);
moel@392
    16
      return false;
moel@392
    17
    }
moel@392
    18
moel@392
    19
    public bool Contains(T value) {
moel@392
    20
      return set.ContainsKey(value);
moel@392
    21
    }
moel@392
    22
moel@392
    23
    public void Clear() {
moel@392
    24
      set.Clear();
moel@392
    25
    }
moel@392
    26
  }
moel@392
    27
}