private void MapOutputPortsMethod(Plan p, Collection <int> path, string freshvar) { // Map receiver. Plan.ParameterChooser c = p.parameterChoosers[0]; OutPortId pOutputPort = new OutPortId(path, 0); path.Add(c.planIndex); OutPortId recPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(recPort)); // Map return value. MethodCall mct = p.transformer as MethodCall; if (!mct.method.ReturnType.Equals(typeof(void))) { OutPortId newObjPort = new OutPortId(path, 1); foobar.set(newObjPort, freshvar); } // Map mutated parameters. // Start from 1 because already handled receiver. for (int i = 1; i < p.parameterChoosers.Length; i++) { c = p.parameterChoosers[i]; pOutputPort = new OutPortId(path, i + 1); // Add 1 because of retval. path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(paramPort)); } }
private void MapOutputPortsPrimitive(Plan p, Collection <int> path, string freshvar) { // Map primitive. OutPortId newObjPort = new OutPortId(path, 0); foobar.set(newObjPort, freshvar); }
private void HandlePrimitive(Plan p, Collection <int> path) { OutPortId newPort = new OutPortId(path, 0); string newName = nameManager.foobar.Get(newPort); b.Add(p.transformer.ToCSharpCode(new ReadOnlyCollection <string>(new List <string>()), newName)); }
private void HandleMethod(Plan p, Collection <int> path) { MethodCall mct = p.transformer as MethodCall; string freshvar = null; if (!mct.method.ReturnType.Equals(typeof(void))) { OutPortId newObjPort = new OutPortId(path, 1); freshvar = nameManager.foobar.Get(newObjPort); } Collection <string> arguments = new Collection <string>(); for (int i = 0; i < p.parameterChoosers.Length; i++) { if (i == 0 && mct.method.IsStatic) { arguments.Add(null); continue; } Plan.ParameterChooser c = p.parameterChoosers[i]; path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); arguments.Add(nameManager.foobar.Get(paramPort)); } b.Add(p.transformer.ToCSharpCode(new ReadOnlyCollection <string>(arguments), freshvar)); }
public void set(OutPortId id, string s) { bool alreadyThere = keys.Contains(id.ToString()); int keySize = names.Keys.Count; if (names.ContainsKey(id) && !namesghost.ContainsKey(id.ToString())) { throw new Exception(); } names[id] = s; namesghost[id.ToString()] = s; if (names.Keys.Count != namesghost.Keys.Count) { throw new Exception(); } if (alreadyThere && keySize < names.Keys.Count) { throw new Exception(); } keys.Add(id.ToString()); }
private void MapOutputPortsFieldSetter(Plan p, Collection <int> path, string freshvar) { // Map receiver. Plan.ParameterChooser c = p.parameterChoosers[0]; OutPortId pOutputPort = new OutPortId(path, 0); path.Add(c.planIndex); OutPortId recPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(recPort)); }
private void HandleField(Plan p, Collection <int> path) { Collection <string> args = new Collection <string>(); for (int i = 0; i < p.parameterChoosers.Length; i++) { Plan.ParameterChooser c = p.parameterChoosers[i]; path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); args.Add(nameManager.foobar.Get(paramPort)); } b.Add(p.transformer.ToCSharpCode(new ReadOnlyCollection <string>(args), "dummy")); }
public override bool Equals(object obj) { OutPortId other = obj as OutPortId; bool retval = true; if (other == null) { retval = false; } else if (this.i != other.i) { retval = false; } else if (this.list.Count != other.list.Count) { retval = false; } else { for (int c = 0; c < this.list.Count; c++) { if (this.list[c] != other.list[c]) { retval = false; break; } } } string s1 = this.ToString(); string s2 = other.ToString(); if (retval == true && this.GetHashCode() != other.GetHashCode()) { throw new Exception(); } if (retval == false && s1.Equals(s2)) { throw new Exception(); } if (retval == true && !s1.Equals(s2)) { throw new Exception(); } return(retval); }
private void HandleArray(Plan p, Collection <int> path) { OutPortId newObjPort = new OutPortId(path, 0); string newObjName = nameManager.foobar.Get(newObjPort); Collection <string> args = new Collection <string>(); for (int i = 0; i < p.parameterChoosers.Length; i++) { Plan.ParameterChooser c = p.parameterChoosers[i]; path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); args.Add(nameManager.foobar.Get(paramPort)); } b.Add(p.transformer.ToCSharpCode(new ReadOnlyCollection <string>(args), nameManager.foobar.Get(newObjPort), useRandoopContracts, p.CanGenerateContractAssertion)); }
private void MapOutputPortsConstructor(Plan p, Collection <int> path, string freshvar) { // Map new object. OutPortId newObjPort = new OutPortId(path, 0); foobar.set(newObjPort, freshvar); // Map mutated parameters. for (int i = 0; i < p.parameterChoosers.Length; i++) { Plan.ParameterChooser c = p.parameterChoosers[i]; OutPortId pOutputPort = new OutPortId(path, i + 1); path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(paramPort)); } }
private void HandleArray(Plan p, Collection<int> path) { OutPortId newObjPort = new OutPortId(path, 0); string newObjName = nameManager.foobar.Get(newObjPort); Collection<string> args = new Collection<string>(); for (int i = 0; i < p.parameterChoosers.Length; i++) { Plan.ParameterChooser c = p.parameterChoosers[i]; path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); args.Add(nameManager.foobar.Get(paramPort)); } b.Add(p.transformer.ToCSharpCode(new ReadOnlyCollection<string>(args), nameManager.foobar.Get(newObjPort))); }
private void HandleMethod(Plan p, Collection<int> path) { MethodCall mct = p.transformer as MethodCall; string freshvar = null; if (!mct.method.ReturnType.Equals(typeof(void))) { OutPortId newObjPort = new OutPortId(path, 1); freshvar = nameManager.foobar.Get(newObjPort); } Collection<string> arguments = new Collection<string>(); for (int i = 0; i < p.parameterChoosers.Length; i++) { if (i == 0 && mct.method.IsStatic) { arguments.Add(null); continue; } Plan.ParameterChooser c = p.parameterChoosers[i]; path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); arguments.Add(nameManager.foobar.Get(paramPort)); } b.Add(p.transformer.ToCSharpCode(new ReadOnlyCollection<string>(arguments), freshvar)); }
private void HandlePrimitive(Plan p, Collection<int> path) { OutPortId newPort = new OutPortId(path, 0); string newName = nameManager.foobar.Get(newPort); b.Add(p.transformer.ToCSharpCode(new ReadOnlyCollection<string>(new List<string>()), newName)); }
private void MapOutputPortsMethod(Plan p, Collection<int> path, string freshvar) { // Map receiver. Plan.ParameterChooser c = p.parameterChoosers[0]; OutPortId pOutputPort = new OutPortId(path, 0); path.Add(c.planIndex); OutPortId recPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(recPort)); // Map return value. MethodCall mct = p.transformer as MethodCall; if (!mct.method.ReturnType.Equals(typeof(void))) { OutPortId newObjPort = new OutPortId(path, 1); foobar.set(newObjPort, freshvar); } // Map mutated parameters. // Start from 1 because already handled receiver. for (int i = 1; i < p.parameterChoosers.Length; i++) { c = p.parameterChoosers[i]; pOutputPort = new OutPortId(path, i + 1); // Add 1 because of retval. path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(paramPort)); } }
private void MapOutputPortsConstructor(Plan p, Collection<int> path, string freshvar) { // Map new object. OutPortId newObjPort = new OutPortId(path, 0); foobar.set(newObjPort, freshvar); // Map mutated parameters. for (int i = 0; i < p.parameterChoosers.Length; i++) { Plan.ParameterChooser c = p.parameterChoosers[i]; OutPortId pOutputPort = new OutPortId(path, i + 1); path.Add(c.planIndex); OutPortId paramPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(paramPort)); } }
private void MapOutputPortsFieldSetter(Plan p, Collection<int> path, string freshvar) { // Map receiver. Plan.ParameterChooser c = p.parameterChoosers[0]; OutPortId pOutputPort = new OutPortId(path, 0); path.Add(c.planIndex); OutPortId recPort = new OutPortId(path, c.resultIndex); path.RemoveAt(path.Count - 1); foobar.set(pOutputPort, foobar.Get(recPort)); }
private void MapOutputPortsPrimitive(Plan p, Collection<int> path, string freshvar) { // Map primitive. OutPortId newObjPort = new OutPortId(path, 0); foobar.set(newObjPort, freshvar); }
private void MapOutputPortsDummy(Plan p, Collection<int> path, string freshvar) { OutPortId newObjPort = new OutPortId(path, 0); foobar.set(newObjPort, freshvar); }
public void set(OutPortId id, string s) { bool alreadyThere = keys.Contains(id.ToString()); int keySize = names.Keys.Count; if (names.ContainsKey(id) && !namesghost.ContainsKey(id.ToString())) throw new Exception(); names[id] = s; namesghost[id.ToString()] = s; if (names.Keys.Count != namesghost.Keys.Count) throw new Exception(); if (alreadyThere && keySize < names.Keys.Count) throw new Exception(); keys.Add(id.ToString()); }
public string Get(OutPortId id) { return names[id]; }
public string Get(OutPortId id) { return(names[id]); }
private void MapOutputPortsDummy(Plan p, Collection <int> path, string freshvar) { OutPortId newObjPort = new OutPortId(path, 0); foobar.set(newObjPort, freshvar); }