Class JDFShape

  • 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 JDFShape
    extends JDFNumList
    This class is a representation of a JDFShape. It is a blank separated list of double values consisting of a width(x), a height(y) and a depth(z) value. this spans a standard right-handed xyz coordinate system
    See Also:
    Serialized Form
    • Constructor Detail

      • JDFShape

        public JDFShape()
        constructor - constructs a shape with all values set to 0.0 Double
      • JDFShape

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

        public JDFShape​(java.lang.String s)
                 throws java.util.zip.DataFormatException
        constructor - constructs a shape with all values set via a String
        Parameters:
        s - the given String
        Throws:
        java.util.zip.DataFormatException - - if the String has not a valid format
      • JDFShape

        public JDFShape​(JDFNumList nl)
                 throws java.util.zip.DataFormatException
        constructor - constructs a shape 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
      • JDFShape

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

        public JDFShape​(double x,
                        double y,
                        double z)
        constructor - constructs a new JDFShape with the given double values
        Parameters:
        x - the x value
        y - the y value
        z - the z value
      • JDFShape

        public JDFShape​(double x,
                        double y)
        constructor - constructs a new JDFShape with the given 2 double values third is default = 0.
        Parameters:
        x - the width
        y - the height
    • Method Detail

      • createShape

        public static JDFShape createShape​(java.lang.String s)
        factory for JDFShape that silently returns null in case of illegal strings
        Parameters:
        s - the string to parse - if JDFXYPair compatible, a 0 z dimension value is assumed
        Returns:
        the JDFShape, null if s is not compatible
      • swapXY

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

        public boolean isValid()
                        throws java.util.zip.DataFormatException
        isValid - true if the size of the vector is 3 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
      • equals

        public boolean equals​(java.lang.Object other)
        equals - returns true if both JDFShapes are equal, otherwise false
        Specified by:
        equals in interface java.util.Collection<java.lang.Object>
        Specified by:
        equals in interface java.util.List<java.lang.Object>
        Overrides:
        equals in class JDFNumList
        Returns:
        boolean - true if equal otherwise false
      • hashCode

        public int hashCode()
        hashCode complements equals() to fulfill the equals/hashCode contract
        Specified by:
        hashCode in interface java.util.Collection<java.lang.Object>
        Specified by:
        hashCode in interface java.util.List<java.lang.Object>
        Overrides:
        hashCode in class JDFNumList
      • isGreaterOrEqual

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

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

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

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

        @Deprecated
        public double getHeight()
        Deprecated.
        use getY - attention height and width were accidentally exchanged
        getHeight - returns the height
        Returns:
        double - the height
      • getY

        public double getY()
        getY - returns the width
        Returns:
        double - the width
      • setHeight

        @Deprecated
        public void setHeight​(double height)
        Deprecated.
        attention height and width were accidentally exchanged
        setHeight - sets the height
        Parameters:
        height - the height
      • setY

        public void setY​(double y)
        setY - sets the height
        Parameters:
        y - the height
      • getWidth

        @Deprecated
        public double getWidth()
        Deprecated.
        use getX - attention height and width were accidentally exchanged
        getWidth - returns the width
        Returns:
        double - the width
      • getX

        public double getX()
        getX - returns the width
        Returns:
        double - the width
      • setX

        public void setX​(double x)
        setWidth - sets the x value
        Parameters:
        x - the width
      • setWidth

        @Deprecated
        public void setWidth​(double width)
        Deprecated.
        attention height and width were accidentally exchanged
        setWidth - sets the width
        Parameters:
        width - the width
      • getLength

        @Deprecated
        public double getLength()
        Deprecated.
        use getZ
        getLength - returns the length
        Returns:
        double - the length
      • getZ

        public double getZ()
        getZ - returns the z value
        Returns:
        double - the length
      • setLength

        @Deprecated
        public void setLength​(double length)
        Deprecated.
        setLength - sets the length
        Parameters:
        length - the length
      • setZ

        public void setZ​(double z)
        set the z value
        Parameters:
        z -