HBRS-MAAS / ws18-project-right-brothers

ws18-project-right-brothers created by GitHub Classroom
0 stars 0 forks source link

Using Agent from org.maas which exists in org.right_brothers as duplication #71

Closed ZahidSE closed 5 years ago

ZahidSE commented 5 years ago
DharminB commented 5 years ago

Timekeeper agent is different in right-brothers and the one in upstream. The one in upstream master is outdated. The one in right-brothers master is also outdated but a newer version. The one in upstream added_base_and_clock branch is the most recent. Once that is merged to master, I can remove the current timeKeeper.

DharminB commented 5 years ago

I am encountering an error with BaseAgent. The simplest case to recreate the error:

  1. Change line 24 in BakeryCustomerAgent.java from import org.right_brothers.agents.BaseAgent to import org.maas.agents.BaseAgent;.
  2. gradle run

The error says that few functions have protected access. The problem is, when the rest of the code remains same (BakeryCustomer extending BaseAgent) why does protected acess create error. The bakery customer is still a child of BaseAgent so it should still be able to use the protected functions... @ZahidSE

ZahidSE commented 5 years ago

We can only access protected property/method of the parent from derived class but not protected property/method of the protected property/method in base class unless the base and the derived classes live in the same package. Protected property/method is accessible to Derived classes and classes in the same package.

It was not a problem before because the BaseAgent and BakeryCustomerAgent were in the same package.

we need to make finished, getAllowAction and sendMessage pubic int org.maas.BaseAgent. We do not need setup, stepAction, register, and deRegister public because they are called from the derived class, not from a behavior of a derived class.

otherwise, everyone would require to override finished, getAllowAction and sendMessage in their agent or they would need to put their agents in org.maas.agents package.