com.realtime.crossfire.jxclient.faces
Class FacesQueue

java.lang.Object
  extended by com.realtime.crossfire.jxclient.faces.AbstractFaceQueue
      extended by com.realtime.crossfire.jxclient.faces.FacesQueue
All Implemented Interfaces:
FaceQueue

public class FacesQueue
extends AbstractFaceQueue

The main FaceQueue for loading faces. It first delegates to a FileCacheFaceQueue to load the face from the disk cache. If this fails, the face is requested through a AskfaceFaceQueue.


Field Summary
private  AskfaceFaceQueue askfaceFaceQueue
          The AskfaceFaceQueue instance used to query faces from the Crossfire server.
private  FaceQueueListener askfaceFaceQueueListener
          The FaceQueueListener attached to askfaceFaceQueue.
private  FileCacheFaceQueue fileCacheFaceQueue
          The FileCacheFaceQueue instance used to load faces from the file cache.
private  FaceQueueListener fileCacheFaceQueueListener
          The FaceQueueListener attached to fileCacheFaceQueue.
 
Constructor Summary
FacesQueue(CrossfireServerConnection crossfireServerConnection, ImageCache imageCacheOriginal, ImageCache imageCacheScaled, ImageCache imageCacheMagicMap)
          Creates a new instance.
 
Method Summary
 AskfaceFaceQueue getAskfaceQueue()
          Returns the AskfaceFaceQueue instance.
 void loadFace(Face face)
          Request a face.
 void reset()
          Reset the processing: forget about pending faces.
 
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

askfaceFaceQueue

@NotNull
private final AskfaceFaceQueue askfaceFaceQueue
The AskfaceFaceQueue instance used to query faces from the Crossfire server.


askfaceFaceQueueListener

@NotNull
private final FaceQueueListener askfaceFaceQueueListener
The FaceQueueListener attached to askfaceFaceQueue.


fileCacheFaceQueue

@NotNull
private final FileCacheFaceQueue fileCacheFaceQueue
The FileCacheFaceQueue instance used to load faces from the file cache.


fileCacheFaceQueueListener

@NotNull
private final FaceQueueListener fileCacheFaceQueueListener
The FaceQueueListener attached to fileCacheFaceQueue.

Constructor Detail

FacesQueue

public FacesQueue(@Nullable
                  CrossfireServerConnection crossfireServerConnection,
                  @NotNull
                  ImageCache imageCacheOriginal,
                  @NotNull
                  ImageCache imageCacheScaled,
                  @NotNull
                  ImageCache imageCacheMagicMap)
Creates a new instance.

Parameters:
crossfireServerConnection - the server connection for sending askface commands
imageCacheOriginal - the image cache used for loading original image files
imageCacheScaled - the image cache used for loading scaled image files
imageCacheMagicMap - the image cache used for loading magic map image files
Method Detail

getAskfaceQueue

@NotNull
public AskfaceFaceQueue getAskfaceQueue()
Returns the AskfaceFaceQueue instance.

Returns:
the askface queue

loadFace

public void loadFace(@NotNull
                     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:
face - the requested face

reset

public 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.