示例#1
0
 public void Remove(NewClass obj)
 {
     ByName.Remove(obj.Name);
     ByScore[obj.Score].Remove(obj);
     ByPosition[obj.Pos].Remove(obj);
     objects.Remove(obj);
 }
示例#2
0
        public void RemoveByName(string name)
        {
            if (!ByName.ContainsKey(name))
            {
                return;
            }

            NewClass obj = ByName[name];

            Remove(obj);
        }
示例#3
0
        public void Add(NewClass obj)
        {
            int score = obj.Score;

            if (ByScore.ContainsKey(score))
            {
                ByScore[score].Add(obj);
            }
            else
            {
                ByScore.Add(score, new HashSet <NewClass>()
                {
                    obj
                });
            }


            Position pos = obj.Pos;

            if (ByPosition.ContainsKey(pos))
            {
                ByPosition[pos].Add(obj);
            }
            else
            {
                ByPosition.Add(pos, new HashSet <NewClass>()
                {
                    obj
                });
            }


            ByName.Add(obj.Name, obj);


            obj.Node = objects.AddFirst(obj);
        }