Class XYZ


  • public class XYZ
    extends java.lang.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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Compare this XYZ with another Object
      int hashCode()
      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 Detail

      • 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 Detail

      • 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 java.lang.Object
        Returns:
        hashcode
      • equals

        public boolean equals​(java.lang.Object obj)
        Compare this XYZ with another Object
        Overrides:
        equals in class java.lang.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.