Class Diagrams - randyhook/knynet GitHub Wiki
Agent and Agency
images/class-diagram-agent-and-agency.png
SensoryData and SensoryEncoded
images/class-diagram-sensorydata-and-sensoryencoded.png
Simulator Classes
images/class-diagram-simulator.png
The need for derived simulator classes revolves around the SensoryData class. In the real world, incoming sensor data from the environment will be processed by each sensor and packaged in a SensoryData object.
The SensoryData object will contain data such as audio signals and visual records. The Agent will then pass this data onto the appropriate Agency which will repackage the data as a SensoryEncoded object, consisting of data the network can handle more readily.
We could feed the simulator pre-packaged SensoryData objects, but I am not yet to the point of developing the models for real world environmental data. I am, however, ready to model SensoryEncoded data.
A SimSensoryData class is therefore derived, and it consists of pseudo environmental data. Simulated Agent and Agency classes are then derived so they can handle SimSensoryData. The SimAgents also have an update function, which real world agents would not, since they are updating in real time.
MemoryObserver
images/class-diagram-observer-pattern.png
The Simulator needs a way to display messages from activities taking place in several different areas. We make use of the Observer Pattern to get notified of these activities.
Memory in an Agent is stored to every time the Agent is exposed to any data. This looks like a good place to generate notifications to Simulator, so we derive Memory from our Observable class. Simulator wants to be notified of activities inside of Memory so it derives from Observer and subscribes to Memory. When activity is performed in Memory, it notifies each of its subscribers by sending an ObservableNotification instance to them. The subscribers can then do what they want with the notification data.