Android Open Source - 3DR-Services-Library Speed






From Project

Back to project page 3DR-Services-Library.

License

The source code is released under:

Apache License

If you think the Android project 3DR-Services-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ox3dr.services.android.lib.drone.property;
//  w  ww. ja  va 2  s.  c  om
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by fhuya on 10/28/14.
 */
public class Speed implements Parcelable {

    private final double verticalSpeed; // m/s
    private final double groundSpeed; // m/s
    private final double airSpeed; // m/s

    public Speed(double verticalSpeed, double groundSpeed, double airSpeed) {
        this.verticalSpeed = verticalSpeed;
        this.groundSpeed = groundSpeed;
        this.airSpeed = airSpeed;
    }

    public double getVerticalSpeed() {
        return verticalSpeed;
    }

    public double getGroundSpeed() {
        return groundSpeed;
    }

    public double getAirSpeed() {
        return airSpeed;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Speed)) return false;

        Speed speed = (Speed) o;

        if (Double.compare(speed.airSpeed, airSpeed) != 0) return false;
        if (Double.compare(speed.groundSpeed, groundSpeed) != 0) return false;
        if (Double.compare(speed.verticalSpeed, verticalSpeed) != 0) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        temp = Double.doubleToLongBits(verticalSpeed);
        result = (int) (temp ^ (temp >>> 32));
        temp = Double.doubleToLongBits(groundSpeed);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        temp = Double.doubleToLongBits(airSpeed);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        return result;
    }

    @Override
    public String toString() {
        return "Speed{" +
                "verticalSpeed=" + verticalSpeed +
                ", groundSpeed=" + groundSpeed +
                ", airSpeed=" + airSpeed +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeDouble(this.verticalSpeed);
        dest.writeDouble(this.groundSpeed);
        dest.writeDouble(this.airSpeed);
    }

    private Speed(Parcel in) {
        this.verticalSpeed = in.readDouble();
        this.groundSpeed = in.readDouble();
        this.airSpeed = in.readDouble();
    }

    public static final Parcelable.Creator<Speed> CREATOR = new Parcelable.Creator<Speed>() {
        public Speed createFromParcel(Parcel source) {
            return new Speed(source);
        }

        public Speed[] newArray(int size) {
            return new Speed[size];
        }
    };
}




Java Source Code List

com.ox3dr.services.android.lib.ApplicationTest.java
com.ox3dr.services.android.lib.coordinate.LatLngAlt.java
com.ox3dr.services.android.lib.coordinate.LatLng.java
com.ox3dr.services.android.lib.drone.connection.ConnectionParameter.java
com.ox3dr.services.android.lib.drone.connection.ConnectionResult.java
com.ox3dr.services.android.lib.drone.connection.ConnectionType.java
com.ox3dr.services.android.lib.drone.event.Event.java
com.ox3dr.services.android.lib.drone.event.Extra.java
com.ox3dr.services.android.lib.drone.property.Altitude.java
com.ox3dr.services.android.lib.drone.property.Attitude.java
com.ox3dr.services.android.lib.drone.property.Battery.java
com.ox3dr.services.android.lib.drone.property.Gps.java
com.ox3dr.services.android.lib.drone.property.Home.java
com.ox3dr.services.android.lib.drone.property.MissionItemMessage.java
com.ox3dr.services.android.lib.drone.property.Mission.java
com.ox3dr.services.android.lib.drone.property.Parameter.java
com.ox3dr.services.android.lib.drone.property.Parameters.java
com.ox3dr.services.android.lib.drone.property.Speed.java
com.ox3dr.services.android.lib.drone.property.State.java
com.ox3dr.services.android.lib.drone.property.Type.java
com.ox3dr.services.android.lib.drone.property.VehicleMode.java