Class XYZ

java.lang.Object
uk.co.mccombe.mapping.XYZ

public class XYZ extends Object
A simple immutable class for 3D cartesian coordinates
  • Constructor Summary

    Constructors
    Constructor
    Description
    XYZ()
    Creates a new instance of XYZ
    XYZ(double x, double y, double z)
    Create a new XYZ coordinate
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compare this XYZ with another Object
    int
    Provide a hashcode for this XYZ based on the values contained.
    double
    x()
    Get the X component
    double
    y()
    Get the Y component
    double
    z()
    Get the Z component

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XYZ

      public XYZ()
      Creates a new instance of XYZ
    • XYZ

      public XYZ(double x, double y, double z)
      Create a new XYZ coordinate
      Parameters:
      x - The X component
      y - The Y component
      z - Th Z component
  • Method Details

    • x

      public double x()
      Get the X component
      Returns:
      The X component
    • y

      public double y()
      Get the Y component
      Returns:
      The Y component
    • z

      public double z()
      Get the Z component
      Returns:
      The Z component
    • hashCode

      public int hashCode()
      Provide a hashcode for this XYZ based on the values contained. This is necessary to meet the contract for the Object.hashcode() method which requires that if object1.equals(object2) their hashcodes must also be equal.
      Overrides:
      hashCode in class Object
      Returns:
      hashcode
    • equals

      public boolean equals(Object obj)
      Compare this XYZ with another Object
      Overrides:
      equals in class Object
      Parameters:
      obj - - the Objecty to compare to.
      Returns:
      true if obj is another XYZ containing the same values. They are not necessarily the same object.