/* * 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; /** *

* Information about a label detected in a video analysis request and the time * the label was detected in the video. *

*/ public class LabelDetection implements Serializable { /** *

* Time, in milliseconds from the start of the video, that the label was * detected. Note that Timestamp is not guaranteed to be * accurate to the individual frame where the label first appears. *

*/ private Long timestamp; /** *

* Details about the detected label. *

*/ private Label label; /** *

* The time in milliseconds defining the start of the timeline segment * containing a continuously detected label. *

*

* Constraints:
* Range: 0 -
*/ private Long startTimestampMillis; /** *

* The time in milliseconds defining the end of the timeline segment * containing a continuously detected label. *

*

* Constraints:
* Range: 0 -
*/ private Long endTimestampMillis; /** *

* The time duration of a segment in milliseconds, I.e. time elapsed from * StartTimestampMillis to EndTimestampMillis. *

*

* Constraints:
* Range: 0 -
*/ private Long durationMillis; /** *

* Time, in milliseconds from the start of the video, that the label was * detected. Note that Timestamp is not guaranteed to be * accurate to the individual frame where the label first appears. *

* * @return

* Time, in milliseconds from the start of the video, that the label * was detected. Note that Timestamp is not guaranteed * to be accurate to the individual frame where the label first * appears. *

*/ public Long getTimestamp() { return timestamp; } /** *

* Time, in milliseconds from the start of the video, that the label was * detected. Note that Timestamp is not guaranteed to be * accurate to the individual frame where the label first appears. *

* * @param timestamp

* Time, in milliseconds from the start of the video, that the * label was detected. Note that Timestamp is not * guaranteed to be accurate to the individual frame where the * label first appears. *

*/ public void setTimestamp(Long timestamp) { this.timestamp = timestamp; } /** *

* Time, in milliseconds from the start of the video, that the label was * detected. Note that Timestamp is not guaranteed to be * accurate to the individual frame where the label first appears. *

*

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

* Time, in milliseconds from the start of the video, that the * label was detected. Note that Timestamp is not * guaranteed to be accurate to the individual frame where the * label first appears. *

* @return A reference to this updated object so that method calls can be * chained together. */ public LabelDetection withTimestamp(Long timestamp) { this.timestamp = timestamp; return this; } /** *

* Details about the detected label. *

* * @return

* Details about the detected label. *

*/ public Label getLabel() { return label; } /** *

* Details about the detected label. *

* * @param label

* Details about the detected label. *

*/ public void setLabel(Label label) { this.label = label; } /** *

* Details about the detected label. *

*

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

* Details about the detected label. *

* @return A reference to this updated object so that method calls can be * chained together. */ public LabelDetection withLabel(Label label) { this.label = label; return this; } /** *

* The time in milliseconds defining the start of the timeline segment * containing a continuously detected label. *

*

* Constraints:
* Range: 0 -
* * @return

* The time in milliseconds defining the start of the timeline * segment containing a continuously detected label. *

*/ public Long getStartTimestampMillis() { return startTimestampMillis; } /** *

* The time in milliseconds defining the start of the timeline segment * containing a continuously detected label. *

*

* Constraints:
* Range: 0 -
* * @param startTimestampMillis

* The time in milliseconds defining the start of the timeline * segment containing a continuously detected label. *

*/ public void setStartTimestampMillis(Long startTimestampMillis) { this.startTimestampMillis = startTimestampMillis; } /** *

* The time in milliseconds defining the start of the timeline segment * containing a continuously detected label. *

*

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

* Constraints:
* Range: 0 -
* * @param startTimestampMillis

* The time in milliseconds defining the start of the timeline * segment containing a continuously detected label. *

* @return A reference to this updated object so that method calls can be * chained together. */ public LabelDetection withStartTimestampMillis(Long startTimestampMillis) { this.startTimestampMillis = startTimestampMillis; return this; } /** *

* The time in milliseconds defining the end of the timeline segment * containing a continuously detected label. *

*

* Constraints:
* Range: 0 -
* * @return

* The time in milliseconds defining the end of the timeline segment * containing a continuously detected label. *

*/ public Long getEndTimestampMillis() { return endTimestampMillis; } /** *

* The time in milliseconds defining the end of the timeline segment * containing a continuously detected label. *

*

* Constraints:
* Range: 0 -
* * @param endTimestampMillis

* The time in milliseconds defining the end of the timeline * segment containing a continuously detected label. *

*/ public void setEndTimestampMillis(Long endTimestampMillis) { this.endTimestampMillis = endTimestampMillis; } /** *

* The time in milliseconds defining the end of the timeline segment * containing a continuously detected label. *

*

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

* Constraints:
* Range: 0 -
* * @param endTimestampMillis

* The time in milliseconds defining the end of the timeline * segment containing a continuously detected label. *

* @return A reference to this updated object so that method calls can be * chained together. */ public LabelDetection withEndTimestampMillis(Long endTimestampMillis) { this.endTimestampMillis = endTimestampMillis; return this; } /** *

* The time duration of a segment in milliseconds, I.e. time elapsed from * StartTimestampMillis to EndTimestampMillis. *

*

* Constraints:
* Range: 0 -
* * @return

* The time duration of a segment in milliseconds, I.e. time elapsed * from StartTimestampMillis to EndTimestampMillis. *

*/ public Long getDurationMillis() { return durationMillis; } /** *

* The time duration of a segment in milliseconds, I.e. time elapsed from * StartTimestampMillis to EndTimestampMillis. *

*

* Constraints:
* Range: 0 -
* * @param durationMillis

* The time duration of a segment in milliseconds, I.e. time * elapsed from StartTimestampMillis to EndTimestampMillis. *

*/ public void setDurationMillis(Long durationMillis) { this.durationMillis = durationMillis; } /** *

* The time duration of a segment in milliseconds, I.e. time elapsed from * StartTimestampMillis to EndTimestampMillis. *

*

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

* Constraints:
* Range: 0 -
* * @param durationMillis

* The time duration of a segment in milliseconds, I.e. time * elapsed from StartTimestampMillis to EndTimestampMillis. *

* @return A reference to this updated object so that method calls can be * chained together. */ public LabelDetection withDurationMillis(Long durationMillis) { this.durationMillis = durationMillis; 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 (getTimestamp() != null) sb.append("Timestamp: " + getTimestamp() + ","); if (getLabel() != null) sb.append("Label: " + getLabel() + ","); if (getStartTimestampMillis() != null) sb.append("StartTimestampMillis: " + getStartTimestampMillis() + ","); if (getEndTimestampMillis() != null) sb.append("EndTimestampMillis: " + getEndTimestampMillis() + ","); if (getDurationMillis() != null) sb.append("DurationMillis: " + getDurationMillis()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode()); hashCode = prime * hashCode + ((getLabel() == null) ? 0 : getLabel().hashCode()); hashCode = prime * hashCode + ((getStartTimestampMillis() == null) ? 0 : getStartTimestampMillis().hashCode()); hashCode = prime * hashCode + ((getEndTimestampMillis() == null) ? 0 : getEndTimestampMillis().hashCode()); hashCode = prime * hashCode + ((getDurationMillis() == null) ? 0 : getDurationMillis().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof LabelDetection == false) return false; LabelDetection other = (LabelDetection) obj; if (other.getTimestamp() == null ^ this.getTimestamp() == null) return false; if (other.getTimestamp() != null && other.getTimestamp().equals(this.getTimestamp()) == false) return false; if (other.getLabel() == null ^ this.getLabel() == null) return false; if (other.getLabel() != null && other.getLabel().equals(this.getLabel()) == false) return false; if (other.getStartTimestampMillis() == null ^ this.getStartTimestampMillis() == null) return false; if (other.getStartTimestampMillis() != null && other.getStartTimestampMillis().equals(this.getStartTimestampMillis()) == false) return false; if (other.getEndTimestampMillis() == null ^ this.getEndTimestampMillis() == null) return false; if (other.getEndTimestampMillis() != null && other.getEndTimestampMillis().equals(this.getEndTimestampMillis()) == false) return false; if (other.getDurationMillis() == null ^ this.getDurationMillis() == null) return false; if (other.getDurationMillis() != null && other.getDurationMillis().equals(this.getDurationMillis()) == false) return false; return true; } }