음,이 메서드는 특정 비율로 호출 된 Object2D의 2 차원 색상 배열 PointInformation의 크기를 조정해야하는 클래스 Object2D에서 크기 조정을 수행했습니다.이상하게 도달 할 수 없지만 컴파일 할 수 있습니다. 코드
public class Object2D
{
int width;
int height;
int ResizePercentage = 100;
Color PointInformation[][];
public void Resize(int Percentage)
{
Color[]temp = Standart_Methods.Reduce2DArray(this.PointInformation);
int temp_width = this.width;
int temp_height = this.height;
double Faktor = (Percentage+100)/100;
this.width = (int) (this.width*Faktor);
this.height = (int) (this.height*Faktor);
this.ResetPointInformation();
Color[]temp2 = Standart_Methods.Reduce2DArray(this.PointInformation);
int SamePixelCount = 0;
Color LastColor = temp[0];
for (int i = 0; i < temp.length; i++)
{
if (temp[i] == LastColor)
{
SamePixelCount += 1;
}
else
{
for (int i2 = (int) (i*Faktor); i == 1; i--)
//Method Resize will only be called when i*Faktor is going to be 100% = X.0 (An Integer)
{
temp2[i*2-i] = LastColor;
}
SamePixelCount = 0;
}
}
Standart_Methods.PrintArray(temp2);
int a = 10;
int b = 0;
System.out.print(a/b); //No Exeption, Code unreachable!?
}
}
그것은 기본적으로 온도 [0]에서 시작하여 한이 같은 색을 찾아로 INT의 SamePixelCount 1 추가 (I는 1 차원 배열로 2D-배열을 convertig 때 쉽게이해야 할 것을 발견). 다른 Color가 발견되면이 메서드는 이전 Pixel의 Color를 temp2 Array의 오른쪽 Places에 씁니다. 내가 테스트하고 싶었 기 때문에
for (int i = 0; i < temp.length; i++)
{
if (temp[i] == LastColor)
{
SamePixelCount += 1;
}
else
{
for (int i2 = (int) (i*Faktor); i == 1; i--)
//Method Resize will only be called when i*Faktor is going to be 100% = X.0 (An Integer)
{
temp2[i*2-i] = LastColor;
}
SamePixelCount = 0;
}
}
개체의 PointInformation로 조작 배열 TEMP2의 올바른 번역은 여전히 누락, TEMP2가 올바르게 온도에서 크기가 조정 된 경우, 그래서 나는
Standart_Methods.PrintArray(temp2); //the Method works btw
을했다지만 그냥 아무것도하지 않았다! 그리고 심지어 더 나쁜! 내가 그 명령의 장소에 두는 모든 것은 또한하지 않았다!
int a = 10;
int b = 0;
System.out.print(a/b); //No Exeption!
그리고 무엇 심지어 낯선 사람, 최대한 빨리 전화로 방법 크기 조정는, 어딘가에, 통화 후 모든 것이 같은 이상한 도달 할 수없는 코드로 켜지는지!?
나는이 문제를 일으킬 수있는 것에 대해 진지하게 모릅니다.
도움이 될 것입니다.
예외적으로 호출 체인에서 더 높은 값을 얻을 수 있습니까? –
그러면 적어도 Standart_Methods.PrintArray (temp2)를 수행합니다. 그렇지 않니? –
그렇다면 'System.out.print (a/b);'는 실행 흐름을 깨고 예외를 던질 것입니다. 만약 누군가가'try {myObject2D.Resize (10)} catch (Exception e) {/ * 아무것도 * /}'와 같은 것을했다면 예외가 보이지 않을 것입니다. –