Does anyone here have an Idea what I might be doing wrong here.
This is quite a long program so I'm gonna try to simplify it here.
I have a ClassA, with a private double var.
I have a ClassB, ClassB stores one element of ClassA.
I have a ClassC extends Thread, ClassC stores one or more elements of ClassB.
I have another class ClassSort, witch is just an array of 50 elements of ClassA and it sort it as they are being entered according to the value of var.
Now this is the way Im trying to run it.
When I try and run my program, I start with classSortType fill with value bigger than 0. After running the program I print out the vars stored in the array, and most of them have been set to zero for some strange reason... I can't find where this problem is comming from, do you have any ideas where is my problem, or what can I do to track down the problem.
If you need more details about the classes ask me.
Thank you all in advance.
This is quite a long program so I'm gonna try to simplify it here.
I have a ClassA, with a private double var.
I have a ClassB, ClassB stores one element of ClassA.
I have a ClassC extends Thread, ClassC stores one or more elements of ClassB.
I have another class ClassSort, witch is just an array of 50 elements of ClassA and it sort it as they are being entered according to the value of var.
Now this is the way Im trying to run it.
Code:
if(classCList.size() == 15){
while(classCList.size() != 0){
if(!classCList.get(0).isRunning()){
for(int j = 0; j < classCList.get(0).getNumberOfClassBElements(); j++){
tempClassA = classCList.get(0).getClassB(j).getClassA();
if(tempClassA.getVar() > 0.01){
try{Thread.sleep(1000);}catch(InterruptedException e){return;}
System.out.println("Adding : " + tempClassA.getVar());
classSortType.add(tempClassA);
}
}
classCList.remove(0);
}
}
}
When I try and run my program, I start with classSortType fill with value bigger than 0. After running the program I print out the vars stored in the array, and most of them have been set to zero for some strange reason... I can't find where this problem is comming from, do you have any ideas where is my problem, or what can I do to track down the problem.
If you need more details about the classes ask me.
Thank you all in advance.