我知道这个问题可能不属于这里,但如果有人愿意,我可以使用一些建议。
我想知道是否有办法以更有效的方式编写以下代码。
一般概念:
arfcn
和bsic
的组合)以下是代码:
var bcch_sacch = [70, 0, 0, 0, 0, 0]
var combo = [[70, 30], [0, 0]]
var alarm;
var ncellcount = message.data.reports.numberofneighbors;
//Loop through neighbors measurements (up to 6)
for(var j = 0; j < 6; j++) {
//If j is less than the amount of neighbors in the list (0-6)
if(j < ncellcount) {
//Combo: allowed combinations
for(var i = 0; i < combo.length; i++) {
//If allowed
if(combo[i][0] == bcch_sacch[j] &&
combo[i][1] == message.data.reports.neighboringCells[j].BSIC) {
}
else {
for(var d = 0; d < alarm.length; d++) {
//If the current arfcn(j) and bsic(j) is in the alarms list
if(alarm[d][0] == bcch_sacch[j] &&
alarm[d][1] == message.data.reports.neighboringCells[j].BSIC) {
}
else {
//Add the combo in the alarm list
alarm[alarm.length][0] = bcch_sacch[j];
alarm[alarm.length][1] = message.data.reports.neighboringCells[j].BSIC;
}
}
}
}
}
}
//Print out the alarms list in a table
for(var s = 0; s < alarm.length; s++) {
$('#alarms tr:last').after('<tr><td>'+alarm[s][0]+'</td><td>'+alarm[s][1]+'</td></tr>');
}