problem creating an agent's copy of another objects ArrayList.
Thanks for any help.
ObjectA [] objecta= new ObjectA[objecta];
void setup() {
//data is loaded from an xml file
objecta[i] = new ObjectA(id, color(H, S, B), area, new PVector(position.x, position.y)); //defines ObjectA
//add associates to arrayList of ObjectA and ObjectB
objecta[i].associates.add(asso1);
objecta[i].objectb.associates.add(asso1);
objecta[i].associates.add(asso2);
objecta[i].objectb.associates.add(asso2);
}
////////////////////////////////////////////////////////////////////
class ObjectA{
ObjectB objectb;
ArrayList objectCs;
PVector origin;
ArrayList associates = new ArrayList();
int objectcCount = population;
ObjectA(int id, int colour, int Size, PVector loc) {
objectb= new ObjectB (id, colour, Size, loc);
//ObjectC
objectCs = new ArrayList();
origin = loc.get();
for (int i = 0; i < population; i++) {
objectCs.add(new objectC(id, Size, origin, false, i, associates));
//i think this is were i go wrong passing the arrayList 'associates' to objectCs
}
}
////////////////////////////////////////////////////////////////////
class ObjectB {
int id;
color colour;
int Size;
int x;
int y;
PVector position;
ArrayList associates = new ArrayList();
ObjectB(int identity, int c, int area, PVector loc) {
id = identity;
colour = c;
Size = area;
position = loc.get();
}
////////////////////////////////////////////////////////////////////
class objectC{
ArrayList associates = new ArrayList();
objectC(int identity, int Size, PVector loc, boolean mode, int whom, ArrayList asso) {
associates = asso;
}