/* * 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.geo.model; import java.io.Serializable; /** *

* Represents an element of a leg within a route. A step contains instructions * for how to move to the next step in the leg. *

*/ public class Step implements Serializable { /** *

* The travel distance between the step's StartPosition and * EndPosition. *

*

* Constraints:
* Range: 0.0 -
*/ private Double distance; /** *

* The estimated travel time, in seconds, from the step's * StartPosition to the EndPosition. . The travel * mode and departure time that you specify in the request determines the * calculated time. *

*

* Constraints:
* Range: 0.0 -
*/ private Double durationSeconds; /** *

* The end position of a step. If the position the last step in the leg, * this position is the same as the end position of the leg. *

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

* Represents the start position, or index, in a sequence of steps within * the leg's line string geometry. For example, the index of the first step * in a leg geometry is 0. *

*

* Included in the response for queries that set * IncludeLegGeometry to True. *

*

* Constraints:
* Range: 0 -
*/ private Integer geometryOffset; /** *

* The starting position of a step. If the position is the first step in the * leg, this position is the same as the start position of the leg. *

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

* The travel distance between the step's StartPosition and * EndPosition. *

*

* Constraints:
* Range: 0.0 -
* * @return

* The travel distance between the step's StartPosition * and EndPosition. *

*/ public Double getDistance() { return distance; } /** *

* The travel distance between the step's StartPosition and * EndPosition. *

*

* Constraints:
* Range: 0.0 -
* * @param distance

* The travel distance between the step's * StartPosition and EndPosition. *

*/ public void setDistance(Double distance) { this.distance = distance; } /** *

* The travel distance between the step's StartPosition and * EndPosition. *

*

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

* Constraints:
* Range: 0.0 -
* * @param distance

* The travel distance between the step's * StartPosition and EndPosition. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Step withDistance(Double distance) { this.distance = distance; return this; } /** *

* The estimated travel time, in seconds, from the step's * StartPosition to the EndPosition. . The travel * mode and departure time that you specify in the request determines the * calculated time. *

*

* Constraints:
* Range: 0.0 -
* * @return

* The estimated travel time, in seconds, from the step's * StartPosition to the EndPosition. . The * travel mode and departure time that you specify in the request * determines the calculated time. *

*/ public Double getDurationSeconds() { return durationSeconds; } /** *

* The estimated travel time, in seconds, from the step's * StartPosition to the EndPosition. . The travel * mode and departure time that you specify in the request determines the * calculated time. *

*

* Constraints:
* Range: 0.0 -
* * @param durationSeconds

* The estimated travel time, in seconds, from the step's * StartPosition to the EndPosition. . * The travel mode and departure time that you specify in the * request determines the calculated time. *

*/ public void setDurationSeconds(Double durationSeconds) { this.durationSeconds = durationSeconds; } /** *

* The estimated travel time, in seconds, from the step's * StartPosition to the EndPosition. . The travel * mode and departure time that you specify in the request determines the * calculated time. *

*

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

* Constraints:
* Range: 0.0 -
* * @param durationSeconds

* The estimated travel time, in seconds, from the step's * StartPosition to the EndPosition. . * The travel mode and departure time that you specify in the * request determines the calculated time. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Step withDurationSeconds(Double durationSeconds) { this.durationSeconds = durationSeconds; return this; } /** *

* The end position of a step. If the position the last step in the leg, * this position is the same as the end position of the leg. *

* * @return

* The end position of a step. If the position the last step in the * leg, this position is the same as the end position of the leg. *

*/ public java.util.List getEndPosition() { return endPosition; } /** *

* The end position of a step. If the position the last step in the leg, * this position is the same as the end position of the leg. *

* * @param endPosition

* The end position of a step. If the position the last step in * the leg, this position is the same as the end position of the * leg. *

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

* The end position of a step. If the position the last step in the leg, * this position is the same as the end position of the leg. *

*

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

* The end position of a step. If the position the last step in * the leg, this position is the same as the end position of the * leg. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Step withEndPosition(Double... endPosition) { if (getEndPosition() == null) { this.endPosition = new java.util.ArrayList(endPosition.length); } for (Double value : endPosition) { this.endPosition.add(value); } return this; } /** *

* The end position of a step. If the position the last step in the leg, * this position is the same as the end position of the leg. *

*

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

* The end position of a step. If the position the last step in * the leg, this position is the same as the end position of the * leg. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Step withEndPosition(java.util.Collection endPosition) { setEndPosition(endPosition); return this; } /** *

* Represents the start position, or index, in a sequence of steps within * the leg's line string geometry. For example, the index of the first step * in a leg geometry is 0. *

*

* Included in the response for queries that set * IncludeLegGeometry to True. *

*

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

* Represents the start position, or index, in a sequence of steps * within the leg's line string geometry. For example, the index of * the first step in a leg geometry is 0. *

*

* Included in the response for queries that set * IncludeLegGeometry to True. *

*/ public Integer getGeometryOffset() { return geometryOffset; } /** *

* Represents the start position, or index, in a sequence of steps within * the leg's line string geometry. For example, the index of the first step * in a leg geometry is 0. *

*

* Included in the response for queries that set * IncludeLegGeometry to True. *

*

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

* Represents the start position, or index, in a sequence of * steps within the leg's line string geometry. For example, the * index of the first step in a leg geometry is 0. *

*

* Included in the response for queries that set * IncludeLegGeometry to True. *

*/ public void setGeometryOffset(Integer geometryOffset) { this.geometryOffset = geometryOffset; } /** *

* Represents the start position, or index, in a sequence of steps within * the leg's line string geometry. For example, the index of the first step * in a leg geometry is 0. *

*

* Included in the response for queries that set * IncludeLegGeometry to True. *

*

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

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

* Represents the start position, or index, in a sequence of * steps within the leg's line string geometry. For example, the * index of the first step in a leg geometry is 0. *

*

* Included in the response for queries that set * IncludeLegGeometry to True. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Step withGeometryOffset(Integer geometryOffset) { this.geometryOffset = geometryOffset; return this; } /** *

* The starting position of a step. If the position is the first step in the * leg, this position is the same as the start position of the leg. *

* * @return

* The starting position of a step. If the position is the first * step in the leg, this position is the same as the start position * of the leg. *

*/ public java.util.List getStartPosition() { return startPosition; } /** *

* The starting position of a step. If the position is the first step in the * leg, this position is the same as the start position of the leg. *

* * @param startPosition

* The starting position of a step. If the position is the first * step in the leg, this position is the same as the start * position of the leg. *

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

* The starting position of a step. If the position is the first step in the * leg, this position is the same as the start position of the leg. *

*

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

* The starting position of a step. If the position is the first * step in the leg, this position is the same as the start * position of the leg. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Step withStartPosition(Double... startPosition) { if (getStartPosition() == null) { this.startPosition = new java.util.ArrayList(startPosition.length); } for (Double value : startPosition) { this.startPosition.add(value); } return this; } /** *

* The starting position of a step. If the position is the first step in the * leg, this position is the same as the start position of the leg. *

*

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

* The starting position of a step. If the position is the first * step in the leg, this position is the same as the start * position of the leg. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Step withStartPosition(java.util.Collection startPosition) { setStartPosition(startPosition); 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 (getDistance() != null) sb.append("Distance: " + getDistance() + ","); if (getDurationSeconds() != null) sb.append("DurationSeconds: " + getDurationSeconds() + ","); if (getEndPosition() != null) sb.append("EndPosition: " + getEndPosition() + ","); if (getGeometryOffset() != null) sb.append("GeometryOffset: " + getGeometryOffset() + ","); if (getStartPosition() != null) sb.append("StartPosition: " + getStartPosition()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDistance() == null) ? 0 : getDistance().hashCode()); hashCode = prime * hashCode + ((getDurationSeconds() == null) ? 0 : getDurationSeconds().hashCode()); hashCode = prime * hashCode + ((getEndPosition() == null) ? 0 : getEndPosition().hashCode()); hashCode = prime * hashCode + ((getGeometryOffset() == null) ? 0 : getGeometryOffset().hashCode()); hashCode = prime * hashCode + ((getStartPosition() == null) ? 0 : getStartPosition().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Step == false) return false; Step other = (Step) obj; if (other.getDistance() == null ^ this.getDistance() == null) return false; if (other.getDistance() != null && other.getDistance().equals(this.getDistance()) == false) return false; if (other.getDurationSeconds() == null ^ this.getDurationSeconds() == null) return false; if (other.getDurationSeconds() != null && other.getDurationSeconds().equals(this.getDurationSeconds()) == false) return false; if (other.getEndPosition() == null ^ this.getEndPosition() == null) return false; if (other.getEndPosition() != null && other.getEndPosition().equals(this.getEndPosition()) == false) return false; if (other.getGeometryOffset() == null ^ this.getGeometryOffset() == null) return false; if (other.getGeometryOffset() != null && other.getGeometryOffset().equals(this.getGeometryOffset()) == false) return false; if (other.getStartPosition() == null ^ this.getStartPosition() == null) return false; if (other.getStartPosition() != null && other.getStartPosition().equals(this.getStartPosition()) == false) return false; return true; } }