|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.ntnu.ecosim.agents.consumers.FriendList
public class FriendList
The Class FriendList. This class is meant as an alternative to ArrayList to save memory. Since the number of consumers can be quite extensive, this class is intended to reduce the memory usage of each consumer.
Constructor Summary | |
---|---|
protected |
FriendList(int maxFriends)
The Constructor of a friend list. |
Method Summary | |
---|---|
protected void |
add(int friend)
Add one friend to the list. |
protected boolean |
contains(int friend)
Method saying whether or not the list contains the specified friend |
protected int |
get(int place)
Getter method for the friendlist. |
protected int |
size()
Method to get the size of the list |
protected void |
sortList()
Method used to sort the list of friends. |
protected int[] |
toIntegerArray()
Method to get the list of friends represented as an integer array containing the unique IDs of the friends |
protected void |
trimList()
Method to trim the friend list, removing unused length of the array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FriendList(int maxFriends)
maxFriends
- the maximum number of friends allowed in this friendlistMethod Detail |
---|
protected void add(int friend) throws java.lang.IndexOutOfBoundsException
friend
- the friend
java.lang.IndexOutOfBoundsException
- thrown if the list is fullprotected boolean contains(int friend)
friend
- the friend
protected int get(int place) throws java.lang.IndexOutOfBoundsException
place
- the place where the friend is located
java.lang.IndexOutOfBoundsException
- thrown if the place is out of boundsprotected int size()
protected void sortList()
protected int[] toIntegerArray()
protected void trimList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |