我有一个基类的面向对象结构,大约有10个类派生自该基类。我希望专注于它,并且需要改变这10个类扩展的类。
所以,我有:
function h2d(s) {
// https://stackoverflow.com/a/12533838/1348195
function add(x, y) {
var c = 0, r = [];
var x = x.split('').map(Number);
var y = y.split('').map(Number);
while(x.length || y.length) {
var s = (x.pop() || 0) + (y.pop() || 0) + c;
r.unshift(s < 10 ? s : s - 10);
c = s < 10 ? 0 : 1;
}
if(c) r.unshift(c);
return r.join('');
}
var dec = '0';
s.split('').forEach(function(chr) {
var n = parseInt(chr, 16);
for(var t = 8; t; t >>= 1) {
dec = add(dec, dec);
if(n & t) dec = add(dec, '1');
}
});
return dec;
}
function readInt64(view, i){
var small = view.getUint32(0 + 2 * i).toString(16); // present as base 16 string
var large = view.getUint32(1 + 2 * i).toString(16);
// in a power-of-2 base it's just a string concat to add them
var bigNumber = large + small;
return h2d(bigNumber);
}
var buffer = new ArrayBuffer(8);
var raw = new Uint8Array(buffer);
raw[0] = 255;
raw[1] = 255;
raw[2] = 255;
raw[3] = 255;
raw[4] = 255;
raw[5] = 255;
raw[6] = 255;
raw[7] = 255;
var view = new DataView(buffer);
var result = readInt64(view, 0);
document.body.innerHTML = result;
我需要将其更改为:
B
One extends B
Two extends B
Three extends B
...
Intellij是否具有重构功能,而不是手动浏览类,它允许我更改从B派生的所有类,而不是从B2派生?
答案 0 :(得分:1)
您可以进行全局搜索和替换,只需将“扩展B”更改为“扩展B2”即可。
但也有一种更清洁的方式。
答案 1 :(得分:1)
您可以使用结构搜索&amp;更换。搜索:
class $A$ extends B {}
替换为:
class $A$ extends B2 {}