Hi all,
I have to set some parameters to objects created in my model.
They are some selectOutput and some delay.
I have to set for selectOutput the probability to choose outT or outF (it is dynamic but i need to set this value when i
call init function -i created this method-) and also the value with which delay dalays entities passing through it (this
parameter is present in visual modelling but not accessible through my method. I can't set it with delay.setDelay or
such similar).
How can i do this?
thanks a lot!
federico rinaldi
Politecnico di Milano
Victor Gleim — 05.12.07
Federico, why can't you just call a custom method returning a probability from the "probability" parameter
field?
Federico Rinaldi — 05.12.07
I have to SET it and not to GET... but those parameters are dynamic and i haven't found a method to set them from a
function i created. but i need to do it.
Federico
Victor Gleim — 05.12.07
If you create objects dynamically, you could use the following way to set a value returned by a dynamic parameter.
Let's presume there is an active object called "MyClass", and it has the double parameter with the name
"parameter". In that case, you should create an object overriding the "parameter" method:
MyClass mc = new MyClass(getEngine(), this, myClass) {
public double parameter() {
return 7.0;
}
};
Federico Rinaldi — 05.12.07
this isn't what i have to do... i explain better:
i have one object selectOutput (from enterprise library) put in the graphical model. this object have one attribute
called "Select true output" that can be set to "If condition is true" or to "with specified
probability [0...1]".
The selection of one of the two possibilities activate one additonal attribute, respectively "Condition" and
"Probability". These two attributes are dynamical and there isn't a method in the root class selectOutput that
allows to set them. is there another solution to set them instead of setting them in the graphical model?
Victor Gleim — 06.12.07
to Federico:
If this active object isn't created dynamically, you can't change its dynamical parameter. However, as I have already
said, you could call a method from a parameter, which, depending on a situation, will return a different value. It is
the way that is often used.