Class JDFXYPair

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>, java.util.List<java.lang.Object>, java.util.RandomAccess, JDFBaseDataTypes

    public class JDFXYPair
    extends JDFNumList
    This class represents a x y pair (JDFXYPair). It is a whitespace separated list of 2 numbers.
    See Also:
    Serialized Form
    • Constructor Detail

      • JDFXYPair

        public JDFXYPair()
        constructs a xy pair with all values set to 0.0 Double
      • JDFXYPair

        @Deprecated
        public JDFXYPair​(java.util.Vector v)
                  throws java.util.zip.DataFormatException
        Deprecated.
        use typesafe constructors
        constructs a xy pair with all values set via a Vector of Double objects
        Parameters:
        v - Vector of Double
        Throws:
        java.util.zip.DataFormatException - - if the Vector has not a valid format
      • JDFXYPair

        public JDFXYPair​(java.lang.String s)
                  throws java.util.zip.DataFormatException
        constructs a xy pair with all values set via a String if a single numerical value is specified, s is padded with " 0"
        Parameters:
        s - the given String
        Throws:
        java.util.zip.DataFormatException - - if the String has not a valid format
      • JDFXYPair

        public JDFXYPair​(JDFNumList nl)
                  throws java.util.zip.DataFormatException
        constructs a xy pair with all values set via a JDFNumberList
        Parameters:
        nl - the given number list
        Throws:
        java.util.zip.DataFormatException - - if the JDFNumberList has not a valid format
      • JDFXYPair

        public JDFXYPair​(JDFShape shape)
        constructs a xy pair with all values set via a JDFNumberList
        Parameters:
        shape - the given number list
      • JDFXYPair

        public JDFXYPair​(JDFXYPair nl)
        constructs a xy pair with all values set via a JDFNumberList
        Parameters:
        nl - the given number list
      • JDFXYPair

        public JDFXYPair​(double x,
                         double y)
        constructs a new JDFXYPair with the given double values
        Parameters:
        x - the x coordinate
        y - the y coordinate
      • JDFXYPair

        public JDFXYPair​(int x,
                         int y)
        constructs a new JDFXYPair with the given double values
        Parameters:
        x - the x coordinate
        y - the y coordinate
    • Method Detail

      • createXYPair

        public static JDFXYPair createXYPair​(java.lang.String s)
        factory for JDFXYPair that silently returns null in case of illegal strings
        Parameters:
        s - the string to parse
        Returns:
        the JDFXYPair, null if s is not compatible
      • isValid

        public boolean isValid()
                        throws java.util.zip.DataFormatException
        isValid - valid if the size of the vector is 2 and all instances are Double types
        Specified by:
        isValid in class JDFNumList
        Returns:
        boolean - true if all instances are Double or Integer types
        Throws:
        java.util.zip.DataFormatException - - if the Vector has not a valid format
      • getX

        public double getX()
        getX - returns the x coordinate
        Returns:
        double - the x coordinate
      • getPoint2D

        public java.awt.geom.Point2D getPoint2D()
        Returns:
      • setX

        public void setX​(double x)
        setX - sets the x coordinate
        Parameters:
        x - the x coordinate
      • getY

        public double getY()
        getY - returns the y coordinate
        Returns:
        double - the y coordinate
      • swapXY

        public void swapXY()
        swap x and y coordinates -
      • setY

        public void setY​(double y)
        setY - sets the y coordinate
        Parameters:
        y - the y coordinate
      • isGreaterOrEqual

        public boolean isGreaterOrEqual​(JDFXYPair x)
        isGreaterOrEqual - equality operator >=
        Parameters:
        x - the JDFXYPair object to compare to
        Returns:
        boolean - true if this >= x
      • isLessOrEqual

        public boolean isLessOrEqual​(JDFXYPair x)
        isLessOrEqual - equality operator <=
        Parameters:
        x - the JDFXYPair object to compare to
        Returns:
        boolean - true if this <= x
      • isGreater

        public boolean isGreater​(JDFXYPair x)
        isGreater - equality operator >
        Parameters:
        x - the JDFXYPair object to compare to
        Returns:
        boolean - true if this > x
      • isPortrait

        public boolean isPortrait()
        return true if y is > x
        Returns:
      • isLess

        public boolean isLess​(JDFXYPair x)
        isLess - equality operator <
        Parameters:
        x - the JDFXYPair object to compare to
        Returns:
        boolean - true if this < x
      • shift

        public JDFXYPair shift​(double x,
                               double y)
        Parameters:
        x -
        y -
        Returns: