/** * Creates a valuetuple for the receiver using the vt of the original. The method copies over * the values of variables shared by both program points and sets the rest of the variables in * the receiver's valuetuple as missing. Also, adds the orig and derived variables to the * receiver and returns the newly created valuetuple. */ private static ValueTuple copySample( PptTopLevel receiver, PptTopLevel original, ValueTuple vt, int nonce) { // Make the vt for the receiver ppt // Object values[] = new Object[receiver.num_tracevars]; // int mods[] = new int[receiver.num_tracevars]; Object values[] = new Object[receiver.var_infos.length - receiver.num_static_constant_vars]; int mods[] = new int[receiver.var_infos.length - receiver.num_static_constant_vars]; // Build the vt for the receiver ppt by looking through the current // vt and filling in the gaps. int k = 0; for (Iterator<VarInfo> i = receiver.var_info_iterator(); i.hasNext(); ) { VarInfo var = i.next(); if (var.is_static_constant) continue; boolean found = false; for (Iterator<VarInfo> j = original.var_info_iterator(); j.hasNext(); ) { VarInfo var2 = j.next(); if (var.name().equals(var2.name())) { values[k] = vt.getValueOrNull(var2); mods[k] = vt.getModified(var2); found = true; break; } } if (!found) { values[k] = null; mods[k] = 2; } k++; } ValueTuple receiver_vt = new ValueTuple(values, mods); FileIO.add_orig_variables(receiver, receiver_vt.vals, receiver_vt.mods, nonce); FileIO.add_derived_variables(receiver, receiver_vt.vals, receiver_vt.mods); return receiver_vt; }