All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.location.model.Leg Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Location module holds the client classes that are used for communicating with Amazon Location Service

There is a newer version: 1.12.780
Show newest version
/*
 * Copyright 2019-2024 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.location.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* Contains the calculated route's details for each path between a pair of positions. The number of legs returned * corresponds to one fewer than the total number of positions in the request. *

*

* For example, a route with a departure position and destination position returns one leg with the positions snapped to a nearby * road: *

*
    *
  • *

    * The StartPosition is the departure position. *

    *
  • *
  • *

    * The EndPosition is the destination position. *

    *
  • *
*

* A route with a waypoint between the departure and destination position returns two legs with the positions snapped to * a nearby road: *

*
    *
  • *

    * Leg 1: The StartPosition is the departure position . The EndPosition is the waypoint * positon. *

    *
  • *
  • *

    * Leg 2: The StartPosition is the waypoint position. The EndPosition is the destination * position. *

    *
  • *
* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Leg implements Serializable, Cloneable, StructuredPojo { /** *

* The starting position of the leg. Follows the format [longitude,latitude]. *

* *

* If the StartPosition isn't located on a road, it's snapped to a nearby * road. *

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

* The terminating position of the leg. Follows the format [longitude,latitude]. *

* *

* If the EndPosition isn't located on a road, it's snapped to a nearby * road. *

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

* The distance between the leg's StartPosition and EndPosition along a calculated route. *

*
    *
  • *

    * The default measurement is Kilometers unless the request specifies a DistanceUnit of * Miles. *

    *
  • *
*/ private Double distance; /** *

* The estimated travel time between the leg's StartPosition and EndPosition. The travel * mode and departure time that you specify in the request determines the calculated time. *

*/ private Double durationSeconds; /** *

* Contains the calculated route's path as a linestring geometry. *

*/ private LegGeometry geometry; /** *

* Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move * to the next step in the leg such as the step's start position, end position, travel distance, travel duration, * and geometry offset. *

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

* The starting position of the leg. Follows the format [longitude,latitude]. *

* *

* If the StartPosition isn't located on a road, it's snapped to a nearby * road. *

*
* * @return The starting position of the leg. Follows the format [longitude,latitude].

*

* If the StartPosition isn't located on a road, it's snapped to a * nearby road. *

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

* The starting position of the leg. Follows the format [longitude,latitude]. *

* *

* If the StartPosition isn't located on a road, it's snapped to a nearby * road. *

*
* * @param startPosition * The starting position of the leg. Follows the format [longitude,latitude].

*

* If the StartPosition isn't located on a road, it's snapped to a * nearby road. *

*/ 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 the leg. Follows the format [longitude,latitude]. *

* *

* If the StartPosition isn't located on a road, it's snapped to a nearby * road. *

*
*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setStartPosition(java.util.Collection)} or {@link #withStartPosition(java.util.Collection)} if you want * to override the existing values. *

* * @param startPosition * The starting position of the leg. Follows the format [longitude,latitude].

*

* If the StartPosition isn't located on a road, it's snapped to a * nearby road. *

* @return Returns a reference to this object so that method calls can be chained together. */ public Leg withStartPosition(Double... startPosition) { if (this.startPosition == null) { setStartPosition(new java.util.ArrayList(startPosition.length)); } for (Double ele : startPosition) { this.startPosition.add(ele); } return this; } /** *

* The starting position of the leg. Follows the format [longitude,latitude]. *

* *

* If the StartPosition isn't located on a road, it's snapped to a nearby * road. *

*
* * @param startPosition * The starting position of the leg. Follows the format [longitude,latitude].

*

* If the StartPosition isn't located on a road, it's snapped to a * nearby road. *

* @return Returns a reference to this object so that method calls can be chained together. */ public Leg withStartPosition(java.util.Collection startPosition) { setStartPosition(startPosition); return this; } /** *

* The terminating position of the leg. Follows the format [longitude,latitude]. *

* *

* If the EndPosition isn't located on a road, it's snapped to a nearby * road. *

*
* * @return The terminating position of the leg. Follows the format [longitude,latitude].

*

* If the EndPosition isn't located on a road, it's snapped to a * nearby road. *

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

* The terminating position of the leg. Follows the format [longitude,latitude]. *

* *

* If the EndPosition isn't located on a road, it's snapped to a nearby * road. *

*
* * @param endPosition * The terminating position of the leg. Follows the format [longitude,latitude].

*

* If the EndPosition isn't located on a road, it's snapped to a * nearby road. *

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

* The terminating position of the leg. Follows the format [longitude,latitude]. *

* *

* If the EndPosition isn't located on a road, it's snapped to a nearby * road. *

*
*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setEndPosition(java.util.Collection)} or {@link #withEndPosition(java.util.Collection)} if you want to * override the existing values. *

* * @param endPosition * The terminating position of the leg. Follows the format [longitude,latitude].

*

* If the EndPosition isn't located on a road, it's snapped to a * nearby road. *

* @return Returns a reference to this object so that method calls can be chained together. */ public Leg withEndPosition(Double... endPosition) { if (this.endPosition == null) { setEndPosition(new java.util.ArrayList(endPosition.length)); } for (Double ele : endPosition) { this.endPosition.add(ele); } return this; } /** *

* The terminating position of the leg. Follows the format [longitude,latitude]. *

* *

* If the EndPosition isn't located on a road, it's snapped to a nearby * road. *

*
* * @param endPosition * The terminating position of the leg. Follows the format [longitude,latitude].

*

* If the EndPosition isn't located on a road, it's snapped to a * nearby road. *

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

* The distance between the leg's StartPosition and EndPosition along a calculated route. *

*
    *
  • *

    * The default measurement is Kilometers unless the request specifies a DistanceUnit of * Miles. *

    *
  • *
* * @param distance * The distance between the leg's StartPosition and EndPosition along a calculated * route.

*
    *
  • *

    * The default measurement is Kilometers unless the request specifies a * DistanceUnit of Miles. *

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

    * The distance between the leg's StartPosition and EndPosition along a calculated route. *

    *
      *
    • *

      * The default measurement is Kilometers unless the request specifies a DistanceUnit of * Miles. *

      *
    • *
    * * @return The distance between the leg's StartPosition and EndPosition along a calculated * route.

    *
      *
    • *

      * The default measurement is Kilometers unless the request specifies a * DistanceUnit of Miles. *

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

      * The distance between the leg's StartPosition and EndPosition along a calculated route. *

      *
        *
      • *

        * The default measurement is Kilometers unless the request specifies a DistanceUnit of * Miles. *

        *
      • *
      * * @param distance * The distance between the leg's StartPosition and EndPosition along a calculated * route.

      *
        *
      • *

        * The default measurement is Kilometers unless the request specifies a * DistanceUnit of Miles. *

        *
      • * @return Returns a reference to this object so that method calls can be chained together. */ public Leg withDistance(Double distance) { setDistance(distance); return this; } /** *

        * The estimated travel time between the leg's StartPosition and EndPosition. The travel * mode and departure time that you specify in the request determines the calculated time. *

        * * @param durationSeconds * The estimated travel time between the leg's StartPosition and 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 between the leg's StartPosition and EndPosition. The travel * mode and departure time that you specify in the request determines the calculated time. *

        * * @return The estimated travel time between the leg's StartPosition and EndPosition. The * travel mode and departure time that you specify in the request determines the calculated time. */ public Double getDurationSeconds() { return this.durationSeconds; } /** *

        * The estimated travel time between the leg's StartPosition and EndPosition. The travel * mode and departure time that you specify in the request determines the calculated time. *

        * * @param durationSeconds * The estimated travel time between the leg's StartPosition and EndPosition. The * travel mode and departure time that you specify in the request determines the calculated time. * @return Returns a reference to this object so that method calls can be chained together. */ public Leg withDurationSeconds(Double durationSeconds) { setDurationSeconds(durationSeconds); return this; } /** *

        * Contains the calculated route's path as a linestring geometry. *

        * * @param geometry * Contains the calculated route's path as a linestring geometry. */ public void setGeometry(LegGeometry geometry) { this.geometry = geometry; } /** *

        * Contains the calculated route's path as a linestring geometry. *

        * * @return Contains the calculated route's path as a linestring geometry. */ public LegGeometry getGeometry() { return this.geometry; } /** *

        * Contains the calculated route's path as a linestring geometry. *

        * * @param geometry * Contains the calculated route's path as a linestring geometry. * @return Returns a reference to this object so that method calls can be chained together. */ public Leg withGeometry(LegGeometry geometry) { setGeometry(geometry); return this; } /** *

        * Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move * to the next step in the leg such as the step's start position, end position, travel distance, travel duration, * and geometry offset. *

        * * @return Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how * to move to the next step in the leg such as the step's start position, end position, travel distance, * travel duration, and geometry offset. */ public java.util.List getSteps() { return steps; } /** *

        * Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move * to the next step in the leg such as the step's start position, end position, travel distance, travel duration, * and geometry offset. *

        * * @param steps * Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to * move to the next step in the leg such as the step's start position, end position, travel distance, travel * duration, and geometry offset. */ public void setSteps(java.util.Collection steps) { if (steps == null) { this.steps = null; return; } this.steps = new java.util.ArrayList(steps); } /** *

        * Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move * to the next step in the leg such as the step's start position, end position, travel distance, travel duration, * and geometry offset. *

        *

        * NOTE: This method appends the values to the existing list (if any). Use * {@link #setSteps(java.util.Collection)} or {@link #withSteps(java.util.Collection)} if you want to override the * existing values. *

        * * @param steps * Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to * move to the next step in the leg such as the step's start position, end position, travel distance, travel * duration, and geometry offset. * @return Returns a reference to this object so that method calls can be chained together. */ public Leg withSteps(Step... steps) { if (this.steps == null) { setSteps(new java.util.ArrayList(steps.length)); } for (Step ele : steps) { this.steps.add(ele); } return this; } /** *

        * Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move * to the next step in the leg such as the step's start position, end position, travel distance, travel duration, * and geometry offset. *

        * * @param steps * Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to * move to the next step in the leg such as the step's start position, end position, travel distance, travel * duration, and geometry offset. * @return Returns a reference to this object so that method calls can be chained together. */ public Leg withSteps(java.util.Collection steps) { setSteps(steps); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStartPosition() != null) sb.append("StartPosition: ").append("***Sensitive Data Redacted***").append(","); if (getEndPosition() != null) sb.append("EndPosition: ").append("***Sensitive Data Redacted***").append(","); if (getDistance() != null) sb.append("Distance: ").append(getDistance()).append(","); if (getDurationSeconds() != null) sb.append("DurationSeconds: ").append(getDurationSeconds()).append(","); if (getGeometry() != null) sb.append("Geometry: ").append(getGeometry()).append(","); if (getSteps() != null) sb.append("Steps: ").append(getSteps()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Leg == false) return false; Leg other = (Leg) obj; if (other.getStartPosition() == null ^ this.getStartPosition() == null) return false; if (other.getStartPosition() != null && other.getStartPosition().equals(this.getStartPosition()) == 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.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.getGeometry() == null ^ this.getGeometry() == null) return false; if (other.getGeometry() != null && other.getGeometry().equals(this.getGeometry()) == false) return false; if (other.getSteps() == null ^ this.getSteps() == null) return false; if (other.getSteps() != null && other.getSteps().equals(this.getSteps()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStartPosition() == null) ? 0 : getStartPosition().hashCode()); hashCode = prime * hashCode + ((getEndPosition() == null) ? 0 : getEndPosition().hashCode()); hashCode = prime * hashCode + ((getDistance() == null) ? 0 : getDistance().hashCode()); hashCode = prime * hashCode + ((getDurationSeconds() == null) ? 0 : getDurationSeconds().hashCode()); hashCode = prime * hashCode + ((getGeometry() == null) ? 0 : getGeometry().hashCode()); hashCode = prime * hashCode + ((getSteps() == null) ? 0 : getSteps().hashCode()); return hashCode; } @Override public Leg clone() { try { return (Leg) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.location.model.transform.LegMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy