Attribute class documentation

Authors

Generated by pauljohn

Software documentation for the Attribute class

Attribute : SwarmObject

Declared in:
Attribute.h

When agents meet new contacts, they create "Attribute" objects in which to store records. They record information about the identity of the other agent--such as its id number and a pointer to its address, and also they keep a snapshot of its culture at the time they met, a pointer to the other's culture (to reflect its state at any given instant, and also it keeps a summary measure of the similarity of the other agent with self.

Method summary

decrSimilarity

- (id) decrSimilarity;

Reduce by one the similarity variable


getAgentPtr

- (id) getAgentPtr;

Return a pointer to the agent that this attribute record describes


getCulturePtrOffset:

- (int) getCulturePtrOffset: (int)i;

Check the issue/culture pointer of the other agent and return the i'th opinion


getFeature:

- (int) getFeature: (int)f;

Return the f'th issue/culture value stored in this attribute


getIDnum

- (int) getIDnum;

Return id number of agent that this attribute record describes


getInteractions

- (int) getInteractions;

Return the number of interactions


getSimilarity

- (int) getSimilarity;

Returns the memory of similarity, allowing agents to wander about and look at each other and find out 'how similar was that other to me when we last met.'


incrSimilarity

- (id) incrSimilarity;

Increment by one the similarity variable


incrementInteractions

- (void) incrementInteractions;

Increment by one the interactions counter


initCulture:

- (id) initCulture: (int)features;

Initialize the culure array in which a snapshot of the other's features is to be stored. Its storage is dynamically allocated.


sayHi

- (id) sayHi;

Diagnostic method that prints values of variables to the screen


setAgentPtr:

- (void) setAgentPtr: (id)anAgent;

Set a pointer to the agent that this attribute describes


setCulturePtr:

- (void) setCulturePtr: (int*)ptr;

Set this pointer to the culture array of the agent that is represented by this attribute object. Note that the instance variable culture records the culture that was observed at the last interaction, but this pointer always shows the current value.


setFeature:to:

- (id) setFeature: (int)f to: (int)v;

Set teh f'th issue/culture value to v


setIDnum:

- (void) setIDnum: (int)num;

Set the id number of the agent about whom these attributes are being saved


setSimilarity:

- (id) setSimilarity: (int)s;

The Attribute is told to remember the similarity value for the agent that it represents