Hello,
my question is as follows:
I am an object of class Truck, with an attribute: int return, that is at once an appeal and transported the Entity of
the class content.
He defined the class as a truck-type RosourceUnit, now I need to return when the parameter is: return> 1 in an
object selectOutput choose a path and the other in case different.
forgive my translation, I hope you understand the question.
Thank you
Pavel — 12.08.08
Hi Leo,
As I understand class Truck extends ResourceUnit in your model and instances of this class have integer field
"return". Please note that "return" it is a Java reserved word, so you may use e.g.
"re_turn". Thus the condition in "Select Output" object may be like the following:
((Truck)entity.resourceUnits.get(int index)).re_turn > 1
Leo — 13.08.08
Hello Pavel,
Thank you for your help. In the translation 'return' as 'vuelta', and as a 'Truck' as 'Camion'.
I tried with the following judgement:
((Truck) entity.resourceUnits.get (int index)). Re_turn> 1
((Camion) entity.resourceUnits.get (int index)).vuelta > 1
and,
public class Camion extends ResourceUnit {
int vuelta=1;
public Camion(){
}
/** * Constructor initializing the fields */
public Camion(int vuelta){
this.vuelta = vuelta;
}
............
I get the following errors:
Syntax error on token "int", delete this token
index cannot be resolved
Cannot Cast from linkedList<ResourceUnit>to Camion
forgive my translation, i hope you understand the question.
Thank you
Leo
Pavel — 18.08.08
Hi Leo,
"int index" it is the common syntax. It means that you should type the name of the required integer variable
or number in brackets instead of "int index". So you should type the code like the following:
((Camion) entity.resourceUnits.get (1)).vuelta > 1
or
((Camion) entity.resourceUnits.get (number)).vuelta > 1
where "number" is an integer variable or parameter.
Leo — 25.08.08
Hi Pavel,
thank you very much for your help,
Leo