정오표

『클린코드』정오표

====아래는 3쇄에 반영 예정입니다. (2015. 11. 11) ====

[[본문]]

2015.11.11

218~219 페이지에 걸쳐 코드에 띄어쓰기 수정이 있습니다.

(수정 부분 빨간색으로 표시했습니다)

218 페이지

public void scaleToOneDimension(
floatdesiredDimension, float imageDimension) {
if (Math.abs(desiredDimension – imageDimension) <errorThreshold)
return;
floatscalingFactor = desiredDimension / imageDimension;
scalingFactor = (float)(Math.floor(scalingFactor * 100) * 0.01f);

RenderedOpnewImage = ImageUtilities.getScaledImage(
image, scalingFactor, scalingFactor);
image.dispose();
System.gc();
image = newImage;
}

 

public synchronized void rotate(int degrees) {
RenderedOpnewImage = ImageUtilities.getRotatedImage(
image, degrees);
image.dispose();
System.gc();
image = newImage;
}

 

수정코드

public void scaleToOneDimension(
         float desiredDimension, float imageDimension) {
if (Math.abs(desiredDimension – imageDimension) <errorThreshold)
return;
float scalingFactor = desiredDimension / imageDimension;
scalingFactor = (float)(Math.floor(scalingFactor * 100) * 0.01f);

    RenderedOp newImage = ImageUtilities.getScaledImage(
image, scalingFactor, scalingFactor);
image.dispose();
System.gc();
image = newImage;
}

public synchronized void rotate(int degrees) { (위아래 줄을 떼지 않고 붙이는 걸로 수정!)
RenderedOp newImage = ImageUtilities.getRotatedImage(
image, degrees);
image.dispose();
System.gc();
image = newImage;
}

 

 

 

219 페이지

 

public void scaleToOneDimension(
floatdesiredDimension, float imageDimension) {
if (Math.abs(desiredDimension – imageDimension) <errorThreshold)
return;
floatscalingFactor = desiredDimension / imageDimension;
scalingFactor = (float)(Math.floor(scalingFactor * 100) * 0.01f);
replaceImage(ImageUtilities.getScaledImage(
image, scalingFactor, scalingFactor));
}
public synchronized void rotate(int degrees) {
replaceImage(ImageUtilities.getRotatedImage(image, degrees));
}

private void replaceImage(RenderedOpnewImage) {
image.dispose();
System.gc();
image = newImage;
}

 

 

수정코드

 

public void scaleToOneDimension(
float desiredDimension, float imageDimension) {
if (Math.abs(desiredDimension – imageDimension) <errorThreshold)
return;
float scalingFactor = desiredDimension / imageDimension;
scalingFactor = (float)(Math.floor(scalingFactor * 100) * 0.01f);
replaceImage(ImageUtilities.getScaledImage(
           image, scalingFactor, scalingFactor));
}
public synchronized void rotate(int degrees) {
  replaceImage(ImageUtilities.getRotatedImage(image, degrees));
}

private void replaceImage(RenderedOp newImage) {
    image.dispose();
    System.gc();
    image = newImage;
}

====아래는 2쇄에 반영되었습니다.(2014 08 12) ====

204쪽 중간 부분

public BankHandler (Bank bank) {

—> public BankProxyHandler(Bank bank) {