Class SizeFloat

java.lang.Object
com.helger.base.dimension.SizeFloat
All Implemented Interfaces:
IHasDimensionFloat, IHasHeightFloat, IHasWidthFloat

@Immutable public class SizeFloat extends Object implements IHasDimensionFloat
This class represents an object having width and height.
Author:
Philip Helger
  • Constructor Details

    • SizeFloat

      public SizeFloat(@Nonnull IHasDimensionInt aObj)
    • SizeFloat

      public SizeFloat(@Nonnull IHasDimensionLong aObj)
    • SizeFloat

      public SizeFloat(@Nonnull IHasDimensionFloat aObj)
    • SizeFloat

      public SizeFloat(@Nonnegative float dWidth, @Nonnegative float dHeight)
  • Method Details

    • getWidth

      @Nonnegative public float getWidth()
      Specified by:
      getWidth in interface IHasWidthFloat
      Returns:
      The width of an object
    • getHeight

      @Nonnegative public float getHeight()
      Specified by:
      getHeight in interface IHasHeightFloat
      Returns:
      The height of an object
    • getBestMatchingSize

      @Nonnull @CheckReturnValue public SizeFloat getBestMatchingSize(@Nonnegative float dMaxWidth, @Nonnegative float dMaxHeight)
      Return the scaled width and height relative to a maximum size.
      Parameters:
      dMaxWidth - Maximum width. Must be > 0.
      dMaxHeight - Maximum height. Must be > 0.
      Returns:
      An array with 2 elements, where the first element is the width, and the second is the height.
    • getScaledToWidth

      @Nonnull @CheckReturnValue public SizeFloat getScaledToWidth(@Nonnegative float dNewWidth)
    • getScaledToHeight

      @Nonnull @CheckReturnValue public SizeFloat getScaledToHeight(@Nonnegative float dNewHeight)
    • getAdded

      @Nonnull @CheckReturnValue public SizeFloat getAdded(@Nonnull IHasDimensionInt aToAdd)
    • getAdded

      @Nonnull @CheckReturnValue public SizeFloat getAdded(@Nonnull IHasDimensionFloat aToAdd)
    • getSubtracted

      @Nonnull @CheckReturnValue public SizeFloat getSubtracted(@Nonnull IHasDimensionInt aToSubtract)
    • getSubtracted

      @Nonnull @CheckReturnValue public SizeFloat getSubtracted(@Nonnull IHasDimensionFloat aToSubtract)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object