public void Add(TKey1 key1, TKey2 key2, TValue value) { if (llista1.ContainsKey(key1)) { throw new Exception("Esta duplicada la clave1 para el valor"); } if (llista2.ContainsKey(key2)) { throw new Exception("Esta duplicada la clave2 para el valor"); } llista1.Add(key1, value); llista2.Add(key2, value); llistaClau1.Add(key1, key2); llistaClau2.Add(key2, key1); }
public Point GetPoint(System.Drawing.Color color) { int colorInt = color.ToArgb(); Point location; if (pointLocatedByColorList.ContainsKey(colorInt)) { location = pointLocatedByColorList[colorInt].Value; } else { location = GetPoint(colorInt); } return(location); }
public void Add(TKey key, TValue value) { if (key == null) { throw new ArgumentNullException(); } if (value == null) { throw new ArgumentNullException(); } if (!diccionari.ContainsKey(key)) { diccionari.Add(key, new LlistaOrdenada <IComparable, TValue>()); } diccionari[key].Add(value, value); }
public Point GetPoint(int colorInt) { const int ARGB = 4; int posicion; byte[] bytesColor; Point location = default(Point); bool encontrado = false; if (pointLocatedByColorList.ContainsKey(colorInt)) { location = pointLocatedByColorList[colorInt].Value; } else { bytesColor = Serializar.GetBytes(colorInt); for (int y = 0, yFin = Convert.ToInt32(imagen.Height), xFin = Convert.ToInt32(imagen.Width) * ARGB; y < yFin && !encontrado; y++) { for (int x = 0; x < xFin && !encontrado; x += ARGB) { posicion = x + (y * xFin); encontrado = bytesImg[posicion] == bytesColor[0] && bytesImg[posicion + 1] == bytesColor[1] && bytesImg[posicion + 2] == bytesColor[2] && bytesImg[posicion + 3] == bytesColor[3]; if (encontrado) { location = new Point(x, y); } } } if (!encontrado) { throw new ArgumentOutOfRangeException("El color no esta dentro de la imagen!"); } else { pointLocatedByColorList.Add(colorInt, location); if (!colorLocatedByPointerList.ContainsKey(new PointZ(location, 0))) { colorLocatedByPointerList.Add(new PointZ(location, 0), System.Drawing.Color.FromArgb(colorInt)); } } } return(location); }
public static bool ValidaString(string stringHex) { bool valida = true; for (int i = 0; i < stringHex.Length && valida; i++) { valida = diccionarioCaracteresValidos.ContainsKey(stringHex[i]); } return(valida); }
public static void QuitaOAbortaFaena(Tiket <TipoTrabajo> faenaHaAbortar) { if (feanasHaciendose.ContainsKey(faenaHaAbortar.IdUnico)) { hilosFaenas.Remove(feanasHaciendose[faenaHaAbortar.IdUnico].Value.Key.Name); try { feanasHaciendose[faenaHaAbortar.IdUnico].Value.Key.Abort(); } catch { } feanasHaciendose.Remove(faenaHaAbortar.IdUnico); faenaHaAbortar.DentroPool = false; } else if (faenasEstaticas.Contains(faenaHaAbortar)) { faenasEstaticas.Remove(faenaHaAbortar); faenaHaAbortar.DentroPool = false; } }
public bool ContainsKey2(TKey2 key2) { return(llistaClau2.ContainsKey(key2)); }
public bool ContainsKey1(TKey1 key1) { return(llistaClau1.ContainsKey(key1)); }