|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--element.Line
A line segment object.
Constructor Summary | |
Line()
Construct a trivial line segment at the origin. |
|
Line(int x0,
int y0,
int x1,
int y1)
Construct a line segment from the explicit points. |
|
Line(Line l)
Construct a line segment from another. |
|
Line(Pt p,
Pt q)
Construct a line segment from its two endpoints. |
|
Line(Rect r)
Construct a line segment from (left,top) to (right,bottom) of a rectangle. |
Method Summary | |
int |
bottom()
Return the bottom-most coordinate of the segment. |
void |
bottom(int y)
Move the line segment so that bottom is at y. |
Pt |
center()
Determine the midpoint of the line segment. |
void |
center(Pt p)
Adjust line so that midpoint falls at p. |
void |
clearOn(DrawingWindow d)
Erase the line from the drawing window d in current mode. |
java.lang.Object |
clone()
Return a copy of this line segment. |
boolean |
contains(Pt p)
Return true if the point p is close to the line segment |
void |
drawOn(DrawingWindow d)
Draw the line on the drawing window d in current mode. |
boolean |
equals(java.lang.Object other)
Returns true if two line segments are equal |
void |
fillOn(DrawingWindow d)
Draw the line on the drawing window d in current mode. |
int |
hashCode()
Returns hash code for the line segment. |
int |
height()
Determine the vertical span of the line segment |
Pt |
here()
Returns one endpoint of the line. |
int |
left()
Return the left-most coordinate of the segment. |
void |
left(int x)
Move line segment so that left side is at x. |
int |
right()
Return the right-most coordinate of the segment |
void |
right(int x)
Move line segment so that right side is at x. |
Pt |
there()
Returns other endpoint of the line. |
int |
top()
Return the top-most coordinate of the segment. |
void |
top(int y)
Move the line segment so that top is at y. |
java.lang.String |
toString()
Return a string representation of the line segment |
int |
width()
Determine the horizontal span of the line segment |
protected static boolean |
within(int x,
int low,
int range)
Determine if a value falls between two others. |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Line()
public Line(Line l)
l
- another line segment.public Line(Rect r)
r
- the rectangle.public Line(int x0, int y0, int x1, int y1)
x0
- one x coordinatey0
- one y coordinatex1
- other x coordinatey1
- other y coordinatepublic Line(Pt p, Pt q)
p
- one endpointq
- the other endpointMethod Detail |
public int left()
public int right()
public int top()
public int bottom()
public void left(int x)
x
- new left side of line segmentpublic void right(int x)
x
- new right side of the line segmentpublic void top(int y)
y
- new top side of the line segment.public void bottom(int y)
y
- new bottom side of the line segmentpublic int width()
public int height()
public Pt center()
public void center(Pt p)
p
- the new midpoint of the line.public Pt here()
public Pt there()
protected static boolean within(int x, int low, int range)
public boolean contains(Pt p)
p
- the point in questionpublic void fillOn(DrawingWindow d)
d
- the target window dDrawingWindow.draw(element.Drawable)
,
DrawingWindow.invertMode()
,
DrawingWindow.paintMode()
public void clearOn(DrawingWindow d)
d
- the target window dDrawingWindow.clear(element.Drawable)
,
DrawingWindow.invertMode()
,
DrawingWindow.paintMode()
public void drawOn(DrawingWindow d)
d
- the target window dDrawingWindow.draw(element.Drawable)
,
DrawingWindow.invertMode()
,
DrawingWindow.paintMode()
public int hashCode()
public boolean equals(java.lang.Object other)
other
- the other line segmentpublic java.lang.Object clone()
public java.lang.String toString()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |