Class RectangleImpl
- java.lang.Object
-
- org.eclipse.graphiti.internal.datatypes.impl.RectangleImpl
-
- All Implemented Interfaces:
IDimension,ILocation,IRectangle
public class RectangleImpl extends java.lang.Object implements IRectangle
-
-
Constructor Summary
Constructors Constructor Description RectangleImpl(int width, int height)RectangleImpl(int x, int y, int width, int height)RectangleImpl(IRectangle other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(int x, int y)Checks whether the point with (x,y) is inside the rectangle.booleancontains(ILocation location)Checks whether the point with the given location is inside the rectangle.booleanequals(java.lang.Object o)IDimensionexpand(int dw, int dh)IDimensiongetDimensionCopy()intgetHeight()Gets the height.ILocationgetLocationCopy()IRectanglegetRectangleCopy()intgetWidth()Gets the width.intgetX()Gets the x value.intgetY()Gets the y value.inthashCode()voidscale(double amount)IDimensionsetDimension(int width, int height)IDimensionsetDimension(IDimension dimension)voidsetHeight(int height)Sets the height.ILocationsetLocation(int x, int y)ILocationsetLocation(ILocation location)voidsetRectangle(int x, int y, int width, int height)Sets the location and dimension of the rectangle.voidsetRectangle(IRectangle rectangle)Sets the location and dimension of the rectangle to the values of the given rectangle.voidsetWidth(int width)Sets the width.voidsetX(int x)Sets the x coordinate of this location.voidsetY(int y)Sets the y coordinate of this location.java.lang.StringtoString()ILocationtranslate(int dx, int dy)
-
-
-
Constructor Detail
-
RectangleImpl
public RectangleImpl(int width, int height)
-
RectangleImpl
public RectangleImpl(int x, int y, int width, int height)
-
RectangleImpl
public RectangleImpl(IRectangle other)
-
-
Method Detail
-
getHeight
public int getHeight()
Description copied from interface:IDimensionGets the height.- Specified by:
getHeightin interfaceIDimension- Returns:
- the height of this dimension
-
getWidth
public int getWidth()
Description copied from interface:IDimensionGets the width.- Specified by:
getWidthin interfaceIDimension- Returns:
- the width of this dimension
-
setHeight
public void setHeight(int height)
Description copied from interface:IDimensionSets the height.- Specified by:
setHeightin interfaceIDimension- Parameters:
height- the new height of this dimension
-
setWidth
public void setWidth(int width)
Description copied from interface:IDimensionSets the width.- Specified by:
setWidthin interfaceIDimension- Parameters:
width- the new width of this dimension
-
getX
public int getX()
Description copied from interface:ILocationGets the x value.
-
getY
public int getY()
Description copied from interface:ILocationGets the y value.
-
setX
public void setX(int x)
Description copied from interface:ILocationSets the x coordinate of this location.
-
setY
public void setY(int y)
Description copied from interface:ILocationSets the y coordinate of this location.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
expand
public IDimension expand(int dw, int dh)
-
getDimensionCopy
public IDimension getDimensionCopy()
-
scale
public void scale(double amount)
-
setDimension
public IDimension setDimension(int width, int height)
-
setDimension
public IDimension setDimension(IDimension dimension)
-
getLocationCopy
public ILocation getLocationCopy()
-
setLocation
public ILocation setLocation(int x, int y)
-
translate
public ILocation translate(int dx, int dy)
-
getRectangleCopy
public IRectangle getRectangleCopy()
- Specified by:
getRectangleCopyin interfaceIRectangle- Returns:
- An exact copy of the current rectangle instance.
-
setRectangle
public void setRectangle(int x, int y, int width, int height)Description copied from interface:IRectangleSets the location and dimension of the rectangle.- Specified by:
setRectanglein interfaceIRectangle- Parameters:
x- the x coordinate of the rectangley- the y coordinate of the rectanglewidth- the width of the rectangleheight- the height of the rectangle
-
setRectangle
public void setRectangle(IRectangle rectangle)
Description copied from interface:IRectangleSets the location and dimension of the rectangle to the values of the given rectangle.- Specified by:
setRectanglein interfaceIRectangle- Parameters:
rectangle- The rectangle which contains new location and dimension.
-
contains
public boolean contains(int x, int y)Description copied from interface:IRectangleChecks whether the point with (x,y) is inside the rectangle.- Specified by:
containsin interfaceIRectangle- Parameters:
x- the x coordinate of the point to be testedy- the y coordinate of the point to be tested- Returns:
- TRUE, if the point with (x,y) is inside the rectangle; FALSE otherwise
-
contains
public boolean contains(ILocation location)
Description copied from interface:IRectangleChecks whether the point with the given location is inside the rectangle.- Specified by:
containsin interfaceIRectangle- Parameters:
location- the location of the point to be tested- Returns:
- TRUE, if the location is inside the rectangle; FALSE otherwise
-
-