public class ComplDemo.ComplexWrapper extends Object implements Comparable<ComplDemo.ComplexWrapper>
Complex
object, adapts it to the
interface Comparable
and adds pixel coordinates and painting in
a specified colourComplDemo
object makes just
three such wrappers: two for operands and one for the result.Modifier and Type | Field and Description |
---|---|
Color |
color
Painting colour for the complex vector.
|
Complex |
cp
The complex number wrapped.
|
int |
lp
Pixel norm.
|
boolean |
noShow
Do not paint.
|
byte |
stat
State.
|
int |
xp
Pixel coordinates.
|
int |
yp
Pixel coordinates.
|
Constructor and Description |
---|
ComplexWrapper(Color color)
Make a wrapper.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ComplDemo.ComplexWrapper other)
Compare the absolute values.
|
void |
consist()
Make pixel and complex values consistent.
|
void |
doThePaint(Graphics g)
Paint as vector.
|
void |
set(Complex cp)
Set the Complex.
|
void |
set(double re,
double im)
Set by real and imaginary part.
|
void |
set(int xp,
int yp)
Set by pixel coordinates x, y.
|
public Complex cp
public Color color
public int xp
public int yp
public int lp
public byte stat
public boolean noShow
public ComplexWrapper(Color color)
color
- the colour for painting the vector (never null!).public void set(Complex cp)
cp
- the complex number (object) to be wrappedpublic void set(double re, double im)
re
- the real part of the complex number (object) to be wrappedim
- its imaginary partpublic void set(int xp, int yp)
xp
- the x-coordinate in pixel unitsyp
- the y-coordinatepublic void consist()
public int compareTo(ComplDemo.ComplexWrapper other)
compareTo
in interface Comparable<ComplDemo.ComplexWrapper>
other
- the other wrapped number to compare with (not null!)lp
) smaller than other's; +: greater