阅读下列Java程序,回答下列问题。

题目
阅读下列Java程序,回答下列问题。
[Java 程序]
public int addAppTask(Activity activity, Intent intent,
TaskDescription description, Bitmap thumbnail) {
Point size = getSize1; //1
final int tw = thumbnail.getWidth1;
final int th = thumbnail.getHeight1;
if (tw != size.x || th != size.y) { //2,3
Bitmap bm = Bitmap.createBitmap(size.x, size.y, thumbnail
.getConfig1); //4
float scale;
float dx = 0, dy = 0;
if (tw * size.x > size.y * th) { //5
scale = (float) size.x / (float) th; //6
dx = (size.y - tw * scale) * 0.5f;
} else { //7
scale = (float) size.y / (float) tw;
dy = (size.x - th * scale) * 0.5f;
}
Matrix matrix = new Matrix1;
matrix.setScale(scale, scale);
matrix.postTranslate((int) (dx + 0.5f), 0);
Canvas canvas = new Canvas(bm);
canvas.drawBitmap(thumbnail, matrix, null);
canvas.setBitmap(null);
thumbnail = bm;
}
if (description == null) { //8
description = new TaskDescription1; //9
}
} //10
1、请简述基本路径测试法的概念。(2分)
2、请画出上述程序的控制流图,并计算其控制流图的环路复杂度vfG.。(8分)
3、请给出问题2中控制流图的线性无关路径。(5分)

更多“阅读下列Java程序,回答下列问题。 ”相关问题