java.lang.Object
technology.sola.engine.networking.NetworkQueue<T>
- Type Parameters:
T- the type of the data
NetworkQueue is a data structure for holding network messages in a first in first out basis.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds message to the front of the queue.voidAdds a message to the end of the queue.voidclear()Clears all messages from the queue.getFirst()getLast()booleanisEmpty()Removes the first message from the queue and returns it.Removes the last message from the queue and returns it.intsize()
-
Constructor Details
-
NetworkQueue
public NetworkQueue()
-
-
Method Details
-
isEmpty
public boolean isEmpty()- Returns:
- true if there are no messages
-
size
public int size()- Returns:
- the number of messages in the queue
-
getFirst
- Returns:
- the first message in the queue
-
getLast
- Returns:
- the last message in the queue
-
addFirst
Adds message to the front of the queue.- Parameters:
item- the message to add
-
addLast
Adds a message to the end of the queue.- Parameters:
item- the message to add
-
clear
public void clear()Clears all messages from the queue. -
removeFirst
Removes the first message from the queue and returns it.- Returns:
- the first message in the queue
-
removeLast
Removes the last message from the queue and returns it.- Returns:
- the last message in the queue
-