Hi everyone!
I'm trying to use the type-safe enumeration in my project (COCOMO II
implementation). I won't give too much details, but the COCOMO model
consists of a serie of parameteres rated from Very-low to Very-high and the
model make some calculations with these parameters.
So, I wrote a Class to hold my parameters (enumerations):

public class Parameters {

public enum PREC implements FatorEscala {
VERY_LOW(6.20f), LOW(4.96f), NOMINAL(3.72f), HIGH(2.48f),
VERY_HIGH(1.24f), EXTRA_HIGH(0);
 private final float valor;

PREC(float value) {
this.valor = value;
}

public float valor() {
return valor;
}
}

public enum FLEX {
VERY_LOW(5.07f), LOW(4.05f), NOMINAL(3.04f), HIGH(2.03f),
VERY_HIGH(1.01f), EXTRA_HIGH(0);
 private final float valor;

FLEX(float value) {
this.valor = value;
}

public float valor() {
return valor;
}
}

// A bunch of other parameters defined in same way above.....


}


Now I want to have a variable in another class which is a collection of
theese paramenters (enumerations) rather defining one variable for each
enumeration.
I supose I have to make these enumerations to implement same interface to
acomplish that, right? I'd like to write something like:

List<IParameter> parameters = new ArrayList<IParameter>();
parameters.add(Parameters.PREC.LOW);
parameters.add(Parameters.FLEX.HIGH);

This way I can iterate over the collection and get the sum or the product of
the parameters values.

How can I acomplish this??

Thanks for any help.

Vitor.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to