public final class SizeI
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static SizeI |
EMPTY
An empty read-only
SizeI . |
int |
height
The vertical dimension of the
SizeI . |
int |
width
The horizontal dimension of the
SizeI . |
Constructor and Description |
---|
SizeI()
Creates a
SizeI with zero extension. |
SizeI(int width,
int height)
Creates a
SizeI with the specified extension. |
Modifier and Type | Method and Description |
---|---|
SizeI |
add(SizeI size)
Adds the extension of the specified
SizeI to this instance. |
boolean |
equals(java.lang.Object obj)
Compares the specified
Object to this SizeI instance. |
static SizeI[] |
fromInts(int... sizes)
Converts the specified
Integer array to a SizeI array. |
int |
hashCode()
Returns a hash code for the
SizeI . |
boolean |
isEmpty()
Determines whether the
SizeI is empty. |
SizeI |
restrict(int minWidth,
int minHeight,
int maxWidth,
int maxHeight)
Restricts the
SizeI to the specified extension range. |
SizeI |
subtract(SizeI size)
Subtracts the extension of the specified
SizeI from this instance. |
static int[] |
toInts(SizeI... sizes)
Converts the specified
SizeI array to an Integer array. |
SizeD |
toSizeD()
|
java.lang.String |
toString()
Returns a
String representation of the SizeI . |
public final int width
SizeI
. Never negative.public final int height
SizeI
. Never negative.public static final SizeI EMPTY
public SizeI add(SizeI size)
SizeI
to this instance.size
- the SizeI
whose extension to add to this instanceSizeI
whose width
and height
equal the addition
of the corresponding dimensions of the specified size
to this instancejava.lang.ArithmeticException
- if the sum in any dimension overflows Integer
java.lang.NullPointerException
- if size
is null
public static SizeI[] fromInts(int... sizes)
Integer
array to a SizeI
array.
The returned array has half as many elements as the specified sizes
and retains the same dimension sequence.sizes
- an array containing the width
and height
components
of SizeI
instances, stored in alternating index positionsSizeI
array created from sizes
java.lang.IllegalArgumentException
- if sizes
has an odd number of elements,
or if any width
or height
is less than zerojava.lang.NullPointerException
- if sizes
is null
public boolean isEmpty()
SizeI
is empty.public SizeI restrict(int minWidth, int minHeight, int maxWidth, int maxHeight)
SizeI
to the specified extension range.minWidth
- the smallest permissible width
minHeight
- the smallest permissible height
maxWidth
- the greatest permissible width
maxHeight
- the greatest permissible height
SizeI
whose width
and height
equal those
of this instance, restricted to the specified extension rangejava.lang.IllegalArgumentException
- if maxWidth
or maxHeight
is less than zeropublic SizeI subtract(SizeI size)
SizeI
from this instance.size
- the SizeI
extension to subtract from this instanceSizeI
whose width
and height
equal the subtraction
of the corresponding dimensions of the specified size
from this instancejava.lang.IllegalArgumentException
- if the difference in any dimension is less than zerojava.lang.NullPointerException
- if size
is null
public static int[] toInts(SizeI... sizes)
SizeI
array to an Integer
array.
The returned array has twice as many elements as the specified sizes
and retains the same dimension sequence.public SizeD toSizeD()
SizeD
whose SizeD.width
and SizeD.height
equal the corresponding dimensions of the SizeI
public boolean equals(java.lang.Object obj)
Object
to this SizeI
instance.public int hashCode()
SizeI
.hashCode
in class java.lang.Object
Integer
hash code for the SizeI