public class AskfaceFaceQueue extends AbstractFaceQueue
FaceQueue
requesting faces by "askface" commands sent to the
Crossfire server.Modifier and Type | Field and Description |
---|---|
private AskfaceQueue |
askfaceQueue
The connection to use.
|
private static int |
CONCURRENT_ASKFACE_COMMANDS
The maximum number of concurrently sent "askface" commands.
|
private java.util.Map<java.lang.Integer,Face> |
pendingAskfaces
Face numbers for which "askface" commands have been sent without having
received a response from the server.
|
private java.util.Map<java.lang.Integer,Face> |
pendingFaces
Face numbers for which an "askface" command should be sent.
|
private java.util.List<Face> |
pendingFacesQueue
The same elements as
pendingFaces in query order. |
private java.lang.Object |
sync
The object use for synchronization.
|
Constructor and Description |
---|
AskfaceFaceQueue(AskfaceQueue askfaceQueue)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
faceReceived(int faceNum,
int faceSetNum,
java.nio.ByteBuffer packet)
Notifies the askface manager that image information have been received
from the server.
|
void |
loadFace(Face face)
Request a face.
|
private void |
processFaceData(Face face,
byte[] data)
Processes face information received from the server.
|
void |
reset()
Reset the processing: forget about pending faces.
|
private void |
sendAskface()
Sends some pending "askface" commands.
|
addFaceQueueListener, fireFaceFailed, fireFaceLoaded, removeFaceQueueListener
@NotNull private final AskfaceQueue askfaceQueue
private static final int CONCURRENT_ASKFACE_COMMANDS
@NotNull private final java.util.Map<java.lang.Integer,Face> pendingAskfaces
Face
instance.@NotNull private final java.util.Map<java.lang.Integer,Face> pendingFaces
pendingAskfaces
.@NotNull private final java.util.List<Face> pendingFacesQueue
pendingFaces
in query order.@NotNull private final java.lang.Object sync
public AskfaceFaceQueue(@NotNull AskfaceQueue askfaceQueue)
askfaceQueue
- the connection instance for sending askface commandspublic void faceReceived(int faceNum, int faceSetNum, @NotNull java.nio.ByteBuffer packet)
faceNum
- the face IDfaceSetNum
- the face setpacket
- the face datapublic void loadFace(@NotNull Face face)
FaceQueueListener.faceLoaded(Face, FaceImages)
or FaceQueueListener.faceFailed(Face)
for the face. Faces re-requested
while still processing may be notified only once.face
- the requested faceprivate void processFaceData(@NotNull Face face, @NotNull byte[] data)
face
- the facedata
- the face information; it is supposed to be a .png filepublic void reset()
private void sendAskface()