public bool Add(HashSig hashSig, int id) { if (!HashToID.ContainsKey(hashSig)) { IdToHash.Add(id, hashSig); HashToID.Add(hashSig, id); var foo = IdToHash.Keys; return(true); } return(false); }
public bool TryGetHash(int id, out HashSig sig) { bool found; if (IdExists(id)) { sig = HashValue(id); found = true; } else { sig = null; // or new HashSig() ? found = false; } return(found); }
public bool TryGetID(HashSig sig, out int id) { bool found; if (SigExists(sig)) { id = RecordID(sig); found = true; } else { id = 0; found = false; } return(found); }
public bool AddRow(DataRow row, int rownumber) { var sig = new HashSig(row); int id; if (row["id"] == System.DBNull.Value) { //id = rownumber; throw new Exception("oops id is null in HashTable.add"); } else { id = row.Field <int>("id"); } return(Add(sig, id)); }
public int RecordID(HashSig Sig) => HashToID[Sig];
public bool SigExists(HashSig Sig) => HashToID.ContainsKey(Sig);