|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectLine
public class Line
This class models a line in a two-dimensional space.
| Constructor Summary | |
|---|---|
Line(double slope,
double yIntercept)
Constructs a Line by initializing the slope and yIntercept instance variables. |
|
| Method Summary | |
|---|---|
double |
evaluateAt(double xPosition)
Treats this Line as a function and evaluates its y-value at the x-value given. |
double |
getSlope()
Returns the slope of this Line. |
double |
getXIntercept()
Returns the x-intercept of this Line. |
double |
getYIntercept()
Returns the y-intercept of this Line. |
void |
invert()
Changes this line to be its reflection in the line y = x. |
void |
shiftVertical(int yShift)
Changes the position of this Line by shifting it yShift units vertically |
String |
toString()
Returns a String representation of this Line in y = mx + b format where m is the slope and b is the y-intercept. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Line(double slope,
double yIntercept)
slope - The slope of this Line.yIntercept - The y-coordinate of the y-intercept of this Line.| Method Detail |
|---|
public double getXIntercept()
public double getYIntercept()
public double getSlope()
public String toString()
toString in class Objectpublic void shiftVertical(int yShift)
yShift - The number of units to shift the Line.public void invert()
public double evaluateAt(double xPosition)
xPosition - The x-value at which to evaluate the function.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||