Package com.helger.commons.dimension
Class SizeDouble
- java.lang.Object
-
- com.helger.commons.dimension.SizeDouble
-
- All Implemented Interfaces:
IHasDimensionDouble,IHasHeightDouble,IHasWidthDouble
@Immutable public class SizeDouble extends Object implements IHasDimensionDouble
This class represents an object having width and height.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description SizeDouble(double dWidth, double dHeight)SizeDouble(IHasDimensionDouble aObj)SizeDouble(IHasDimensionFloat aObj)SizeDouble(IHasDimensionInt aObj)SizeDouble(IHasDimensionLong aObj)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)SizeDoublegetAdded(IHasDimensionDouble aToAdd)SizeDoublegetAdded(IHasDimensionFloat aToAdd)SizeDoublegetAdded(IHasDimensionInt aToAdd)SizeDoublegetBestMatchingSize(double dMaxWidth, double dMaxHeight)Return the scaled width and height relative to a maximum size.doublegetHeight()SizeDoublegetScaledToHeight(double dNewHeight)SizeDoublegetScaledToWidth(double dNewWidth)SizeDoublegetSubtracted(IHasDimensionDouble aToSubtract)SizeDoublegetSubtracted(IHasDimensionFloat aToSubtract)SizeDoublegetSubtracted(IHasDimensionInt aToSubtract)doublegetWidth()inthashCode()StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.dimension.IHasDimensionDouble
isLandscape, isPortrait, isQuadratic
-
-
-
-
Constructor Detail
-
SizeDouble
public SizeDouble(@Nonnull IHasDimensionInt aObj)
-
SizeDouble
public SizeDouble(@Nonnull IHasDimensionLong aObj)
-
SizeDouble
public SizeDouble(@Nonnull IHasDimensionFloat aObj)
-
SizeDouble
public SizeDouble(@Nonnull IHasDimensionDouble aObj)
-
SizeDouble
public SizeDouble(@Nonnegative double dWidth, @Nonnegative double dHeight)
-
-
Method Detail
-
getWidth
@Nonnegative public double getWidth()
- Specified by:
getWidthin interfaceIHasWidthDouble- Returns:
- The width of an object
-
getHeight
@Nonnegative public double getHeight()
- Specified by:
getHeightin interfaceIHasHeightDouble- Returns:
- The height of an object
-
getBestMatchingSize
@Nonnull @CheckReturnValue public SizeDouble getBestMatchingSize(@Nonnegative double dMaxWidth, @Nonnegative double 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 SizeDouble getScaledToWidth(@Nonnegative double dNewWidth)
-
getScaledToHeight
@Nonnull @CheckReturnValue public SizeDouble getScaledToHeight(@Nonnegative double dNewHeight)
-
getAdded
@Nonnull @CheckReturnValue public SizeDouble getAdded(@Nonnull IHasDimensionInt aToAdd)
-
getAdded
@Nonnull @CheckReturnValue public SizeDouble getAdded(@Nonnull IHasDimensionFloat aToAdd)
-
getAdded
@Nonnull @CheckReturnValue public SizeDouble getAdded(@Nonnull IHasDimensionDouble aToAdd)
-
getSubtracted
@Nonnull @CheckReturnValue public SizeDouble getSubtracted(@Nonnull IHasDimensionInt aToSubtract)
-
getSubtracted
@Nonnull @CheckReturnValue public SizeDouble getSubtracted(@Nonnull IHasDimensionFloat aToSubtract)
-
getSubtracted
@Nonnull @CheckReturnValue public SizeDouble getSubtracted(@Nonnull IHasDimensionDouble aToSubtract)
-
-