AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.example.grid.Grid2.Cell Class Reference

Cell in a Grid2. More...

Public Member Functions

boolean is_free ()
 Can we enter this cell? More...
 
boolean is_tunnel ()
 letters a-z denote entries to tunnels: e.g., all 'a' are connected More...
 

Public Attributes

char value = '\000'
 the value that is displayed More...
 
int color = Terminal.WHITE
 indexed color, see Terminal More...
 
double d = Double.POSITIVE_INFINITY
 distance to source More...
 
double f = Double.POSITIVE_INFINITY
 priority used by A* (distance + estimated distance to destination More...
 
int p = -1
 index of parent cell More...
 

Detailed Description

Cell in a Grid2.

Cells have a char value that is displayed. In addition, cells with the following values can be accessed: white space, letters, and digits. Any other values will be interpreted as "obstacles".

The color attribute can be used for visualization and as a flag (e.g., cell was processed). Note: Whether color can be displayed depends on Terminal.

The remaining attributes are used during traversal (see lecture).

Definition at line 76 of file Grid2.java.

Member Function Documentation

◆ is_free()

boolean aud.example.grid.Grid2.Cell.is_free ( )

Can we enter this cell?

Definition at line 80 of file Grid2.java.

80 {
81 return value=='\000' || value=='.' || value=='*' ||
82 Character.isWhitespace(value) ||
83 Character.isLetterOrDigit(value);
84 }
char value
the value that is displayed
Definition: Grid2.java:78

References aud.example.grid.Grid2.Cell.value.

◆ is_tunnel()

boolean aud.example.grid.Grid2.Cell.is_tunnel ( )

letters a-z denote entries to tunnels: e.g., all 'a' are connected

Definition at line 86 of file Grid2.java.

86{ return 'a'<=value && value<='z'; }

References aud.example.grid.Grid2.Cell.value.

Referenced by aud.example.grid.Grid2.create_tunnels_for().

+ Here is the caller graph for this function:

Member Data Documentation

◆ color

int aud.example.grid.Grid2.Cell.color = Terminal.WHITE

indexed color, see Terminal

Definition at line 89 of file Grid2.java.

◆ d

double aud.example.grid.Grid2.Cell.d = Double.POSITIVE_INFINITY

distance to source

Definition at line 91 of file Grid2.java.

◆ f

double aud.example.grid.Grid2.Cell.f = Double.POSITIVE_INFINITY

priority used by A* (distance + estimated distance to destination

Definition at line 93 of file Grid2.java.

◆ p

int aud.example.grid.Grid2.Cell.p = -1

index of parent cell

Definition at line 95 of file Grid2.java.

◆ value

char aud.example.grid.Grid2.Cell.value = '\000'

the value that is displayed

Definition at line 78 of file Grid2.java.

Referenced by aud.example.grid.Grid2.Cell.is_free(), and aud.example.grid.Grid2.Cell.is_tunnel().


The documentation for this class was generated from the following file: