LinearSegmentpublic class LinearSegment_DNC extends java.lang.Object implements LinearSegment
x0, y0) and continues to the right with
slope grad. If leftopen is true, the
point (x0,y0) is excluded from the segment,
otherwise is included.| Modifier and Type | Field | Description |
|---|---|---|
protected Num |
grad |
The gradient of the linear segment
|
protected boolean |
leftopen |
Whether the point (
x0, y0) is part of the segment
or not. |
protected Num |
x |
The x-coordinate of the linear segment's starting point.
|
protected Num |
y |
The y-coordinate of the linear segment's starting point.
|
| Modifier | Constructor | Description |
|---|---|---|
protected |
LinearSegment_DNC() |
The default constructor.
|
|
LinearSegment_DNC(LinearSegment segment) |
|
|
LinearSegment_DNC(Num x,
Num y,
Num grad,
boolean leftopen) |
A convenient constructor.
|
|
LinearSegment_DNC(java.lang.String segment_str) |
| Modifier and Type | Method | Description |
|---|---|---|
LinearSegment_DNC |
copy() |
Returns a copy of this instance.
|
boolean |
equals(java.lang.Object obj) |
|
Num |
f(Num x) |
Returns the function value of this linear segment at the given x-coordinate.
|
Num |
getGrad() |
|
Num |
getX() |
|
Num |
getXIntersectionWith(LinearSegment other) |
Returns the x-coordinate at which a co-linear line through this segment
intersects a co-linear line through the segment
other. |
Num |
getY() |
|
int |
hashCode() |
|
boolean |
isLeftopen() |
|
void |
setGrad(Num grad) |
|
void |
setLeftopen(boolean leftopen) |
|
void |
setX(Num x) |
|
void |
setY(Num y) |
|
java.lang.String |
toString() |
Returns a string representation of this linear segment.
|
add, createHorizontalLine, createLinearSegment, max, min, subprotected Num x
protected Num y
protected Num grad
protected boolean leftopen
x0, y0) is part of the segment
or not.protected LinearSegment_DNC()
public LinearSegment_DNC(Num x, Num y, Num grad, boolean leftopen)
x - The x-coordinate this segments starts at.y - The y-coordinate this segments starts at.grad - The segments gradient.leftopen - Set the segment to be left-open.public LinearSegment_DNC(LinearSegment segment)
public LinearSegment_DNC(java.lang.String segment_str)
throws java.lang.Exception
java.lang.Exceptionpublic Num f(Num x)
f in interface LinearSegmentx - the coordinate whose function value shall be returnedpublic Num getX()
getX in interface LinearSegmentpublic void setX(Num x)
setX in interface LinearSegmentpublic Num getY()
getY in interface LinearSegmentpublic void setY(Num y)
setY in interface LinearSegmentpublic Num getGrad()
getGrad in interface LinearSegmentpublic void setGrad(Num grad)
setGrad in interface LinearSegmentpublic boolean isLeftopen()
isLeftopen in interface LinearSegmentpublic void setLeftopen(boolean leftopen)
setLeftopen in interface LinearSegmentpublic Num getXIntersectionWith(LinearSegment other)
other.getXIntersectionWith in interface LinearSegmentother - the other segmentpublic LinearSegment_DNC copy()
copy in interface LinearSegmentpublic boolean equals(java.lang.Object obj)
equals in interface LinearSegmentequals in class java.lang.Objectpublic int hashCode()
hashCode in interface LinearSegmenthashCode in class java.lang.Objectpublic java.lang.String toString()
toString in interface LinearSegmenttoString in class java.lang.Object