Package com.iizix
Class Rect
java.lang.Object
com.iizix.Rect
- All Implemented Interfaces:
Cloneable
Simple rectangle class for multiple use accepting negative width and height.
- Author:
- Christopher Mindus
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionvoidappend(SendTransaction trans) Appends the rectangle to a transaction.voidclear()Reinitializes the contents.clone()Clones this instance.booleanChecks if two rectangles are equal.inthashCode()The hash code.booleanChecks if a position is inside.toString()Formats to a string as "x,y,cx,cy".
Field Details
EMPTY
Empty array of Rect's.x
public int xThe X position of the rectangle.y
public int yThe Y position of the rectangle.cx
public int cxThe width of the rectangle.cy
public int cyThe height of the rectangle.
Constructor Details
Rect
public Rect()Constructor for x=y=cx=cy=0.Rect
Constructor from a String formatted as "x,y,cx,cy".- Parameters:
string- The string.- Throws:
IllegalArgumentException- If the string is not well formatted.
Rect
Constructor from a Transaction.- Parameters:
trans- The transaction.
Rect
public Rect(int x, int y, int cx, int cy) Constructor.- Parameters:
x- X position.y- Y position.cx- Width.cy- Height.
Method Details
isInside
Checks if a position is inside.- Parameters:
p- The position.- Returns:
- true if inside, false otherwise.
clear
public void clear()Reinitializes the contents.equals
Checks if two rectangles are equal.clone
Clones this instance.toString
Formats to a string as "x,y,cx,cy".hashCode
public int hashCode()The hash code.append
Appends the rectangle to a transaction.- Parameters:
trans- The transaction to append to.