Package org.eclipse.draw2d.geometry
Class Insets
java.lang.Object
org.eclipse.draw2d.geometry.Insets
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
IFigure.NoInsets
Stores four integers for top, left, bottom, and right measurements.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInsets()
Constructs an Insets with all zeroes.Insets
(int i) Constructs a new Insets with all the sides set to the speicifed value.Insets
(int top, int left, int bottom, int right) Creates a new Insets with the specified top, left, bottom, and right values.Constructs a new Insets with initial values the same as the provided Insets. -
Method Summary
Modifier and TypeMethodDescriptionAdds the values of the specified Insets to this Insets' values.boolean
Test for equality.Creates an Insets representing the sum of this Insets with the specified Insets.int
Returns the height for this Insets, equal totop
+bottom
.Creates a newInsets
with negated values.Creates a new Insets with transposed values.int
getWidth()
Returns the width for this Insets, equal toleft
+right
.int
hashCode()
boolean
isEmpty()
Returns true if all values are 0.static Insets
Creates a new minimalInsets
using the distances of the given arguments.toString()
Transposes this object.
-
Field Details
-
left
public int leftdistance from left -
top
public int topdistance from top -
bottom
public int bottomdistance from bottom -
right
public int rightdistance from right
-
-
Constructor Details
-
Insets
public Insets()Constructs an Insets with all zeroes.- Since:
- 2.0
-
Insets
Constructs a new Insets with initial values the same as the provided Insets.- Parameters:
i
- The insets to copy.- Since:
- 2.0
-
Insets
public Insets(int i) Constructs a new Insets with all the sides set to the speicifed value.- Parameters:
i
- Value applied to all sides of new Insets.- Since:
- 2.0
-
Insets
public Insets(int top, int left, int bottom, int right) Creates a new Insets with the specified top, left, bottom, and right values.- Parameters:
top
- Value of the top space.left
- Value of the left space.bottom
- Value of the bottom space.right
- Value of the right space.- Since:
- 2.0
-
-
Method Details
-
add
Adds the values of the specified Insets to this Insets' values.- Parameters:
insets
- the Insets being added- Returns:
this
for convenience- Since:
- 2.0
-
equals
Test for equality. The Insets are equal if their top, left, bottom, and right values are equivalent. -
getAdded
Creates an Insets representing the sum of this Insets with the specified Insets.- Parameters:
insets
- Insets to be added- Returns:
- A new Insets
- Since:
- 2.0
-
getHeight
public int getHeight()Returns the height for this Insets, equal totop
+bottom
.- Returns:
- The sum of top + bottom
- Since:
- 2.0
- See Also:
-
getTransposed
Creates a new Insets with transposed values. Top and Left are transposed. Bottom and Right are transposed.- Returns:
- New Insets with the transposed values.
- Since:
- 2.0
-
getNegated
Creates a newInsets
with negated values. Top, Left, Bottom and Right are multiplied by-1
- Returns:
- The negate of this
Insets
- Since:
- 3.13
-
getWidth
public int getWidth()Returns the width for this Insets, equal toleft
+right
.- Returns:
- The sum of left + right
- Since:
- 2.0
- See Also:
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty()Returns true if all values are 0.- Returns:
- true if all values are 0
- Since:
- 2.0
-
toString
-
transpose
Transposes this object. Top and Left are exchanged. Bottom and Right are exchanged. Can be used in orientation changes.- Returns:
this
for convenience- Since:
- 2.0
-
min
Creates a new minimalInsets
using the distances of the given arguments. The Top, Left, Bottom and Right computes using the minimum of the respective distances.
-