Package models.distances

Source Code of models.distances.MagnitudeDistance

package models.distances;

import views.Astre;
import views.Star;

/**
* Distance based on the magnitude of a Star
* ! Can only be used for stars 
* @author clement
*
*/

public class MagnitudeDistance extends Distance {

  private static String name = "Magnitude";
  private static String description = "Distance basée sur l'écart des magnitudes";
  private static final int dimension = 1;
 
  /**
   *
   * @param a
   * @param b
   * @return
   */
  @Override
  public double get(Astre a, Astre b) {
    Star s1 = (Star) a;
    Star s2 = (Star) b;
    return Math.abs(s1.getMagnitude() - s2.getMagnitude());
  }

  @Override
  public String getName() {
    return name;
  }

  @Override
  public String getDescription() {
    return description;
  }
 
  @Override
  public int getDimension(){
    return dimension;
  }
 
}
TOP

Related Classes of models.distances.MagnitudeDistance

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.