D
dcook
Hello,
Wondering if someone may have a solution for my problem with Initial
Data for object arrays. I have a 2D vector animator program that
auto-generates data for Java code. All the vector objects data is
output for a structures which I have converted to data classes. My
problem is the data can get too large for Java and I get a "code to
large" error from the compiler. So if the 2D project has something
like 5,000 box vectors in it, it outputs 4 coordinate values top, left,
bottom, right and a string for the box's name which is loaded into a
box class that is part of a box class array of 5,000. At first, I tried
something like this;
public class project_data {
public static final int box_count = 5,000;
public static box[] box_array = { new box(0,0,10,10,"box1"), new
box(20,20,40,40,"box2"), ....};
}
I couldn't have very many boxes in the array before I got a "code
to large" error so I then changed it to output the data as a string
array that I can then parse into data which increased the amount of
objects I can have. I created separated data classes for all data
types. I had to make them string arrays because it is mixed data.
Example;
public class box_data {
public static final String[] data = { "0,0,10,10,\"box1\"",
"20,20,40,40,\"box2\"", ...};
public static box[] box_data(int count) {
box[] dobj = new box[count];
for (int i = 0; i < count; i++) {
dobj = new box(data);
}
return dobj;
}
}
Class project_data {
public static final int box_count = 5,000;
public static box[] box_array = box_data(count);
}
Is there another way I can define the data to get past this limit in
Java or any suggestion of a better way so I can support more objects.
Thanks,
Dave
Wondering if someone may have a solution for my problem with Initial
Data for object arrays. I have a 2D vector animator program that
auto-generates data for Java code. All the vector objects data is
output for a structures which I have converted to data classes. My
problem is the data can get too large for Java and I get a "code to
large" error from the compiler. So if the 2D project has something
like 5,000 box vectors in it, it outputs 4 coordinate values top, left,
bottom, right and a string for the box's name which is loaded into a
box class that is part of a box class array of 5,000. At first, I tried
something like this;
public class project_data {
public static final int box_count = 5,000;
public static box[] box_array = { new box(0,0,10,10,"box1"), new
box(20,20,40,40,"box2"), ....};
}
I couldn't have very many boxes in the array before I got a "code
to large" error so I then changed it to output the data as a string
array that I can then parse into data which increased the amount of
objects I can have. I created separated data classes for all data
types. I had to make them string arrays because it is mixed data.
Example;
public class box_data {
public static final String[] data = { "0,0,10,10,\"box1\"",
"20,20,40,40,\"box2\"", ...};
public static box[] box_data(int count) {
box[] dobj = new box[count];
for (int i = 0; i < count; i++) {
dobj = new box(data);
}
return dobj;
}
}
Class project_data {
public static final int box_count = 5,000;
public static box[] box_array = box_data(count);
}
Is there another way I can define the data to get past this limit in
Java or any suggestion of a better way so I can support more objects.
Thanks,
Dave