Package com.helger.commons.dimension
Class SizeLong
- java.lang.Object
-
- com.helger.commons.dimension.SizeLong
-
- All Implemented Interfaces:
IHasDimensionLong,IHasHeightLong,IHasWidthLong
@Immutable public class SizeLong extends Object implements IHasDimensionLong
This class represents an object having width and height.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description SizeLong(long nWidth, long nHeight)SizeLong(IHasDimensionInt aObj)SizeLong(IHasDimensionLong aObj)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)SizeLonggetAdded(IHasDimensionLong aToAdd)SizeLonggetBestMatchingSize(long nMaxWidth, long nMaxHeight)Return the scaled width and height relative to a maximum size.longgetHeight()SizeLonggetScaledToHeight(long nNewHeight)SizeLonggetScaledToWidth(long nNewWidth)SizeLonggetSubtracted(IHasDimensionLong aToSubtract)longgetWidth()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.IHasDimensionLong
isLandscape, isPortrait, isQuadratic
-
-
-
-
Constructor Detail
-
SizeLong
public SizeLong(@Nonnull IHasDimensionInt aObj)
-
SizeLong
public SizeLong(@Nonnull IHasDimensionLong aObj)
-
SizeLong
public SizeLong(@Nonnegative long nWidth, @Nonnegative long nHeight)
-
-
Method Detail
-
getWidth
@Nonnegative public long getWidth()
- Specified by:
getWidthin interfaceIHasWidthLong- Returns:
- The width of an object
-
getHeight
@Nonnegative public long getHeight()
- Specified by:
getHeightin interfaceIHasHeightLong- Returns:
- The height of an object
-
getBestMatchingSize
@Nonnull @CheckReturnValue public SizeLong getBestMatchingSize(@Nonnegative long nMaxWidth, @Nonnegative long nMaxHeight)
Return the scaled width and height relative to a maximum size.- Parameters:
nMaxWidth- Maximum width. Must be > 0.nMaxHeight- 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 SizeLong getScaledToWidth(@Nonnegative long nNewWidth)
-
getScaledToHeight
@Nonnull @CheckReturnValue public SizeLong getScaledToHeight(@Nonnegative long nNewHeight)
-
getAdded
@Nonnull @CheckReturnValue public SizeLong getAdded(@Nonnull IHasDimensionLong aToAdd)
-
getSubtracted
@Nonnull @CheckReturnValue public SizeLong getSubtracted(@Nonnull IHasDimensionLong aToSubtract)
-
-