Package cz.fidentis.analyst.project
Class FacesProxy
java.lang.Object
cz.fidentis.analyst.project.FacesProxy
- Direct Known Subclasses:
FacesProxyDecorator
A proxy over the
HumanFaceFactory
. It handles faces processed by a single analytical task or project.
This class introduces lazy allocation of human faces in addition to automatic memory management provided
by the HumanFaceFactory
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Types of files associated with a single human face -
Constructor Summary
ConstructorsConstructorDescriptionFacesProxy
(File faceFile) Constructor for a single face analysisFacesProxy
(File... faceFiles) Constructor for multiple faces, e.g., 1:N or N:N batch processingFacesProxy
(File priFaceFile, File secFaceFile) Constructor for the analysis of two facesDeserialization constructor.FacesProxy
(List<File> faceFiles) Constructor for multiple faces, e.g., 1:N or N:N batch processing -
Method Summary
Modifier and TypeMethodDescriptionint
Adds a face to the set.boolean
static String
getCanonicalName
(File file) Returns name of the file without appendix and pathgetFace
(int index) Instantiates (if not yet instantiated) and returns a human face.getFaceDir
(int index) Returns path to the face directory ornull
.getFaceFile
(int index) Returns the file of a given face.getFaceFile
(String faceName) Returns the file of a given face.Returns the list of paths to faces.int
getFaceIndex
(String faceName) Returns index of the face described by its canonical name,getFaceName
(int index) Returns short (canonical) name of the face.getFacePath
(int index, FacesProxy.FaceFileType type) Returns path to the given face file ornull
.int
Returns the number of facesInstantiates (if not yet instantiated) and returns the first face from the list of faces.Instantiates (if not yet instantiated) and returns the second face from the list of faces.Returns the task name that encodes names of faces.int
hashCode()
boolean
isInMemory
(int index) Checks whether the face is already loaded in the memory.boolean
removeFace
(String faceName) Removes face from the proxy.void
Serializes current state.
-
Constructor Details
-
FacesProxy
Constructor for multiple faces, e.g., 1:N or N:N batch processing- Parameters:
faceFiles
- faces of the task
-
FacesProxy
Constructor for a single face analysis- Parameters:
faceFile
- face of the task
-
FacesProxy
Constructor for the analysis of two faces- Parameters:
priFaceFile
- primary facesecFaceFile
- secondary face
-
FacesProxy
Constructor for multiple faces, e.g., 1:N or N:N batch processing- Parameters:
faceFiles
- faces of the task
-
FacesProxy
Deserialization constructor. It recovers faces from dump files- Parameters:
in
- Input stream- Throws:
IOException
- on IO errorClassNotFoundException
- of format error
-
-
Method Details
-
serialize
Serializes current state.- Parameters:
out
- Output stream- Throws:
IOException
- on IO error
-
getFaceFiles
Returns the list of paths to faces.- Returns:
- the list of paths to faces.
-
getFaceFile
Returns the file of a given face.- Parameters:
index
- index of the face- Returns:
- the file of a given face or
null
-
getFaceFile
Returns the file of a given face.- Parameters:
faceName
- name of the face- Returns:
- the file of a given face or
null
-
getFace
Instantiates (if not yet instantiated) and returns a human face.- Parameters:
index
- index of the face- Returns:
- human face or
null
-
getFaceIndex
Returns index of the face described by its canonical name,- Parameters:
faceName
- Canonical name of the face- Returns:
- index or -1
-
addFace
Adds a face to the set.- Parameters:
file
- path to the face OBJ fileunique
- Iftrue
, then avoid adding a single face twice- Returns:
- index of the added face, -1 the
file
is null, -2 ifunique
istrue
and the face is already in the set.
-
removeFace
Removes face from the proxy.- Parameters:
faceName
- Canonical name of the face- Returns:
false
of the face does not exist or was not loaded
-
isInMemory
public boolean isInMemory(int index) Checks whether the face is already loaded in the memory.- Parameters:
index
- index of the face- Returns:
true
is the face is loaded.
-
getFaceName
Returns short (canonical) name of the face. In contrast to thegetFace(x).getShortName()
, this method does not need face instance allocated in the memory.- Parameters:
index
- index of the face- Returns:
- short name of the face
-
getFacePath
Returns path to the given face file ornull
.- Parameters:
index
- index of the facetype
- face file type- Returns:
- path or
null
-
getFaceDir
Returns path to the face directory ornull
.- Parameters:
index
- index of the face- Returns:
- path to face folder or
null
-
getPrimaryFace
Instantiates (if not yet instantiated) and returns the first face from the list of faces. The first face is called primary.- Returns:
- the first (primary) face from the list of faces
-
getSecondaryFace
Instantiates (if not yet instantiated) and returns the second face from the list of faces. The second face is called secondary.- Returns:
- the second (secondary) face from the list of faces
-
getNumFaces
public int getNumFaces()Returns the number of faces- Returns:
- the number of faces
-
getTaskName
Returns the task name that encodes names of faces.- Returns:
- a text that encodes names of faces.
-
getCanonicalName
Returns name of the file without appendix and path- Parameters:
file
- path to the file- Returns:
- canonical name
-
equals
-
hashCode
public int hashCode() -
getFactory
-