Hi
For Array List functions, I would like to know the type of data returned by the Particle part = particles.get(0) function ?
after some try, ;;; it’s not float or int or string … so, what is ?
Thank in advance
Eric
By example, we could have the following code (see the ??? at the end) :
INITIALIZE SHEET :
//////////////////////////////////////////////////////////////////////////
ArrayList<Class_B> class_b_elements = new ArrayList<Class_B>();
// CREATE - Class D
Class_B class_b_elementA1 = new Class_B(BX+10, BY+10, 10, 15, 25, “1”); // (x, y, w, h, couleur, Id)
Class_B class_b_elementA2 = new Class_B(BX+25, BY+25, 15, 20, 50, “2”); //
Class_B class_b_elementA3 = new Class_B(BX+45, BY+45, 20, 25, 75, “3”); //
Class_B class_b_elementA4 = new Class_B(BX+70, BY+70, 25, 30, 100, “4”); //
Class_B class_b_elementA5 = new Class_B(BX+100, BY+100, 30, 35, 125, “5”); //
//////////////////////////////////////////////////////////////////////////
CLASS B SHEET :
//////////////////////////////////////////////////////////////////////////
class Class_B {
float x;
float y;
float w;
float h;
int couleur;
String Blabel;
int tStatus=1; // specifies current status (0=off/not visible, 1=on/visible)
int hStatus=0; // specifies if current is highlighted (1) or normal (0)
//////////////////////////////////////////////////////////////////////////
Class_B(float x, float y, float w, float h, int couleur, String Blabel) { // rectangle
this.x=x;
this.y=y;
this.w=w;
this.h=h;
this.couleur=couleur;
this.Blabel=Blabel;
}
//////////////////////////////////////////////////////////////////////////
??? getClass_B(int i) {
Class_B refClass_B = class_b_elements.get(i);
return refClass_B
}
} // Class_B definition
//////////////////////////////////////////////////////////////////////////
MAIN SHEET :
//////////////////////////////////////////////////////////////////////////
final int SCREEN_WIDTH = 800;
final int SCREEN_HEIGHT = 500;
//////////////////////////////////////////////////////////////////////////
void settings() {
size(SCREEN_WIDTH, SCREEN_HEIGHT);
}
//////////////////////////////////////////////////////////////////////////
void setup() {
Initialize();
}
//////////////////////////////////////////////////////////////////////////
for (int i = 0; i<5; i = i+1){
??? refClass_B = getClass_B(i) {
println (“refClass_B:”, refClass_B);
}
//////////////////////////////////////////////////////////////////////////
please format code with </> button * homework policy * asking questions