void Mark(int u) { TPosition pos = GenerateKey(u); while (!Null(pos.cluster.Cluster[pos.offset])) { if (pos.cluster.Cluster[pos.offset].u == u) { break; } IncreaseKey(ref pos); } TEntry entry = GetTEntry(pos); if (entry.GetMark() != true) { if (!IsTerminal(entry.low)) { Mark(entry.low); } AddMark(ref pos); if (!IsTerminal(entry.high)) { Mark(entry.high); } } }
private void AddCluster() { TCluster NewCluster = new TCluster(this.size); size = (int)(size * this.factor); NewCluster.next = this.FirstCluster; //New cluster is added in the beginning this.FirstCluster = NewCluster; TPosition pos = new TPosition(ref FirstCluster.next, 0); while (!(pos.cluster == FirstCluster && pos.offset == 0)) //rehash { if (Used(pos.cluster.Cluster[pos.offset])) { TEntry entry = pos.cluster.Cluster[pos.offset]; TPosition newPosition = GenerateKey(entry.u); if (newPosition.offset != pos.offset || newPosition.cluster != pos.cluster) { pos.cluster.Cluster[pos.offset] = TEntry.DirtyEntry(); this.count--; Add(entry); } } IncreaseKey(ref pos); } }
public IEnumerator GetEnumerator() { TPosition pos = new TPosition(ref FirstCluster, 0); while (!pos.IsLastPosition()) { if (Used(pos.cluster.Cluster[pos.offset])) { yield return(pos.cluster.Cluster[pos.offset]); } IncreaseKey(ref pos); } }
void UnMark(int u) { TPosition pos = GenerateKey(u); while (!Null(pos.cluster.Cluster[pos.offset])) { if (pos.cluster.Cluster[pos.offset].u == u) { pos.cluster.Cluster[pos.offset].SetMark(false); break; } IncreaseKey(ref pos); } }
public bool ContainsKey(int u) { TPosition pos = GenerateKey(u); while (!Null(pos.cluster.Cluster[pos.offset])) { if (pos.cluster.Cluster[pos.offset].u == u) { return(true); } IncreaseKey(ref pos); } return(false); }
public void Remove(int u) { TPosition pos = GenerateKey(u); while (!Null(pos.cluster.Cluster[pos.offset])) { if (pos.cluster.Cluster[pos.offset].u == u) { count--; pos.cluster.Cluster[pos.offset] = TEntry.DirtyEntry(); //Only flags dirty return; } IncreaseKey(ref pos); } }
public void Add(TEntry entry) { #if NoGC if (NeedResize()) { AddCluster(); } #endif TPosition pos = GenerateKey(entry.u); while (Used(pos.cluster.Cluster[pos.offset])) { IncreaseKey(ref pos); } pos.cluster.Cluster[pos.offset] = entry; count++; }
internal void IncreaseKey(ref TPosition position) { position.offset++; if (position.cluster.Cluster.Length == position.offset) //treat array as a cycle { position.offset = 0; if (position.cluster.IsLastCluster()) { position.cluster = this.FirstCluster; } else { position.cluster = position.cluster.next; } } }
public BddNode this[int u] { get { TPosition pos = GenerateKey(u); while (!Null(pos.cluster.Cluster[pos.offset])) { if (pos.cluster.Cluster[pos.offset].u == u) { return(new BddNode(pos.cluster.Cluster[pos.offset].low, pos.cluster.Cluster[pos.offset].high, pos.cluster.Cluster[pos.offset].GetVar())); } IncreaseKey(ref pos); } return(new BddNode(0, 0, 0)); } }
void AddMark(ref TPosition pos) { pos.cluster.Cluster[pos.offset].SetMark(true); }
private static TEntry GetTEntry(TPosition pos) { return(pos.cluster.Cluster[pos.offset]); }