Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue Class Reference

A FaceQueue requesting faces by "askface" commands sent to the Crossfire server. More...

+ Inheritance diagram for com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue:
+ Collaboration diagram for com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue:

Public Member Functions

 AskfaceFaceQueue (@NotNull final AskfaceQueue askfaceQueue)
 Creates a new instance. More...
 
void faceReceived (final int faceNum, final int faceSetNum, @NotNull final ByteBuffer packet)
 Notifies the askface manager that image information have been received from the server. More...
 
void loadFace (@NotNull final Face face)
 Request a face.Must eventually call either FaceQueueListener#faceLoaded(Face, FaceImages) or FaceQueueListener#faceFailed(Face) for the face. Faces re-requested while still processing may be notified only once.

Parameters
facethe requested face
More...
 
void reset ()
 Reset the processing: forget about pending faces.This function is called whenever the server socket breaks, or when a new connection has been established. More...
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.faces.AbstractFaceQueue
void addFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener)
 Adds a FaceQueueListener to be notified about processed faces.
Parameters
faceQueueListenerthe listener to add
More...
 
void removeFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener)
 Removes a FaceQueueListener to be notified about processed faces.
Parameters
faceQueueListenerthe listener to remove
More...
 

Private Member Functions

void processFaceData (@NotNull final Face face, @NotNull final byte[] data)
 Processes face information received from the server. More...
 
void sendAskface ()
 Sends some pending "askface" commands. More...
 

Private Attributes

final AskfaceQueue askfaceQueue
 The connection to use. More...
 
final Map< Integer, FacependingAskfaces = new HashMap<>()
 Face numbers for which "askface" commands have been sent without having received a response from the server. More...
 
final Map< Integer, FacependingFaces = new HashMap<>()
 Face numbers for which an "askface" command should be sent. More...
 
final List< FacependingFacesQueue = new LinkedList<>()
 The same elements as pendingFaces in query order. More...
 
final Object sync = new Object()
 The object use for synchronization. More...
 

Static Private Attributes

static final int CONCURRENT_ASKFACE_COMMANDS = 8
 The maximum number of concurrently sent "askface" commands. More...
 

Additional Inherited Members

- Protected Member Functions inherited from com.realtime.crossfire.jxclient.faces.AbstractFaceQueue
void fireFaceFailed (@NotNull final Face face)
 Notify all listener with FaceQueueListener#faceFailed(Face). More...
 
void fireFaceLoaded (@NotNull final Face face, @NotNull final FaceImages faceImages)
 Notify all listener with FaceImages). More...
 

Detailed Description

A FaceQueue requesting faces by "askface" commands sent to the Crossfire server.

Author
Andreas Kirschbaum

Definition at line 37 of file AskfaceFaceQueue.java.

Constructor & Destructor Documentation

◆ AskfaceFaceQueue()

com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.AskfaceFaceQueue ( @NotNull final AskfaceQueue  askfaceQueue)

Creates a new instance.

Parameters
askfaceQueuethe connection instance for sending askface commands

Definition at line 83 of file AskfaceFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.askfaceQueue.

Member Function Documentation

◆ faceReceived()

void com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.faceReceived ( final int  faceNum,
final int  faceSetNum,
@NotNull final ByteBuffer  packet 
)

Notifies the askface manager that image information have been received from the server.

Parameters
faceNumthe face ID
faceSetNumthe face set
packetthe face data

Definition at line 147 of file AskfaceFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.processFaceData(), com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sendAskface(), and com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sync.

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processImage2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFace()

void com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.loadFace ( @NotNull final Face  face)

Request a face.Must eventually call either FaceQueueListener#faceLoaded(Face, FaceImages) or FaceQueueListener#faceFailed(Face) for the face. Faces re-requested while still processing may be notified only once.

Parameters
facethe requested face

Implements com.realtime.crossfire.jxclient.faces.FaceQueue.

Definition at line 103 of file AskfaceFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.AbstractFaceQueue.fireFaceFailed(), com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sendAskface(), and com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sync.

+ Here is the call graph for this function:

◆ processFaceData()

void com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.processFaceData ( @NotNull final Face  face,
@NotNull final byte []  data 
)
private

Processes face information received from the server.

Parameters
facethe face
datathe face information; it is supposed to be a .png file

Definition at line 174 of file AskfaceFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.AbstractFaceQueue.fireFaceFailed(), com.realtime.crossfire.jxclient.faces.AbstractFaceQueue.fireFaceLoaded(), and com.realtime.crossfire.jxclient.faces.FaceImagesUtils.newFaceImages().

Referenced by com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.faceReceived().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

void com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.reset ( )

Reset the processing: forget about pending faces.This function is called whenever the server socket breaks, or when a new connection has been established.

Implements com.realtime.crossfire.jxclient.faces.FaceQueue.

Definition at line 91 of file AskfaceFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sync.

◆ sendAskface()

void com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sendAskface ( )
private

Member Data Documentation

◆ askfaceQueue

final AskfaceQueue com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.askfaceQueue
private

The connection to use.

Definition at line 56 of file AskfaceFaceQueue.java.

Referenced by com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.AskfaceFaceQueue().

◆ CONCURRENT_ASKFACE_COMMANDS

final int com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.CONCURRENT_ASKFACE_COMMANDS = 8
staticprivate

The maximum number of concurrently sent "askface" commands.

If more are requested, the excess ones are put on hold until some face information is received.

Definition at line 44 of file AskfaceFaceQueue.java.

Referenced by com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sendAskface().

◆ pendingAskfaces

final Map<Integer, Face> com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.pendingAskfaces = new HashMap<>()
private

Face numbers for which "askface" commands have been sent without having received a response from the server.

Maps face ID to Face instance.

Definition at line 64 of file AskfaceFaceQueue.java.

◆ pendingFaces

final Map<Integer, Face> com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.pendingFaces = new HashMap<>()
private

Face numbers for which an "askface" command should be sent.

It includes all elements of pendingAskfaces.

Definition at line 71 of file AskfaceFaceQueue.java.

◆ pendingFacesQueue

final List<Face> com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.pendingFacesQueue = new LinkedList<>()
private

The same elements as pendingFaces in query order.

Definition at line 77 of file AskfaceFaceQueue.java.

◆ sync

final Object com.realtime.crossfire.jxclient.faces.AskfaceFaceQueue.sync = new Object()
private

The documentation for this class was generated from the following file: