We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Invalid type (Read 551 times)
Invalid type
Jul 11th, 2007, 10:15am
 
Hi,
 I am trying to use java syntax of breaking part of the calculations inside of void.

loop:

..calculation...

break loop:

but I am getting " Invalid type:22" error. It works fine when compiled in java. I tried to use while loop, but it did not work. Any suggestions? thanks
Re: Invalid type
Reply #1 - Jul 11th, 2007, 11:15am
 
I'm afraid you're going to have to post the code to show what exactly you're doing.
Re: Invalid type
Reply #2 - Jul 12th, 2007, 6:48pm
 
Thanks, this is where I have the problem with the break loop :



void Geometry (double[][] nodes){
int i, j, k, l, m, n;
double a, b, c, x0, y0, x1, y1, x2, y2, x3, y3;
if (nodes == null) return;
if (nodes.length == 0) return;

NODES = nodes.length;
BUFFER = NUM_SITES + 4;

for( i = 0; i < NODES - 1; i++){
x0 = nodes[i][0];
y0 = nodes[i][1];
n = i * BUFFER + i + 1;
for( j = i + 1; j < NODES; j++){
x1 = nodes[j][0];
y1 = nodes[j][1];
a = b = Math.sqrt( ( x1 - x0) * ( x1 - x0) + ( y1 - y0) * ( y1 - y0));

loop:
for( k = 0; k < i; k++){
x2 = nodes[j][0];
y2 = nodes[j][1];
m = k * BUFFER + k + 1;
for( l = k + 1; l < NODES; l++){
c = distance[m];
if( l != i && l != j && c >= 0){
x3 = nodes[k][0];
y3 = nodes[k][1];
if( Check( x0, y0, x1, y1, x2, y2, x3, y3)){
if( b > c){
a = -1;
break loop;
}
}
}
m++;
}
}
distance[n] = a;
if( a >= 0){
for( k = 0; k < i; k++){
x2 = nodes[k][0];
y2 = nodes[k][1];
m = k * BUFFER + k + 1;
for( l = k + 1; l < NODES; l++){
x3 = nodes[l][0];
y3 = nodes[l][1];
if( l != i && l != j && distance[m] >= 0 && Check( x0, y0, x1, y1, x2, y2, x3, y3)) distance[m] = -1;
m++;
}
}
}
n++;
}
}
}
Page Index Toggle Pages: 1