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

* Returns the result of the route matrix calculation. *

*/ public class CalculateRouteMatrixResult implements Serializable { /** *

* The calculated route matrix containing the results for all pairs of * DeparturePositions to DestinationPositions. * Each row corresponds to one entry in DeparturePositions. * Each entry in the row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

*/ private java.util.List> routeMatrix; /** *

* For routes calculated using an Esri route calculator resource, departure * positions are snapped to the closest road. For Esri route calculator * resources, this returns the list of departure/origin positions used for * calculation of the RouteMatrix. *

*/ private java.util.List> snappedDeparturePositions; /** *

* The list of destination positions for the route matrix used for * calculation of the RouteMatrix. *

*/ private java.util.List> snappedDestinationPositions; /** *

* Contains information about the route matrix, DataSource, * DistanceUnit, RouteCount and * ErrorCount. *

*/ private CalculateRouteMatrixSummary summary; /** *

* The calculated route matrix containing the results for all pairs of * DeparturePositions to DestinationPositions. * Each row corresponds to one entry in DeparturePositions. * Each entry in the row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

* * @return

* The calculated route matrix containing the results for all pairs * of DeparturePositions to * DestinationPositions. Each row corresponds to one * entry in DeparturePositions. Each entry in the row * corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

*/ public java.util.List> getRouteMatrix() { return routeMatrix; } /** *

* The calculated route matrix containing the results for all pairs of * DeparturePositions to DestinationPositions. * Each row corresponds to one entry in DeparturePositions. * Each entry in the row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

* * @param routeMatrix

* The calculated route matrix containing the results for all * pairs of DeparturePositions to * DestinationPositions. Each row corresponds to one * entry in DeparturePositions. Each entry in the * row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

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

* The calculated route matrix containing the results for all pairs of * DeparturePositions to DestinationPositions. * Each row corresponds to one entry in DeparturePositions. * Each entry in the row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

*

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

* The calculated route matrix containing the results for all * pairs of DeparturePositions to * DestinationPositions. Each row corresponds to one * entry in DeparturePositions. Each entry in the * row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CalculateRouteMatrixResult withRouteMatrix( java.util.List... routeMatrix) { if (getRouteMatrix() == null) { this.routeMatrix = new java.util.ArrayList>( routeMatrix.length); } for (java.util.List value : routeMatrix) { this.routeMatrix.add(value); } return this; } /** *

* The calculated route matrix containing the results for all pairs of * DeparturePositions to DestinationPositions. * Each row corresponds to one entry in DeparturePositions. * Each entry in the row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

*

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

* The calculated route matrix containing the results for all * pairs of DeparturePositions to * DestinationPositions. Each row corresponds to one * entry in DeparturePositions. Each entry in the * row corresponds to the route from that entry in * DeparturePositions to an entry in * DestinationPositions. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CalculateRouteMatrixResult withRouteMatrix( java.util.Collection> routeMatrix) { setRouteMatrix(routeMatrix); return this; } /** *

* For routes calculated using an Esri route calculator resource, departure * positions are snapped to the closest road. For Esri route calculator * resources, this returns the list of departure/origin positions used for * calculation of the RouteMatrix. *

* * @return

* For routes calculated using an Esri route calculator resource, * departure positions are snapped to the closest road. For Esri * route calculator resources, this returns the list of * departure/origin positions used for calculation of the * RouteMatrix. *

*/ public java.util.List> getSnappedDeparturePositions() { return snappedDeparturePositions; } /** *

* For routes calculated using an Esri route calculator resource, departure * positions are snapped to the closest road. For Esri route calculator * resources, this returns the list of departure/origin positions used for * calculation of the RouteMatrix. *

* * @param snappedDeparturePositions

* For routes calculated using an Esri route calculator resource, * departure positions are snapped to the closest road. For Esri * route calculator resources, this returns the list of * departure/origin positions used for calculation of the * RouteMatrix. *

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

* For routes calculated using an Esri route calculator resource, departure * positions are snapped to the closest road. For Esri route calculator * resources, this returns the list of departure/origin positions used for * calculation of the RouteMatrix. *

*

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

* For routes calculated using an Esri route calculator resource, * departure positions are snapped to the closest road. For Esri * route calculator resources, this returns the list of * departure/origin positions used for calculation of the * RouteMatrix. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CalculateRouteMatrixResult withSnappedDeparturePositions( java.util.List... snappedDeparturePositions) { if (getSnappedDeparturePositions() == null) { this.snappedDeparturePositions = new java.util.ArrayList>( snappedDeparturePositions.length); } for (java.util.List value : snappedDeparturePositions) { this.snappedDeparturePositions.add(value); } return this; } /** *

* For routes calculated using an Esri route calculator resource, departure * positions are snapped to the closest road. For Esri route calculator * resources, this returns the list of departure/origin positions used for * calculation of the RouteMatrix. *

*

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

* For routes calculated using an Esri route calculator resource, * departure positions are snapped to the closest road. For Esri * route calculator resources, this returns the list of * departure/origin positions used for calculation of the * RouteMatrix. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CalculateRouteMatrixResult withSnappedDeparturePositions( java.util.Collection> snappedDeparturePositions) { setSnappedDeparturePositions(snappedDeparturePositions); return this; } /** *

* The list of destination positions for the route matrix used for * calculation of the RouteMatrix. *

* * @return

* The list of destination positions for the route matrix used for * calculation of the RouteMatrix. *

*/ public java.util.List> getSnappedDestinationPositions() { return snappedDestinationPositions; } /** *

* The list of destination positions for the route matrix used for * calculation of the RouteMatrix. *

* * @param snappedDestinationPositions

* The list of destination positions for the route matrix used * for calculation of the RouteMatrix. *

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

* The list of destination positions for the route matrix used for * calculation of the RouteMatrix. *

*

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

* The list of destination positions for the route matrix used * for calculation of the RouteMatrix. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CalculateRouteMatrixResult withSnappedDestinationPositions( java.util.List... snappedDestinationPositions) { if (getSnappedDestinationPositions() == null) { this.snappedDestinationPositions = new java.util.ArrayList>( snappedDestinationPositions.length); } for (java.util.List value : snappedDestinationPositions) { this.snappedDestinationPositions.add(value); } return this; } /** *

* The list of destination positions for the route matrix used for * calculation of the RouteMatrix. *

*

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

* The list of destination positions for the route matrix used * for calculation of the RouteMatrix. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CalculateRouteMatrixResult withSnappedDestinationPositions( java.util.Collection> snappedDestinationPositions) { setSnappedDestinationPositions(snappedDestinationPositions); return this; } /** *

* Contains information about the route matrix, DataSource, * DistanceUnit, RouteCount and * ErrorCount. *

* * @return

* Contains information about the route matrix, * DataSource, DistanceUnit, * RouteCount and ErrorCount. *

*/ public CalculateRouteMatrixSummary getSummary() { return summary; } /** *

* Contains information about the route matrix, DataSource, * DistanceUnit, RouteCount and * ErrorCount. *

* * @param summary

* Contains information about the route matrix, * DataSource, DistanceUnit, * RouteCount and ErrorCount. *

*/ public void setSummary(CalculateRouteMatrixSummary summary) { this.summary = summary; } /** *

* Contains information about the route matrix, DataSource, * DistanceUnit, RouteCount and * ErrorCount. *

*

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

* Contains information about the route matrix, * DataSource, DistanceUnit, * RouteCount and ErrorCount. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CalculateRouteMatrixResult withSummary(CalculateRouteMatrixSummary summary) { this.summary = summary; 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 (getRouteMatrix() != null) sb.append("RouteMatrix: " + getRouteMatrix() + ","); if (getSnappedDeparturePositions() != null) sb.append("SnappedDeparturePositions: " + getSnappedDeparturePositions() + ","); if (getSnappedDestinationPositions() != null) sb.append("SnappedDestinationPositions: " + getSnappedDestinationPositions() + ","); if (getSummary() != null) sb.append("Summary: " + getSummary()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRouteMatrix() == null) ? 0 : getRouteMatrix().hashCode()); hashCode = prime * hashCode + ((getSnappedDeparturePositions() == null) ? 0 : getSnappedDeparturePositions() .hashCode()); hashCode = prime * hashCode + ((getSnappedDestinationPositions() == null) ? 0 : getSnappedDestinationPositions().hashCode()); hashCode = prime * hashCode + ((getSummary() == null) ? 0 : getSummary().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CalculateRouteMatrixResult == false) return false; CalculateRouteMatrixResult other = (CalculateRouteMatrixResult) obj; if (other.getRouteMatrix() == null ^ this.getRouteMatrix() == null) return false; if (other.getRouteMatrix() != null && other.getRouteMatrix().equals(this.getRouteMatrix()) == false) return false; if (other.getSnappedDeparturePositions() == null ^ this.getSnappedDeparturePositions() == null) return false; if (other.getSnappedDeparturePositions() != null && other.getSnappedDeparturePositions().equals(this.getSnappedDeparturePositions()) == false) return false; if (other.getSnappedDestinationPositions() == null ^ this.getSnappedDestinationPositions() == null) return false; if (other.getSnappedDestinationPositions() != null && other.getSnappedDestinationPositions().equals( this.getSnappedDestinationPositions()) == false) return false; if (other.getSummary() == null ^ this.getSummary() == null) return false; if (other.getSummary() != null && other.getSummary().equals(this.getSummary()) == false) return false; return true; } }