Package com.iizix
Class Rect
- java.lang.Object
- com.iizix.Rect
- All Implemented Interfaces:
java.lang.Cloneable
public class Rect extends java.lang.Object implements java.lang.CloneableSimple rectangle class for multiple use accepting negative width and height.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description Rect()Constructor for x=y=cx=cy=0.Rect(int x, int y, int cx, int cy)Constructor.Rect(ReadTransaction trans)Constructor from a Transaction.Rect(java.lang.String string)Constructor from a String formatted as "x,y,cx,cy".
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(SendTransaction trans)Appends the rectangle to a transaction.voidclear()Reinitializes the contents.Rectclone()Clones this instance.booleanequals(java.lang.Object o)Checks if two rectangles are equal.inthashCode()The hash code.booleanisInside(Position p)Checks if a position is inside.java.lang.StringtoString()Formats to a string as "x,y,cx,cy".
Field Detail
EMPTY
public static final Rect[] EMPTY
Empty array of Rect's.
x
public int x
The X position of the rectangle.
y
public int y
The Y position of the rectangle.
cx
public int cx
The width of the rectangle.
cy
public int cy
The height of the rectangle.
Constructor Detail
Rect
public Rect()
Constructor for x=y=cx=cy=0.
Rect
public Rect(java.lang.String string)
Constructor from a String formatted as "x,y,cx,cy".- Parameters:
string- The string.- Throws:
java.lang.IllegalArgumentException- If the string is not well formatted.
Rect
public Rect(ReadTransaction trans)
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 Detail
isInside
public boolean isInside(Position p)
Checks if a position is inside.- Parameters:
p- The position.- Returns:
- true if inside, false otherwise.
clear
public void clear()
Reinitializes the contents.
equals
public boolean equals(java.lang.Object o)
Checks if two rectangles are equal.- Overrides:
equalsin classjava.lang.Object
clone
public Rect clone()
Clones this instance.- Overrides:
clonein classjava.lang.Object- Returns:
- As cloned instance of GUnit.
toString
public java.lang.String toString()
Formats to a string as "x,y,cx,cy".- Overrides:
toStringin classjava.lang.Object
hashCode
public int hashCode()
The hash code.- Overrides:
hashCodein classjava.lang.Object
append
public void append(SendTransaction trans)
Appends the rectangle to a transaction.- Parameters:
trans- The transaction to append to.