Exemplo n.º 1
0
        void     Register(Lox lox, ContainerOp operation)
        {
            try { ALIB.Lock.Acquire();

                  // check
                  if (lox == null)
                  {
                      ALIB.ERROR("null given");
                      return;
                  }

                  // remove
                  if (operation == ContainerOp.Remove)
                  {
                      if (!loxes.Remove(lox))
                      {
                          ALIB.WARNING("A lox named \"" + lox.GetName()
                                       + "\" could not be found for removal.");
                      }
                  }

                  // insert
                  else
                  {
                      foreach (Lox it in loxes)
                      {
                          if (it.GetName().Equals(lox.GetName( )))
                          {
                              ALIB.ERROR("A lox named \"" + lox.GetName()
                                         + "\" was already registered. Registration ignored");
                              return;
                          }
                      }
                      loxes.Add(lox);
                  } } finally { ALIB.Lock.Release(); }
        }