Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
com.example.graphics.model.Line Class Reference
Inheritance diagram for com.example.graphics.model.Line:
Inheritance graph
Collaboration diagram for com.example.graphics.model.Line:
Collaboration graph

Public Member Functions

 Line (int x1, int y1, int x2, int y2)
void accept (ShapeVisitor visitor)
Shape clone ()
int getX ()
int getX1 ()
int getX2 ()
int getY ()
int getY1 ()
int getY2 ()
void setLine (int x1, int y1, int x2, int y2)
void setPoint1 (int x1, int y1)
void setPoint2 (int x2, int y2)
void setPosition (int x, int y)

Private Attributes

int x1
int x2
int y1
int y2

Detailed Description

Line implementation of the Shape interface.

Definition at line 8 of file Line.java.

Constructor & Destructor Documentation

◆ Line()

com.example.graphics.model.Line.Line ( int x1,
int y1,
int x2,
int y2 )
inline

Constructs a line with the specified endpoints

Parameters
x1the x coordinate of the first endpoint
y1the y coordinate of the first endpoint
x2the x coordinate of the second endpoint
y2the y coordinate of the second endpoint

Definition at line 21 of file Line.java.

References x1, x2, y1, and y2.

Referenced by clone().

Here is the caller graph for this function:

Member Function Documentation

◆ accept()

void com.example.graphics.model.Line.accept ( ShapeVisitor visitor)
inline

Accept method for the Visitor pattern

Parameters
visitorthe visitor to accept

Implements com.example.graphics.model.Shape.

Definition at line 117 of file Line.java.

◆ clone()

Shape com.example.graphics.model.Line.clone ( )
inline

Clone the shape

Returns
a clone of this shape

Implements com.example.graphics.model.Shape.

Definition at line 122 of file Line.java.

References Line().

Here is the call graph for this function:

◆ getX()

int com.example.graphics.model.Line.getX ( )
inline

Get the x coordinate of the shape

Returns
x coordinate

Implements com.example.graphics.model.Shape.

Definition at line 29 of file Line.java.

References x1.

◆ getX1()

◆ getX2()

◆ getY()

int com.example.graphics.model.Line.getY ( )
inline

Get the y coordinate of the shape

Returns
y coordinate

Implements com.example.graphics.model.Shape.

Definition at line 34 of file Line.java.

References y1.

◆ getY1()

◆ getY2()

◆ setLine()

void com.example.graphics.model.Line.setLine ( int x1,
int y1,
int x2,
int y2 )
inline

Set both endpoints of the line at once

Parameters
x1the x coordinate of the first endpoint
y1the y coordinate of the first endpoint
x2the x coordinate of the second endpoint
y2the y coordinate of the second endpoint

Definition at line 109 of file Line.java.

References x1, x2, y1, and y2.

◆ setPoint1()

void com.example.graphics.model.Line.setPoint1 ( int x1,
int y1 )
inline

Set the coordinates of the first endpoint

Parameters
x1the x coordinate
y1the y coordinate

Definition at line 87 of file Line.java.

References x1, and y1.

◆ setPoint2()

void com.example.graphics.model.Line.setPoint2 ( int x2,
int y2 )
inline

Set the coordinates of the second endpoint

Parameters
x2the x coordinate
y2the y coordinate

Definition at line 97 of file Line.java.

References x2, and y2.

◆ setPosition()

void com.example.graphics.model.Line.setPosition ( int x,
int y )
inline

Set the position of the shape

Parameters
xthe x coordinate
ythe y coordinate

Implements com.example.graphics.model.Shape.

Definition at line 39 of file Line.java.

References x1, x2, y1, and y2.

Member Data Documentation

◆ x1

int com.example.graphics.model.Line.x1
private

Definition at line 9 of file Line.java.

Referenced by Line(), getX(), getX1(), setLine(), setPoint1(), and setPosition().

◆ x2

int com.example.graphics.model.Line.x2
private

Definition at line 11 of file Line.java.

Referenced by Line(), getX2(), setLine(), setPoint2(), and setPosition().

◆ y1

int com.example.graphics.model.Line.y1
private

Definition at line 10 of file Line.java.

Referenced by Line(), getY(), getY1(), setLine(), setPoint1(), and setPosition().

◆ y2

int com.example.graphics.model.Line.y2
private

Definition at line 12 of file Line.java.

Referenced by Line(), getY2(), setLine(), setPoint2(), and setPosition().


The documentation for this class was generated from the following file:
  • src/main/java/com/example/graphics/model/Line.java