transformation

Class Grid

Known Direct Subclasses:
Filter

public class Grid
extends java.lang.Object

Field Summary

private Color
active
protected int
activeLength
protected int
activeStart
protected int
border
protected FontMetrics
fm
protected Font
font
private static int
gap
(package private) static Color
green
protected int
marginT
protected int
originX
protected int
originY
(package private) static Color
red
private double[]
roundedValues
(package private) static Color
signalRed
private double[]
values

Constructor Summary

Grid()
standard constructor
Grid(double[] values)
creates a Grid-object with values as values
Grid(int length)
creates a Grid-object with length number of values

Method Summary

void
drawGrid(Graphics g, int x, int y, Color fill)
draws a grid at (x,y)
void
drawSingleActiveRegion(Graphics g, int x, int pos, Color active, Color valueColor)
draws the active region containing of only one square
void
drawSingleGrid(Graphics g, int x, int y, Color fill, boolean firstSquare)
draws a grid consisting of a single square.
void
drawValue(Graphics g, int pos)
draws a colored single value into a yet painted grid.
void
drawValue(Graphics g, int pos, Color color)
draws a single value in to a yet painted grid.
void
drawValue(Graphics g, int pos, int x, int y)
draws a single, white value in to a yet painted grid.
double
get(int pos)
Point
getArrowStart(int pos)
returns the point where to attach the starting point of an arrow
Point
getArrowStop(int pos)
returns the point where to attach the ending point of an arrow
int
getBorder()
static int
getGap()
int
getLength()
double
getRounded(int pos)
double[]
getRoundedValues()
double[]
getValues()
int
getWritingPosition()
returns the y-WritingPosition of the values
Point
origin()
int
originY()
void
roundValues()
void
set(int pos, double x)
void
setActive(int start, int length, Color color)
sets the active region of the grid to the active-background-color color
void
setBorder(int b)
static void
setColors(Color gridRed, Color gridGreen, Color signal)
void
setGap(int gap)
void
setOriginX(int x)
void
setValues(double[] values)

Field Details

active

private Color active

activeLength

protected int activeLength

activeStart

protected int activeStart

border

protected int border

fm

protected FontMetrics fm

font

protected Font font

gap

private static int gap

green

(package private) static Color green

marginT

protected int marginT

originX

protected int originX

originY

protected int originY

red

(package private) static Color red

roundedValues

private double[] roundedValues

signalRed

(package private) static Color signalRed

values

private double[] values

Constructor Details

Grid

public Grid()
standard constructor

Grid

public Grid(double[] values)
creates a Grid-object with values as values

Grid

public Grid(int length)
creates a Grid-object with length number of values

Method Details

drawGrid

public void drawGrid(Graphics g,
                     int x,
                     int y,
                     Color fill)
draws a grid at (x,y)
Parameters:
g - Graphics object for graphical context
x - upper left x-position of the grid (see originX)
y - upper left y-position of the grid (see originY)
fill - background color of the grid

drawSingleActiveRegion

public void drawSingleActiveRegion(Graphics g,
                                   int x,
                                   int pos,
                                   Color active,
                                   Color valueColor)
draws the active region containing of only one square
Parameters:
g - Graphics object for graphical context
x - upper left x-position of the active square
active - background color of the square
valueColor - color of the value

drawSingleGrid

public void drawSingleGrid(Graphics g,
                           int x,
                           int y,
                           Color fill,
                           boolean firstSquare)
draws a grid consisting of a single square.
Parameters:
g - Graphics object for graphical context
x - upper left x-position of the square
y - upper left y-position of the square
fill - background color of the grid

drawValue

public void drawValue(Graphics g,
                      int pos)
draws a colored single value into a yet painted grid.
Parameters:
g - Graphics object for the graphics context
pos - adds values[pos] at position pos in the grid
See Also:
drawValue(Graphics, int, Color )

drawValue

public void drawValue(Graphics g,
                      int pos,
                      Color color)
draws a single value in to a yet painted grid.
Parameters:
g - Graphics object for the graphics context
pos - adds values[pos] at position pos in the grid
color - of the writing
See Also:
drawGrid()

drawValue

public void drawValue(Graphics g,
                      int pos,
                      int x,
                      int y)
draws a single, white value in to a yet painted grid.
Parameters:
g - Graphics object for the graphics context
pos - value values[pos] is painted
x - X-Position of the value to be painted
y - Y-Position of the value to be painted

get

public double get(int pos)

getArrowStart

public Point getArrowStart(int pos)
returns the point where to attach the starting point of an arrow
Parameters:
pos - position of the grid where to attach the arrow
Returns:
starting position of an arrow

getArrowStop

public Point getArrowStop(int pos)
returns the point where to attach the ending point of an arrow
Parameters:
pos - position of the grid where to attach the arrow
Returns:
ending position of an arrow

getBorder

public int getBorder()

getGap

public static int getGap()

getLength

public int getLength()

getRounded

public double getRounded(int pos)

getRoundedValues

public double[] getRoundedValues()

getValues

public double[] getValues()

getWritingPosition

public int getWritingPosition()
returns the y-WritingPosition of the values

origin

public Point origin()

originY

public int originY()

roundValues

public void roundValues()

set

public void set(int pos,
                double x)

setActive

public void setActive(int start,
                      int length,
                      Color color)
sets the active region of the grid to the active-background-color color
Parameters:
start - starting position of the active region
length - length of the active region

setBorder

public void setBorder(int b)

setColors

public static void setColors(Color gridRed,
                             Color gridGreen,
                             Color signal)

setGap

public void setGap(int gap)

setOriginX

public void setOriginX(int x)

setValues

public void setValues(double[] values)