/* * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.rekognition.model; import java.io.Serializable; /** *

* Provides face metadata for target image faces that are analyzed by * CompareFaces and RecognizeCelebrities. *

*/ public class ComparedFace implements Serializable { /** *

* Bounding box of the face. *

*/ private BoundingBox boundingBox; /** *

* Level of confidence that what the bounding box contains is a face. *

*

* Constraints:
* Length: 0.0 - 100.0
*/ private Float confidence; /** *

* An array of facial landmarks. *

*/ private java.util.List landmarks; /** *

* Indicates the pose of the face as determined by its pitch, roll, and yaw. *

*/ private Pose pose; /** *

* Identifies face image brightness and sharpness. *

*/ private ImageQuality quality; /** *

* The emotions that appear to be expressed on the face, and the confidence * level in the determination. Valid values include "Happy", "Sad", "Angry", * "Confused", "Disgusted", "Surprised", "Calm", "Unknown", and "Fear". *

*/ private java.util.List emotions; /** *

* Indicates whether or not the face is smiling, and the confidence level in * the determination. *

*/ private Smile smile; /** *

* Bounding box of the face. *

* * @return

* Bounding box of the face. *

*/ public BoundingBox getBoundingBox() { return boundingBox; } /** *

* Bounding box of the face. *

* * @param boundingBox

* Bounding box of the face. *

*/ public void setBoundingBox(BoundingBox boundingBox) { this.boundingBox = boundingBox; } /** *

* Bounding box of the face. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param boundingBox

* Bounding box of the face. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withBoundingBox(BoundingBox boundingBox) { this.boundingBox = boundingBox; return this; } /** *

* Level of confidence that what the bounding box contains is a face. *

*

* Constraints:
* Length: 0.0 - 100.0
* * @return

* Level of confidence that what the bounding box contains is a * face. *

*/ public Float getConfidence() { return confidence; } /** *

* Level of confidence that what the bounding box contains is a face. *

*

* Constraints:
* Length: 0.0 - 100.0
* * @param confidence

* Level of confidence that what the bounding box contains is a * face. *

*/ public void setConfidence(Float confidence) { this.confidence = confidence; } /** *

* Level of confidence that what the bounding box contains is a face. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0.0 - 100.0
* * @param confidence

* Level of confidence that what the bounding box contains is a * face. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withConfidence(Float confidence) { this.confidence = confidence; return this; } /** *

* An array of facial landmarks. *

* * @return

* An array of facial landmarks. *

*/ public java.util.List getLandmarks() { return landmarks; } /** *

* An array of facial landmarks. *

* * @param landmarks

* An array of facial landmarks. *

*/ public void setLandmarks(java.util.Collection landmarks) { if (landmarks == null) { this.landmarks = null; return; } this.landmarks = new java.util.ArrayList(landmarks); } /** *

* An array of facial landmarks. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param landmarks

* An array of facial landmarks. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withLandmarks(Landmark... landmarks) { if (getLandmarks() == null) { this.landmarks = new java.util.ArrayList(landmarks.length); } for (Landmark value : landmarks) { this.landmarks.add(value); } return this; } /** *

* An array of facial landmarks. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param landmarks

* An array of facial landmarks. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withLandmarks(java.util.Collection landmarks) { setLandmarks(landmarks); return this; } /** *

* Indicates the pose of the face as determined by its pitch, roll, and yaw. *

* * @return

* Indicates the pose of the face as determined by its pitch, roll, * and yaw. *

*/ public Pose getPose() { return pose; } /** *

* Indicates the pose of the face as determined by its pitch, roll, and yaw. *

* * @param pose

* Indicates the pose of the face as determined by its pitch, * roll, and yaw. *

*/ public void setPose(Pose pose) { this.pose = pose; } /** *

* Indicates the pose of the face as determined by its pitch, roll, and yaw. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param pose

* Indicates the pose of the face as determined by its pitch, * roll, and yaw. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withPose(Pose pose) { this.pose = pose; return this; } /** *

* Identifies face image brightness and sharpness. *

* * @return

* Identifies face image brightness and sharpness. *

*/ public ImageQuality getQuality() { return quality; } /** *

* Identifies face image brightness and sharpness. *

* * @param quality

* Identifies face image brightness and sharpness. *

*/ public void setQuality(ImageQuality quality) { this.quality = quality; } /** *

* Identifies face image brightness and sharpness. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param quality

* Identifies face image brightness and sharpness. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withQuality(ImageQuality quality) { this.quality = quality; return this; } /** *

* The emotions that appear to be expressed on the face, and the confidence * level in the determination. Valid values include "Happy", "Sad", "Angry", * "Confused", "Disgusted", "Surprised", "Calm", "Unknown", and "Fear". *

* * @return

* The emotions that appear to be expressed on the face, and the * confidence level in the determination. Valid values include * "Happy", "Sad", "Angry", "Confused", "Disgusted", "Surprised", * "Calm", "Unknown", and "Fear". *

*/ public java.util.List getEmotions() { return emotions; } /** *

* The emotions that appear to be expressed on the face, and the confidence * level in the determination. Valid values include "Happy", "Sad", "Angry", * "Confused", "Disgusted", "Surprised", "Calm", "Unknown", and "Fear". *

* * @param emotions

* The emotions that appear to be expressed on the face, and the * confidence level in the determination. Valid values include * "Happy", "Sad", "Angry", "Confused", "Disgusted", "Surprised", * "Calm", "Unknown", and "Fear". *

*/ public void setEmotions(java.util.Collection emotions) { if (emotions == null) { this.emotions = null; return; } this.emotions = new java.util.ArrayList(emotions); } /** *

* The emotions that appear to be expressed on the face, and the confidence * level in the determination. Valid values include "Happy", "Sad", "Angry", * "Confused", "Disgusted", "Surprised", "Calm", "Unknown", and "Fear". *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param emotions

* The emotions that appear to be expressed on the face, and the * confidence level in the determination. Valid values include * "Happy", "Sad", "Angry", "Confused", "Disgusted", "Surprised", * "Calm", "Unknown", and "Fear". *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withEmotions(Emotion... emotions) { if (getEmotions() == null) { this.emotions = new java.util.ArrayList(emotions.length); } for (Emotion value : emotions) { this.emotions.add(value); } return this; } /** *

* The emotions that appear to be expressed on the face, and the confidence * level in the determination. Valid values include "Happy", "Sad", "Angry", * "Confused", "Disgusted", "Surprised", "Calm", "Unknown", and "Fear". *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param emotions

* The emotions that appear to be expressed on the face, and the * confidence level in the determination. Valid values include * "Happy", "Sad", "Angry", "Confused", "Disgusted", "Surprised", * "Calm", "Unknown", and "Fear". *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withEmotions(java.util.Collection emotions) { setEmotions(emotions); return this; } /** *

* Indicates whether or not the face is smiling, and the confidence level in * the determination. *

* * @return

* Indicates whether or not the face is smiling, and the confidence * level in the determination. *

*/ public Smile getSmile() { return smile; } /** *

* Indicates whether or not the face is smiling, and the confidence level in * the determination. *

* * @param smile

* Indicates whether or not the face is smiling, and the * confidence level in the determination. *

*/ public void setSmile(Smile smile) { this.smile = smile; } /** *

* Indicates whether or not the face is smiling, and the confidence level in * the determination. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param smile

* Indicates whether or not the face is smiling, and the * confidence level in the determination. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ComparedFace withSmile(Smile smile) { this.smile = smile; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getBoundingBox() != null) sb.append("BoundingBox: " + getBoundingBox() + ","); if (getConfidence() != null) sb.append("Confidence: " + getConfidence() + ","); if (getLandmarks() != null) sb.append("Landmarks: " + getLandmarks() + ","); if (getPose() != null) sb.append("Pose: " + getPose() + ","); if (getQuality() != null) sb.append("Quality: " + getQuality() + ","); if (getEmotions() != null) sb.append("Emotions: " + getEmotions() + ","); if (getSmile() != null) sb.append("Smile: " + getSmile()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getBoundingBox() == null) ? 0 : getBoundingBox().hashCode()); hashCode = prime * hashCode + ((getConfidence() == null) ? 0 : getConfidence().hashCode()); hashCode = prime * hashCode + ((getLandmarks() == null) ? 0 : getLandmarks().hashCode()); hashCode = prime * hashCode + ((getPose() == null) ? 0 : getPose().hashCode()); hashCode = prime * hashCode + ((getQuality() == null) ? 0 : getQuality().hashCode()); hashCode = prime * hashCode + ((getEmotions() == null) ? 0 : getEmotions().hashCode()); hashCode = prime * hashCode + ((getSmile() == null) ? 0 : getSmile().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ComparedFace == false) return false; ComparedFace other = (ComparedFace) obj; if (other.getBoundingBox() == null ^ this.getBoundingBox() == null) return false; if (other.getBoundingBox() != null && other.getBoundingBox().equals(this.getBoundingBox()) == false) return false; if (other.getConfidence() == null ^ this.getConfidence() == null) return false; if (other.getConfidence() != null && other.getConfidence().equals(this.getConfidence()) == false) return false; if (other.getLandmarks() == null ^ this.getLandmarks() == null) return false; if (other.getLandmarks() != null && other.getLandmarks().equals(this.getLandmarks()) == false) return false; if (other.getPose() == null ^ this.getPose() == null) return false; if (other.getPose() != null && other.getPose().equals(this.getPose()) == false) return false; if (other.getQuality() == null ^ this.getQuality() == null) return false; if (other.getQuality() != null && other.getQuality().equals(this.getQuality()) == false) return false; if (other.getEmotions() == null ^ this.getEmotions() == null) return false; if (other.getEmotions() != null && other.getEmotions().equals(this.getEmotions()) == false) return false; if (other.getSmile() == null ^ this.getSmile() == null) return false; if (other.getSmile() != null && other.getSmile().equals(this.getSmile()) == false) return false; return true; } }