Removed useless comments

megaRefact
Sami Mokaddem 2018-09-20 08:26:50 +00:00
parent 84d053335b
commit 9b0fc90778
2 changed files with 5 additions and 114 deletions

View File

@ -23,22 +23,7 @@
this.constructionInstruction = constructionInstruction;
this.mapping = mapping;
//this.mapping = {
// dates: ["l", 0],
// index: {
// '@labels': [0],
// '@dates': [0]
// },
// //labels: ["l", 1, "l", 0],
// labels: [],
// //values: ["@dates,l", "{1}", "@labels,l", "{1}"]
// values: ["@dates,l", "{1}", "@labels"]
//}
this.data = data;
this.result = {};
var funcs = {};
@ -129,24 +114,12 @@
//this.i1_prefill = x;
}
// inject prefill data
//for (var x of this.options.prefillData.labels) {
// this.result[x] = fillArray.slice(0);
// this.i1_prefill = x;
//}
//if (this.mapping.labels.length > 0) {
// this.c_labels(this.data, this.mapping.labels); // probe and fetch all labels
//}
lk.forEach(function(labelK) {
if (that.mapping[labelK].length > 0) {
that.apply_strategy(labelK);
}
});
//if (Object.keys(this.result).length > 1 && this.mapping.values.length > 0) {
//if (Object.keys(that.result).length > 0 && that.mapping[vk].length > 0) {
//if (Object.keys(that.result).length > 1 && that.mapping[vk].length > 0) {
if (Object.keys(that.result).length > 0 && that.mapping[vk].length > 0) {
that.apply_strategy(vk);
for (var k in that.result) { // filter out undefined value
@ -179,9 +152,7 @@
let index = instructions;
let val = intermediate[index];
if (that.mappingToIndexes[keyname][val] === undefined) {
//that.mappingToIndexes[keyname][val] = that.result['dates'].length;
that.mappingToIndexes[keyname][val] = that.result[keyname].length;
//let nval = that.options.functions.dates(val, additionalData.datum);
let nval = that.options.functions[keyname](val, additionalData.datum);
that.addFromInstruction(keyname, nval, {}, false);
}
@ -207,7 +178,6 @@
}
}
let nlabel = that.options.functions[keyname](label, additionalData.datum);
//that.result[nlabel] = val;
var subkeys = {};
subkeys[keyname] = nlabel;
that.addFromInstruction(keyname, val, subkeys, true);
@ -223,7 +193,6 @@
let nlabel = that.options.functions[keyname](label, additionalData.datum);
var subkeys = {};
subkeys[keyname] = nlabel;
//that.result[nlabel] = val;
that.addFromInstruction(keyname, val, subkeys, true);
}
};
@ -275,24 +244,6 @@
subkeys[kn_strip] = v;
});
//that.options.functions.labels(i1, additionalData.datum);
//that.options.functions.values(val, additionalData.datum);
//let i1 = additionalData.i1;
////i1 = i1 !== undefined ? i1 : that.i1_prefill;
//let i2 = additionalData.i2;
//// fetch index in array from the key
//let i2_adjusted = that.mappingI2[i2];
// fetch index in array from the key
// apply transformation function
//let ni1 = that.options.functions.labels(i1, additionalData.datum);
//let nval = that.options.functions.values(val, additionalData.datum);
//that.result[ni1][i2_adjusted] = nval;
//var subkeys = { labels: ni1, dates: i2_adjusted};
let nval = that.options.functions[keyname](val, additionalData.datum);
that.addFromInstruction(keyname, nval, subkeys, directValue);
};
@ -331,24 +282,6 @@
i_type = record_inst;
}
}
//switch (record_inst) {
// case 'i1':
// if (additionalData.mapping) {
// flag_register_i = true;
// i_type = 'i1';
// }
// break;
// case 'i2':
// if (additionalData.mapping) {
// flag_register_i = true;
// i_type = 'i2';
// }
// break;
// case '':
// break;
// default:
// break;
//}
let inst = ind_inst;
let reg = /\{(\w+)\}/;
@ -368,7 +301,8 @@
additionalData.datum = this.update_datum(additionalData.datum, i);
return this.iter(intermediate[i], instructions.slice(1), matchingFun, additionalData);
}
// fallback to standard loop
/* fallback to standard loop */
}
@ -441,8 +375,6 @@
}
});
//cres.push(value);
//p_res[p_key].push(value);
if (trueValue) {
p_res[p_key] = value;
} else {

View File

@ -74,7 +74,6 @@
var that = this;
this.options.toBeMappedList.forEach(function(item, index) {
that.instructions[item] = [];
//that.prefillData[item] = [];
that.itemColors.set(item, that.options.itemColors[index]);
});
@ -129,7 +128,6 @@
// Normalize for fixed-depth. (+ consider linkname)
var depthSepa = maxSizePerDepth.length*100 < this.options.width ? 100 : this.options.width / maxSizePerDepth.length;
nodes.forEach(function(d) {
//let offset = maxSizePerDepth[d.depth]*(that.options.maxCharDisplay-2);
let offset = maxSizePerDepth[d.depth]*(10);
d.y = d.depth * depthSepa + offset;
});
@ -508,9 +506,7 @@
if(resCircle !== undefined) {
resCircle.data().forEach(function(elem) {
if (elem.picked !== undefined && elem.picked != '') {
// alert || repick conflicting ????
console.log('Possible collision with '+elem.picked);
//alert('Possible collision with '+elem.picked);
//console.log('Possible collision with '+elem.picked);
}
elem.picked = that.currentPicking;
nodesData.push(elem);
@ -522,9 +518,7 @@
if(resRect !== undefined) {
resRect.data().forEach(function(elem) {
if (elem.picked !== undefined && elem.picked != '') {
// alert || repick conflicting ????
console.log('Possible collision with '+elem.picked);
//alert('Possible collision with '+elem.picked);
//console.log('Possible collision with '+elem.picked);
}
elem.picked = that.currentPicking;
nodesData.push(elem);
@ -582,9 +576,7 @@
resRect.data().forEach(function(elem) {
if (elem.picked !== undefined && elem.picked != '') {
// alert || repick conflicting ????
console.log('Possible collision with '+elem.picked);
//alert('Possible collision with '+elem.picked);
//console.log('Possible collision with '+elem.picked);
}
elem.picked = that.currentPicking;
});
@ -597,7 +589,6 @@
var nodesCircle = that.svg.selectAll(".node circle").filter(
function(d) {
return d.depth == dest_depth && d.linkname == c_label;
//return d.depth == dest_depth;
}
);
nodesCircle.data().forEach(function(d, i) {
@ -606,15 +597,12 @@
var nodesRect = that.svg.selectAll(".node rect").filter(
function(d) {
return d.depth == dest_depth && d.linkname == c_label;
//return d.depth == dest_depth;
}
);
nodesRect.data().forEach(function(d, i) {
paths[i] = that.find_full_path(d, []);
});
//var instructions = this.compute_mapping_instructions(paths);
//this.add_instruction(instructions);
this.unset_related();
this.add_prefill_data([c_label]);
@ -828,8 +816,6 @@
update_result_tree: function() {
var options = {
interaction: false,
//width: this.width,
//height: this.height
width: this.options.width-30,
height: this.options.height
};
@ -921,10 +907,6 @@
}
//var l = this.instructions.labels;
//var v = this.instructions.values;
//var d = this.instructions.dates;
// label & value
if (l !== undefined && l.length != 0 && v.length != 0) {
var smaller_array = v.length < l.length ? v : l;
@ -939,13 +921,10 @@
// in case no match, last one should be registered
matchingIndex = has_matched ? matchingIndex : smaller_array.length-1;
//let inst = adjustedInstructions.values[matchingIndex];
let inst = adjustedInstructions[v_keyname][matchingIndex];
inst = inst == 'l' ? 'l' : '{'+inst+'}';
//adjustedInstructions.values[matchingIndex] = 'i1,'+inst;
let kref = '@'+l_keyname;
adjustedInstructions[v_keyname][matchingIndex] = kref + ',' + inst;
//adjustedInstructions.index['i1'] = adjustedInstructions.labels.slice(matchingIndex+1);
adjustedInstructions.index[kref] = adjustedInstructions[l_keyname].slice(matchingIndex+1);
}
@ -959,23 +938,9 @@
break;
}
}
//adjustedInstructions.values[matchingIndex] = 'i2,'+adjustedInstructions.values[matchingIndex];
let kref = '@'+d_keyname;
adjustedInstructions[v_keyname][matchingIndex] = kref + ',' + adjustedInstructions[v_keyname][matchingIndex];
//adjustedInstructions.index['i2'] = adjustedInstructions.dates.slice(matchingIndex+1);
adjustedInstructions.index[kref] = adjustedInstructions[d_keyname].slice(matchingIndex+1);
// add '' at the end for value only
//var end_i = adjustedInstructions.values.length-1;
//var last_i = adjustedInstructions.values[end_i];
//var end_i = adjustedInstructions[v_keyname].length-1;
//var last_i = adjustedInstructions[v_keyname][end_i];
//last_i = last_i.split(',');
//last_i = last_i.length == 2 ? last_i[1] : last_i[0];
//if (last_i == 'l') {
// //adjustedInstructions.values[end_i+1] = '';
// adjustedInstructions[v_keyname][end_i+1] = '';
//}
}
// add '' at the end for value only
@ -1137,12 +1102,6 @@
return pts.join(', ');
},
objkeyToList: function(obj) {
}
}