parameter in config file

Home Forums PeerfactSim Forum parameter in config file

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #774
    tobias amft
    Guest

    Hi,

    currently I am implementing an own analyzer in PeerfactSim. I know that the analyser class has to be declared in the xml config file of the experiment. e.g.:
    <Analyzer class=”org.peerfact.impl.overlay.dht.chord.chord.analyzer.myAnalyzer” />.

    My question now is:
    how can one hand over parameter to the class?

    e.g.:
    <Analyzer
    class=”org.peerfact.impl.overlay.dht.chord.chord.analyzer.myAnalyzer”
    param1 = “…”
    param2 = “…”
    />

    Is it possible to reach the variables directly if param1 and param2 are declared public in my analyzer class?
    Or do I have to use getter/setter methods?
    Or do I have to change the Scenario Builder or something like that?

    best regards
    Tobi

    #775
    Philipp Giesen
    Guest

    Hey Tobias,

    yes, setter-methods are the way to go. For each parameter you add in the config file, the engine searches for a setter-method within the class specified. In your example, you would have to add a method setParam1(<typeOfParameter>). param1 and param2 would be declared private in your class but are modified via the setter-methods anyway.

    This works for the host builder and should also work for analyzers. Quite simple. 🙂

    regards,
    Philipp

    #776
    tobias amft
    Guest

    Thanks for your quick answer,

    you are such an educated person …
    I wish i had your knowledge 😉

    regards Tobi

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Comments are closed.