public override void Next(BoolSet flags, char c) { if (this.c == c) { flags[this.next.Index] = true; } }
private void EpsilonMove(BoolSet nexts, BoolSet epsil, BoolSet enext) { epsil.Reset(); foreach (var i in nexts) { foreach (var n in this.instances[i].Epsilons) { epsil[n] = true; } } foreach (var i in epsil) { nexts[i] = true; } do { enext.Reset(); foreach (var i in epsil) { foreach (var n in this.instances[i].Epsilons.Where(d => !nexts[d])) { nexts[n] = true; enext[n] = true; } } epsil.Swap(enext); } while (epsil); }
public void Swap(BoolSet set) { var impl = this.set; this.set = set.set; set.set = impl; }
public override void Next(BoolSet flags, char c) { if (!flags[this.next.Index] && this.func(c)) { flags[this.next.Index] = true; } }
private void InitialSet(out BoolSet flags, out BoolSet nexts, out BoolSet epsil, out BoolSet enext) { flags = new BoolSet(); nexts = new BoolSet(); epsil = new BoolSet(); enext = new BoolSet(); flags[this.startIndex] = true; EpsilonMove(flags, epsil, enext); }
private void OneStep(BoolSet flags, BoolSet nexts, BoolSet epsil, BoolSet enext, char c) { nexts.Reset(); foreach (var i in flags) { this.instances[i].Next(nexts, c); } EpsilonMove(nexts, epsil, enext); flags.Swap(nexts); }
private bool Check(BoolSet flags) { bool inner(int i) { return(this.instances[i].Goal); } bool notinner(int i) { return(!this.instances[i].Goal); } return(this.NotFlag ? flags.All(notinner) : flags.Any(inner)); }
public virtual void Next(BoolSet flags, char c) { }