java.lang.Object com.realtime.crossfire.jxclient.faces.AbstractFaceQueue com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue
public class AskfaceFaceQueue
A FaceQueue
requesting faces by "askface" commands sent to the
Crossfire server.
Field Summary | |
---|---|
private static int |
CONCURRENT_ASKFACE_COMMANDS
The maximum number of concurrently sent "askface" commands. |
private CrossfireServerConnection |
crossfireServerConnection
The connection to use. |
private CrossfireUpdateFaceListener |
crossfireUpdateFaceListener
The CrossfireUpdateFaceListener registered to crossfireServerConnection receive face 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 Summary | |
---|---|
AskfaceFaceQueue(CrossfireServerConnection crossfireServerConnection)
Creates a new instance. |
Method Summary | |
---|---|
private 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. |
Methods inherited from class com.realtime.crossfire.jxclient.faces.AbstractFaceQueue |
---|
addFaceQueueListener, fireFaceFailed, fireFaceLoaded, removeFaceQueueListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int CONCURRENT_ASKFACE_COMMANDS
@Nullable private final CrossfireServerConnection crossfireServerConnection
@NotNull private final CrossfireUpdateFaceListener crossfireUpdateFaceListener
CrossfireUpdateFaceListener
registered to crossfireServerConnection
receive face 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
Constructor Detail |
---|
public AskfaceFaceQueue(@Nullable CrossfireServerConnection crossfireServerConnection)
crossfireServerConnection
- the connection instance for sending
askface commandsMethod Detail |
---|
private 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()