|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavacli.Rectangle
public class Rectangle
Class representing R2-rectangle
Field Summary | |
---|---|
int |
x0
|
int |
x1
|
int |
y0
|
int |
y1
|
Constructor Summary | |
---|---|
Rectangle()
Create rectangle with all zero coordinates |
|
Rectangle(int x0,
int y0,
int x1,
int y1)
Contruct rectangle with specified coordinates |
|
Rectangle(Rectangle r)
Create copy of the rectangle |
Method Summary | |
---|---|
int |
area()
Rectangle area |
boolean |
contains(Rectangle r)
Checks whether this rectangle contains specified r rectangle |
static int |
distance(Rectangle r,
Rectangle q)
Distance between two rectangles |
boolean |
equals(java.lang.Object obj)
Checks whether two rectangles are the same |
int |
hashCode()
Hash code method for references |
void |
join(Rectangle r)
Calculate cover of two rectangles This rectangle is changesd to be the minimal rectangle containing original rectangle and specified rectangles |
static Rectangle |
join(Rectangle p,
Rectangle q)
Calculate cover of two rectangles |
boolean |
overlaps(Rectangle r)
Check whether two rectngles overlaps |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int x0
public int y0
public int x1
public int y1
Constructor Detail |
---|
public Rectangle(int x0, int y0, int x1, int y1)
public Rectangle(Rectangle r)
public Rectangle()
Method Detail |
---|
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static int distance(Rectangle r, Rectangle q)
r
- first rectangleq
- second rectangle
public int area()
public static Rectangle join(Rectangle p, Rectangle q)
p
- first rectangleq
- second rectangle
public void join(Rectangle r)
r
- another rectanglepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean overlaps(Rectangle r)
public boolean contains(Rectangle r)
r
rectangle
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |