internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain {0}", var1)); } if (pos2 < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain {0}", var2)); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; if (var1.IsFirstOrder) { return(BasicAutomata.MkEqualPositions2(pos1, pos2, alg)); } else { return(BasicAutomata.MkEqualSets(pos1, pos2, alg)); } }
internal override Automaton <BDD> getAutomaton(SimpleList <string> variables, CharSetSolver solver) { var pos1 = variables.IndexOf(var1) + ((int)solver.Encoding); var pos2 = variables.IndexOf(var2) + ((int)solver.Encoding); //var trueBv = MkTrue(variables, solver); var pos1is0 = solver.MkBitFalse(pos1); var pos1is1 = solver.MkBitTrue(pos1); var pos2is0 = solver.MkBitFalse(pos2); var pos2is1 = solver.MkBitTrue(pos2); var both0 = solver.MkAnd(pos1is0, pos2is0); var pos11pos20 = solver.MkAnd(pos1is1, pos2is0); var pos10pos21 = solver.MkAnd(pos1is0, pos2is1); //Create automaton for condition var moves = new Move <BDD>[] { new Move <BDD>(0, 0, both0), new Move <BDD>(0, 1, pos11pos20), new Move <BDD>(1, 1, both0), new Move <BDD>(1, 2, pos10pos21), new Move <BDD>(2, 2, both0), }; return(Automaton <BDD> .Create(solver, 0, new int[] { 2 }, moves));//.Determinize(solver).Minimize(solver); }
public void IndexOf() { SimpleList <string> strings = new SimpleList <string>(3); strings.Add("Hello "); strings.Add("world!"); Assert.AreEqual(0, strings.IndexOf("Hello ")); Assert.AreEqual(1, strings.IndexOf("world!")); Assert.AreEqual(-1, strings.IndexOf(null)); Assert.AreEqual(-1, strings.IndexOf("abc")); }
internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> ca) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } return(BasicAutomata.MkLess(pos1, pos2, ca)); }
internal override Automaton <BDD> getAutomaton(SimpleList <string> variables, CharSetSolver solver) { var pos1 = variables.IndexOf(var1) + ((int)solver.Encoding); var pos2 = variables.IndexOf(var2) + ((int)solver.Encoding); var both1 = solver.MkAnd(solver.MkBitTrue(pos1), solver.MkBitTrue(pos2)); var both0 = solver.MkAnd(solver.MkBitFalse(pos1), solver.MkBitFalse(pos2)); var eqCond = solver.MkOr(both0, both1); //Create automaton for condition var moves = new Move <BDD>[] { new Move <BDD>(0, 0, eqCond) }; return(Automaton <BDD> .Create(solver, 0, new int[] { 0 }, moves));//.Determinize(solver).Minimize(solver); }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } var aut = BasicAutomata.MkSubset(pos1 + nrOfLabelBits, pos2 + nrOfLabelBits, alg); return(aut); }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <WS1SVariable <T> > variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; return(BasicAutomata.MkLess(pos1, pos2, alg)); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain {0}", var1)); } if (pos2 < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain {0}", var2)); } var aut = BasicAutomata.MkMax2(pos1 + nrOfLabelBits, pos2 + nrOfLabelBits, alg); return(aut); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0) { throw new ArgumentException("variables", string.Format("does not contain {0}", var1)); } if (pos2 < 0) { throw new ArgumentException("variables", string.Format("does not contain {0}", var2)); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; return(BasicAutomata.MkSuccN2(pos1, pos2, n, alg)); }
internal static int GetVarIndex(Variable x, SimpleList <Variable> xs) { var i = xs.IndexOf(x); if (i < 0) { throw new ArgumentException(string.Format("list does not contain variable {0}", x), "xs"); } return(i); }
internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } if (var1.isFirstOrder) { return(BasicAutomata.MkEqualPositions(pos1, pos2, ca)); } else { return(BasicAutomata.MkEqualSets(pos1, pos2, ca)); } }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0) { throw new InvalidOperationException(string.Format("unkown variable {0}", var1)); } if (pos2 < 0) { throw new InvalidOperationException(string.Format("unkown variable {0}", var2)); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; return(BasicAutomata.MkLt2(pos1, pos2, alg)); }
public void Insert() { SimpleList <string> strings = new SimpleList <string>(3, true); strings.Add("first"); strings.Add("second"); strings.Insert(2, "fourth"); strings.Insert(2, "third"); strings.Insert(4, "fifth"); Assert.AreEqual(0, strings.IndexOf("first")); Assert.AreEqual(1, strings.IndexOf("second")); Assert.AreEqual(2, strings.IndexOf("third")); Assert.AreEqual(3, strings.IndexOf("fourth")); Assert.AreEqual(4, strings.IndexOf("fifth")); Assert.ThrowsException <ArgumentOutOfRangeException>(() => { strings.Insert(6, "sixth"); }); }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos = variables.IndexOf(var); if (pos < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } return(BasicAutomata.MkSingleton(pos + nrOfLabelBits, alg)); }
internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca) { var pos = variables.IndexOf(var); if (pos < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } return(BasicAutomata.MkSingleton(pos, ca)); }
internal override Automaton <BDD> getAutomaton(SimpleList <string> variables, CharSetSolver solver) { var pos1 = variables.IndexOf(X1) + ((int)solver.Encoding); var pos2 = variables.IndexOf(X2) + ((int)solver.Encoding); //pos1is1 implies pos2is1 // is equivalent to //not(pos1is1) or pos2is1 // is equivalent to //pos1is0 or pos2is1 //var trueBv = MkTrue(variables, solver); var pos2is1 = solver.MkBitTrue(pos2); var pos1is0 = solver.MkBitFalse(pos1); var subsetCond = solver.MkOr(pos1is0, pos2is1); //Create automaton for condition var moves = new Move <BDD>[] { new Move <BDD>(0, 0, subsetCond) }; return(Automaton <BDD> .Create(solver, 0, new int[] { 0 }, moves));//.Determinize(solver).Minimize(solver); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var k = variables.IndexOf(var); if (k < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain variable: {0}", var)); } k = k + nrOfLabelBits; return(BasicAutomata.MkEqN2(k, n, alg)); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos = variables.IndexOf(var); if (pos < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain {0}", var)); } Automaton <BDD> aut = BasicAutomata.MkLast(pos + nrOfLabelBits, alg); return(aut); }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; if (var1.IsFirstOrder) { return(BasicAutomata.MkEqualPositions1(pos1, pos2, alg)); } else { return(BasicAutomata.MkEqualSets(pos1, pos2, alg)); } }
internal override Automaton <BDD> getAutomaton(SimpleList <string> variables, CharSetSolver solver) { var pos = variables.IndexOf(var) + ((int)solver.Encoding); //var trueBv = MkTrue(variables, solver); var posIs1 = solver.MkBitTrue(pos); var posIs0 = solver.MkBitFalse(pos); //Create automaton for condition var moves = new Move <BDD>[] { new Move <BDD>(0, 0, posIs0), new Move <BDD>(0, 1, posIs1), new Move <BDD>(1, 1, posIs0) }; return(Automaton <BDD> .Create(solver, 0, new int[] { 1 }, moves)); }
internal override Automaton <BDD> getAutomaton(SimpleList <string> variables, CharSetSolver solver) { var k = variables.IndexOf(var) + ((int)solver.Encoding); //var trueBv = MkTrue(variables, solver); //Compute predicates for k-th bit is 0 or 1 //var posIs1 = solver.MkAnd(new BDD[] { trueBv, solver.MkSetWithBitTrue(k), solver.ShiftLeft(pred, variables.Count) }); //var posIs0 = solver.MkAnd(trueBv, solver.MkSetWithBitFalse(k)); var posIs1 = solver.MkAnd(solver.MkBitTrue(k), pred); var posIs0 = solver.MkBitFalse(k); var psi = solver.MkOr(posIs0, posIs1); //Create automaton for condition var moves = new Move <BDD>[] { new Move <BDD>(0, 0, psi) }; return(Automaton <BDD> .Create(solver, 0, new int[] { 0 }, moves)); }
internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> ca) { var k = variables.IndexOf(var); if (k < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } if (var.IsFirstOrder) { return(BasicAutomata.MkLabelOfPosition(k, pred, ca)); } else { return(BasicAutomata.MkLabelOfSet(k, pred, ca)); } }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var k = variables.IndexOf(var); if (k < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain variable: {0}", var)); } k = k + nrOfLabelBits; if (var.IsFirstOrder) { return(BasicAutomata.MkLabelOfPosition2(k, pred as BDD, alg)); } else { return(BasicAutomata.MkLabelOfSet(k, pred as BDD, alg)); } }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var k = variables.IndexOf(var); if (k < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } k = k + nrOfLabelBits; if (var.IsFirstOrder) { return(BasicAutomata.MkLabelOfPosition1(k, pred as BDD, alg)); } else { return(BasicAutomata.MkLabelOfSet(k, pred as BDD, alg)); } }
public void ObtainTheIndex() { var list = new SimpleList<int>() { 1, 2, 3, 4, 5, 6, 7, 8 }; Assert.AreEqual(3, list.IndexOf(4)); }
public int IndexOf(T item) { return(data.IndexOf(item)); }