|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.ntnu.ecosim.agents.Agent
edu.ntnu.ecosim.agents.consumers.Consumer
public class Consumer
This is the class that represent the consumer agents.
Field Summary |
---|
Fields inherited from class edu.ntnu.ecosim.agents.Agent |
---|
market |
Constructor Summary | |
---|---|
Consumer(int ID,
Market market)
This is the basic constructor, creating a new user without service provider at a specific time. |
|
Consumer(int ID,
ServiceProvider spro,
Market market)
This constructor can be used when an initial base of users are to be simulated. |
Method Summary | |
---|---|
boolean |
becomeFriend(int friendID)
Method used to make this consumer become friend with another consumer. |
double |
getCalculatedValue(int sp)
Method to get the value this consumer calculated for the specified service provider (used for statistical purposes) |
int[] |
getFriends()
Method to get a list of the unique IDs for the friends of this consumer |
int |
getNofFriends()
Method to get the number of friends of this consumer |
int |
getUniqueID()
Getter method for the unique ID of the consumer. |
boolean |
hasEnoughFriends()
Method to check whether or not there is room for more friends. |
boolean |
isFriend(int friendID)
Method to check whether this consumer is friend with a specific other consumer. |
boolean |
isUsing(java.lang.String spUniqueID)
|
boolean |
knowsInnovation(java.lang.String unique)
Method for getting whether or not this consumer knows the specified innovation |
void |
performAction()
This is the method that is called for each new time step. |
boolean |
providerChanged()
Method to check whether the consumer has changed service provider this round |
void |
receiveProviderInformation(java.lang.String sproUniqueID,
int persuation,
java.util.HashMap<java.lang.String,java.lang.String> innovations)
Method used to receive information about provider from a friend |
void |
sortFriendList()
Method to be used to sort the friend list of this consumer in increasing order |
void |
trimFriendList()
By using this method, the empty slots of the friend list are removed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Consumer(int ID, Market market)
ID
- the unique ID of this consumermarket
- the market the consumer operates withinpublic Consumer(int ID, ServiceProvider spro, Market market)
spro
- the service provider this consumer has initiallyID
- the unique ID of this consumermarket
- the market the consumer operates withinMethod Detail |
---|
public boolean becomeFriend(int friendID)
friendID
- the ID of the potential friend
public double getCalculatedValue(int sp)
sp
- The service provider
public int[] getFriends()
public int getNofFriends()
public int getUniqueID()
public boolean hasEnoughFriends()
public boolean isFriend(int friendID)
friendID
- the ID of the friend to check
public boolean isUsing(java.lang.String spUniqueID)
public boolean knowsInnovation(java.lang.String unique)
unique
- the unique ID of the innovation
public void performAction()
Agent
performAction
in class Agent
public boolean providerChanged()
public void receiveProviderInformation(java.lang.String sproUniqueID, int persuation, java.util.HashMap<java.lang.String,java.lang.String> innovations)
sproUniqueID
- the unique ID of the service providerpersuation
- the rate of persuation the friend has on this consumerinnovations
- a list of known innovations for this providerpublic void sortFriendList()
public void trimFriendList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |