Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
 public int RecordID(HashSig Sig) => HashToID[Sig];
Beispiel #6
0
 public bool SigExists(HashSig Sig) => HashToID.ContainsKey(Sig);