Skip to content

Commit 62f5009

Browse files
sarutakmateiz
authored andcommitted
[SPARK-2976] Replace tabs with spaces
Author: Kousuke Saruta <[email protected]> Closes apache#1895 from sarutak/SPARK-2976 and squashes the following commits: 1cf7e69 [Kousuke Saruta] Merge branch 'master' of git://git.apache.org/spark into SPARK-2976 d1e0666 [Kousuke Saruta] Modified styles c5e80a4 [Kousuke Saruta] Remove tab from JavaPageRank.java and JavaKinesisWordCountASL.java c003b36 [Kousuke Saruta] Removed tab from sorttable.js
1 parent 9f04db1 commit 62f5009

File tree

3 files changed

+142
-143
lines changed

3 files changed

+142
-143
lines changed

core/src/main/resources/org/apache/spark/ui/static/sorttable.js

Lines changed: 137 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ sorttable = {
8181
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
8282
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
8383
if (mtch) { override = mtch[1]; }
84-
if (mtch && typeof sorttable["sort_"+override] == 'function') {
85-
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
86-
} else {
87-
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
88-
}
89-
// make it clickable to sort
90-
headrow[i].sorttable_columnindex = i;
91-
headrow[i].sorttable_tbody = table.tBodies[0];
92-
dean_addEvent(headrow[i],"click", function(e) {
84+
if (mtch && typeof sorttable["sort_"+override] == 'function') {
85+
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
86+
} else {
87+
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
88+
}
89+
// make it clickable to sort
90+
headrow[i].sorttable_columnindex = i;
91+
headrow[i].sorttable_tbody = table.tBodies[0];
92+
dean_addEvent(headrow[i],"click", function(e) {
9393

9494
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
9595
// if we're already sorted by this column, just
@@ -109,15 +109,15 @@ sorttable = {
109109
// re-reverse the table, which is quicker
110110
sorttable.reverse(this.sorttable_tbody);
111111
this.className = this.className.replace('sorttable_sorted_reverse',
112-
'sorttable_sorted');
112+
'sorttable_sorted');
113113
this.removeChild(document.getElementById('sorttable_sortrevind'));
114114
sortfwdind = document.createElement('span');
115115
sortfwdind.id = "sorttable_sortfwdind";
116116
sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
117117
this.appendChild(sortfwdind);
118118
return;
119119
}
120-
120+
121121
// remove sorttable_sorted classes
122122
theadrow = this.parentNode;
123123
forEach(theadrow.childNodes, function(cell) {
@@ -130,36 +130,36 @@ sorttable = {
130130
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
131131
sortrevind = document.getElementById('sorttable_sortrevind');
132132
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
133-
133+
134134
this.className += ' sorttable_sorted';
135135
sortfwdind = document.createElement('span');
136136
sortfwdind.id = "sorttable_sortfwdind";
137137
sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
138138
this.appendChild(sortfwdind);
139139

140-
// build an array to sort. This is a Schwartzian transform thing,
141-
// i.e., we "decorate" each row with the actual sort key,
142-
// sort based on the sort keys, and then put the rows back in order
143-
// which is a lot faster because you only do getInnerText once per row
144-
row_array = [];
145-
col = this.sorttable_columnindex;
146-
rows = this.sorttable_tbody.rows;
147-
for (var j=0; j<rows.length; j++) {
148-
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
149-
}
150-
/* If you want a stable sort, uncomment the following line */
151-
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
152-
/* and comment out this one */
153-
row_array.sort(this.sorttable_sortfunction);
154-
155-
tb = this.sorttable_tbody;
156-
for (var j=0; j<row_array.length; j++) {
157-
tb.appendChild(row_array[j][1]);
158-
}
159-
160-
delete row_array;
161-
});
162-
}
140+
// build an array to sort. This is a Schwartzian transform thing,
141+
// i.e., we "decorate" each row with the actual sort key,
142+
// sort based on the sort keys, and then put the rows back in order
143+
// which is a lot faster because you only do getInnerText once per row
144+
row_array = [];
145+
col = this.sorttable_columnindex;
146+
rows = this.sorttable_tbody.rows;
147+
for (var j=0; j<rows.length; j++) {
148+
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
149+
}
150+
/* If you want a stable sort, uncomment the following line */
151+
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
152+
/* and comment out this one */
153+
row_array.sort(this.sorttable_sortfunction);
154+
155+
tb = this.sorttable_tbody;
156+
for (var j=0; j<row_array.length; j++) {
157+
tb.appendChild(row_array[j][1]);
158+
}
159+
160+
delete row_array;
161+
});
162+
}
163163
}
164164
},
165165

@@ -310,25 +310,24 @@ sorttable = {
310310
var swap = true;
311311

312312
while(swap) {
313-
swap = false;
314-
for(var i = b; i < t; ++i) {
315-
if ( comp_func(list[i], list[i+1]) > 0 ) {
316-
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
317-
swap = true;
318-
}
319-
} // for
320-
t--;
313+
swap = false;
314+
for(var i = b; i < t; ++i) {
315+
if ( comp_func(list[i], list[i+1]) > 0 ) {
316+
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
317+
swap = true;
318+
}
319+
} // for
320+
t--;
321321

322-
if (!swap) break;
323-
324-
for(var i = t; i > b; --i) {
325-
if ( comp_func(list[i], list[i-1]) < 0 ) {
326-
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
327-
swap = true;
328-
}
329-
} // for
330-
b++;
322+
if (!swap) break;
331323

324+
for(var i = t; i > b; --i) {
325+
if ( comp_func(list[i], list[i-1]) < 0 ) {
326+
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
327+
swap = true;
328+
}
329+
} // for
330+
b++;
332331
} // while(swap)
333332
}
334333
}
@@ -358,11 +357,11 @@ if (document.addEventListener) {
358357

359358
/* for Safari */
360359
if (/WebKit/i.test(navigator.userAgent)) { // sniff
361-
var _timer = setInterval(function() {
362-
if (/loaded|complete/.test(document.readyState)) {
363-
sorttable.init(); // call the onload handler
364-
}
365-
}, 10);
360+
var _timer = setInterval(function() {
361+
if (/loaded|complete/.test(document.readyState)) {
362+
sorttable.init(); // call the onload handler
363+
}
364+
}, 10);
366365
}
367366

368367
/* for other browsers */
@@ -374,122 +373,122 @@ window.onload = sorttable.init;
374373
// http://dean.edwards.name/weblog/2005/10/add-event/
375374

376375
function dean_addEvent(element, type, handler) {
377-
if (element.addEventListener) {
378-
element.addEventListener(type, handler, false);
379-
} else {
380-
// assign each event handler a unique ID
381-
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
382-
// create a hash table of event types for the element
383-
if (!element.events) element.events = {};
384-
// create a hash table of event handlers for each element/event pair
385-
var handlers = element.events[type];
386-
if (!handlers) {
387-
handlers = element.events[type] = {};
388-
// store the existing event handler (if there is one)
389-
if (element["on" + type]) {
390-
handlers[0] = element["on" + type];
391-
}
392-
}
393-
// store the event handler in the hash table
394-
handlers[handler.$$guid] = handler;
395-
// assign a global event handler to do all the work
396-
element["on" + type] = handleEvent;
397-
}
376+
if (element.addEventListener) {
377+
element.addEventListener(type, handler, false);
378+
} else {
379+
// assign each event handler a unique ID
380+
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
381+
// create a hash table of event types for the element
382+
if (!element.events) element.events = {};
383+
// create a hash table of event handlers for each element/event pair
384+
var handlers = element.events[type];
385+
if (!handlers) {
386+
handlers = element.events[type] = {};
387+
// store the existing event handler (if there is one)
388+
if (element["on" + type]) {
389+
handlers[0] = element["on" + type];
390+
}
391+
}
392+
// store the event handler in the hash table
393+
handlers[handler.$$guid] = handler;
394+
// assign a global event handler to do all the work
395+
element["on" + type] = handleEvent;
396+
}
398397
};
399398
// a counter used to create unique IDs
400399
dean_addEvent.guid = 1;
401400

402401
function removeEvent(element, type, handler) {
403-
if (element.removeEventListener) {
404-
element.removeEventListener(type, handler, false);
405-
} else {
406-
// delete the event handler from the hash table
407-
if (element.events && element.events[type]) {
408-
delete element.events[type][handler.$$guid];
409-
}
410-
}
402+
if (element.removeEventListener) {
403+
element.removeEventListener(type, handler, false);
404+
} else {
405+
// delete the event handler from the hash table
406+
if (element.events && element.events[type]) {
407+
delete element.events[type][handler.$$guid];
408+
}
409+
}
411410
};
412411

413412
function handleEvent(event) {
414-
var returnValue = true;
415-
// grab the event object (IE uses a global event object)
416-
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
417-
// get a reference to the hash table of event handlers
418-
var handlers = this.events[event.type];
419-
// execute each event handler
420-
for (var i in handlers) {
421-
this.$$handleEvent = handlers[i];
422-
if (this.$$handleEvent(event) === false) {
423-
returnValue = false;
424-
}
425-
}
426-
return returnValue;
413+
var returnValue = true;
414+
// grab the event object (IE uses a global event object)
415+
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
416+
// get a reference to the hash table of event handlers
417+
var handlers = this.events[event.type];
418+
// execute each event handler
419+
for (var i in handlers) {
420+
this.$$handleEvent = handlers[i];
421+
if (this.$$handleEvent(event) === false) {
422+
returnValue = false;
423+
}
424+
}
425+
return returnValue;
427426
};
428427

429428
function fixEvent(event) {
430-
// add W3C standard event methods
431-
event.preventDefault = fixEvent.preventDefault;
432-
event.stopPropagation = fixEvent.stopPropagation;
433-
return event;
429+
// add W3C standard event methods
430+
event.preventDefault = fixEvent.preventDefault;
431+
event.stopPropagation = fixEvent.stopPropagation;
432+
return event;
434433
};
435434
fixEvent.preventDefault = function() {
436-
this.returnValue = false;
435+
this.returnValue = false;
437436
};
438437
fixEvent.stopPropagation = function() {
439438
this.cancelBubble = true;
440439
}
441440

442441
// Dean's forEach: http://dean.edwards.name/base/forEach.js
443442
/*
444-
forEach, version 1.0
445-
Copyright 2006, Dean Edwards
446-
License: http://www.opensource.org/licenses/mit-license.php
443+
forEach, version 1.0
444+
Copyright 2006, Dean Edwards
445+
License: http://www.opensource.org/licenses/mit-license.php
447446
*/
448447

449448
// array-like enumeration
450449
if (!Array.forEach) { // mozilla already supports this
451-
Array.forEach = function(array, block, context) {
452-
for (var i = 0; i < array.length; i++) {
453-
block.call(context, array[i], i, array);
454-
}
455-
};
450+
Array.forEach = function(array, block, context) {
451+
for (var i = 0; i < array.length; i++) {
452+
block.call(context, array[i], i, array);
453+
}
454+
};
456455
}
457456

458457
// generic enumeration
459458
Function.prototype.forEach = function(object, block, context) {
460-
for (var key in object) {
461-
if (typeof this.prototype[key] == "undefined") {
462-
block.call(context, object[key], key, object);
463-
}
464-
}
459+
for (var key in object) {
460+
if (typeof this.prototype[key] == "undefined") {
461+
block.call(context, object[key], key, object);
462+
}
463+
}
465464
};
466465

467466
// character enumeration
468467
String.forEach = function(string, block, context) {
469-
Array.forEach(string.split(""), function(chr, index) {
470-
block.call(context, chr, index, string);
471-
});
468+
Array.forEach(string.split(""), function(chr, index) {
469+
block.call(context, chr, index, string);
470+
});
472471
};
473472

474473
// globally resolve forEach enumeration
475474
var forEach = function(object, block, context) {
476-
if (object) {
477-
var resolve = Object; // default
478-
if (object instanceof Function) {
479-
// functions have a "length" property
480-
resolve = Function;
481-
} else if (object.forEach instanceof Function) {
482-
// the object implements a custom forEach method so use that
483-
object.forEach(block, context);
484-
return;
485-
} else if (typeof object == "string") {
486-
// the object is a string
487-
resolve = String;
488-
} else if (typeof object.length == "number") {
489-
// the object is array-like
490-
resolve = Array;
491-
}
492-
resolve.forEach(object, block, context);
493-
}
475+
if (object) {
476+
var resolve = Object; // default
477+
if (object instanceof Function) {
478+
// functions have a "length" property
479+
resolve = Function;
480+
} else if (object.forEach instanceof Function) {
481+
// the object implements a custom forEach method so use that
482+
object.forEach(block, context);
483+
return;
484+
} else if (typeof object == "string") {
485+
// the object is a string
486+
resolve = String;
487+
} else if (typeof object.length == "number") {
488+
// the object is array-like
489+
resolve = Array;
490+
}
491+
resolve.forEach(object, block, context);
492+
}
494493
};
495494

examples/src/main/java/org/apache/spark/examples/JavaPageRank.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public Double call(Iterable<String> rs) {
9696
.flatMapToPair(new PairFlatMapFunction<Tuple2<Iterable<String>, Double>, String, Double>() {
9797
@Override
9898
public Iterable<Tuple2<String, Double>> call(Tuple2<Iterable<String>, Double> s) {
99-
int urlCount = Iterables.size(s._1);
99+
int urlCount = Iterables.size(s._1);
100100
List<Tuple2<String, Double>> results = new ArrayList<Tuple2<String, Double>>();
101101
for (String n : s._1) {
102102
results.add(new Tuple2<String, Double>(n, s._2() / urlCount));

extras/kinesis-asl/src/main/java/org/apache/spark/examples/streaming/JavaKinesisWordCountASL.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ public static void main(String[] args) {
130130
/* Create the same number of Kinesis DStreams/Receivers as Kinesis stream's shards */
131131
List<JavaDStream<byte[]>> streamsList = new ArrayList<JavaDStream<byte[]>>(numStreams);
132132
for (int i = 0; i < numStreams; i++) {
133-
streamsList.add(
134-
KinesisUtils.createStream(jssc, streamName, endpointUrl, checkpointInterval,
135-
InitialPositionInStream.LATEST, StorageLevel.MEMORY_AND_DISK_2())
136-
);
133+
streamsList.add(
134+
KinesisUtils.createStream(jssc, streamName, endpointUrl, checkpointInterval,
135+
InitialPositionInStream.LATEST, StorageLevel.MEMORY_AND_DISK_2())
136+
);
137137
}
138138

139139
/* Union all the streams if there is more than 1 stream */

0 commit comments

Comments
 (0)