Menu

C2 tutorial is not working as expected.

Help
2016-07-06
2016-07-12
  • Mahmud Hasan

    Mahmud Hasan - 2016-07-06

    I am trying to build tutorial C2. It is building but not working as expcted. Here is the code I got from source:

    import java.util.HashMap;
    import java.util.Map;
    
    import jadex.bdiv3.annotation.Belief;
    import jadex.bdiv3.annotation.Plan;
    import jadex.bdiv3.annotation.Trigger;
    import jadex.bdiv3.runtime.ChangeEvent;
    import jadex.bridge.service.annotation.Service;
    import jadex.micro.annotation.Agent;
    import jadex.micro.annotation.AgentCreated;
    import jadex.micro.annotation.Description;
    import jadex.rules.eca.ChangeInfo;
    
    /**
    
     *  Dynamic belief.
     */
    @Description("The clock agent C2. <br>  This translation agent uses a belief with update rate.")
    @Agent
    @Service
    public class TranslationBDI
    {
        /** The current time. */
        @Belief
        protected Map<String, String> wordtable = new HashMap<String, String>();
    
        @Belief(dynamic=true)
        protected boolean alarm = wordtable.containsKey("bugger");
    
        //-------- methods --------
    
        @AgentCreated
        public void init()
        {
            wordtable.put("coffee", "Kaffee");
            wordtable.put("milk", "Milch");
            wordtable.put("cow", "Kuh");
            wordtable.put("cat", "Katze");
            wordtable.put("dog", "Hund");
    
            wordtable.put("bugger", "Flegel");
        }
    
        /**
    
         *  Initiate an alarm.
         */
        @Plan(trigger=@Trigger(factchangeds="alarm"))
        public void checkWordPairPlan(ChangeEvent<ChangeInfo<Boolean>> event)
        {
            ChangeInfo<Boolean> change  = event.getValue();
            // Print warning when value changes from false to true.
            if(Boolean.FALSE.equals(change.getOldValue()) && Boolean.TRUE.equals(change.getValue()))
            {
                System.out.println("Warning, a colloquial word pair has been added.");
            }
        }
    }
    

    Any help please?

    **Question: ** The tutorial didn't mentioned to annotate the class as @Service, but in the code it was annotated as @Service. Why do we need to annotate the class as @Service here?

     

    Last edit: Mahmud Hasan 2016-07-06
  • Lars Braubach

    Lars Braubach - 2016-07-06

    Hi,

    actually, this was a bug. I fixed it and the working version will be shipped with the next working nightly release. Sorry for the inconveniences.

    Best
    Lars

     

    Last edit: Lars Braubach 2016-07-06
  • Mahmud Hasan

    Mahmud Hasan - 2016-07-11

    Thanks Lars,
    How can I get the latest Nightly build?
    Is there any way to get notified once it is released?

    Regards,
    Mahmud

     
  • Julian

    Julian - 2016-07-11

    Hi Mahmud,
    the nightly builds are available on our download page: https://activecomponents.org/#/download (scroll down to nightly builds).
    Sadly, there was no successful build since Lars fixed the error. You can see it by looking at the date next to the build.
    There is currently no way of automatically getting a notification and I don't think it's generally needed.
    I will try to fix the build now so you can use the bugfix.

     
  • Julian

    Julian - 2016-07-11

    Build 3.0.0-RC63 is now available. Please check if this fixes your problem.

     
  • Mahmud Hasan

    Mahmud Hasan - 2016-07-12

    Thanks Julian! I'll try it.
    UPADATE: It is working now. Thanks again.

     

    Last edit: Mahmud Hasan 2016-07-12

Log in to post a comment.

MongoDB Logo MongoDB