LinearSegment
public 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, sub
protected 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.Exception
public Num f(Num x)
f
in interface LinearSegment
x
- the coordinate whose function value shall be returnedpublic Num getX()
getX
in interface LinearSegment
public void setX(Num x)
setX
in interface LinearSegment
public Num getY()
getY
in interface LinearSegment
public void setY(Num y)
setY
in interface LinearSegment
public Num getGrad()
getGrad
in interface LinearSegment
public void setGrad(Num grad)
setGrad
in interface LinearSegment
public boolean isLeftopen()
isLeftopen
in interface LinearSegment
public void setLeftopen(boolean leftopen)
setLeftopen
in interface LinearSegment
public Num getXIntersectionWith(LinearSegment other)
other
.getXIntersectionWith
in interface LinearSegment
other
- the other segmentpublic LinearSegment_DNC copy()
copy
in interface LinearSegment
public boolean equals(java.lang.Object obj)
equals
in interface LinearSegment
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface LinearSegment
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in interface LinearSegment
toString
in class java.lang.Object