|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.display2d.TriangularBinaryLattice
public class TriangularBinaryLattice
A TriangularBinaryLattice is an array where each array element has a value of 0 or 1.
Constructor Summary | |
---|---|
TriangularBinaryLattice(int _nrow,
int _ncol)
Constructs a binary lattice with the given size. |
Method Summary | |
---|---|
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws the lattice. |
byte |
getCell(int _row,
int _col)
Gets a lattice cell value. |
double |
getXMax()
Gets the maximum x needed to draw this object. |
double |
getXMin()
Gets the minimum x needed to draw this object. |
double |
getYMax()
Gets the maximum y needed to draw this object. |
double |
getYMin()
Gets the minimum y needed to draw this object. |
boolean |
isMeasured()
Determines if information is available to set min/max values. |
void |
randomize()
Randomizes the lattice values. |
void |
randomize(double probability)
Randomizes the lattice values with the specified probability. |
void |
setBlock(int row_offset,
int col_offset,
byte[][] val)
Sets a block of cells to new values. |
void |
setBlock(int row_offset,
int col_offset,
int[][] val)
Sets a block of cells to new values. |
void |
setCell(int _row,
int _col,
int val)
Sets a lattice cell to a new value. |
void |
setCol(int row_offset,
int col,
byte[] val)
Sets a column of cells to new values. |
void |
setCol(int row_offset,
int col,
int[] val)
Sets a column of cells to new values. |
void |
setColorPalette(java.awt.Color[] colors)
Sets the color palette. |
void |
setIndexedColor(int i,
java.awt.Color color)
Sets the color for a single index. |
void |
setMinMax(double xmin,
double xmax,
double ymin,
double ymax)
Scales this lattice to the given values in world units. |
void |
setRow(int row,
int col_offset,
byte[] val)
Sets a row of cells to new values starting at the given column. |
void |
setRow(int row,
int col_offset,
int[] val)
Sets a row of cells to new values starting at the given column. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TriangularBinaryLattice(int _nrow, int _ncol)
_nrow
- the number of rows_ncol
- the number of columnsMethod Detail |
---|
public boolean isMeasured()
Measurable
isMeasured
in interface Measurable
public double getXMin()
Measurable
getXMin
in interface Measurable
public double getYMin()
Measurable
getYMin
in interface Measurable
public double getXMax()
Measurable
getXMax
in interface Measurable
public double getYMax()
Measurable
getYMax
in interface Measurable
public void randomize()
public void randomize(double probability)
probability
- the probability of a site being occupied, between 0.0
and 1.0.public void draw(DrawingPanel panel, java.awt.Graphics g)
draw
in interface Drawable
panel
- g
- public void setMinMax(double xmin, double xmax, double ymin, double ymax)
xmin
- xmax
- ymin
- ymax
- public void setBlock(int row_offset, int col_offset, int[][] val)
row_offset
- col_offset
- val
- the array of valuespublic void setBlock(int row_offset, int col_offset, byte[][] val)
row_offset
- col_offset
- val
- the array of valuespublic void setCol(int row_offset, int col, int[] val)
row_offset
- col
- val
- the array of valuespublic void setCol(int row_offset, int col, byte[] val)
row_offset
- col
- val
- the array of valuespublic void setRow(int row, int col_offset, int[] val)
row
- col_offset
- the colum offsetval
- the valuepublic void setRow(int row, int col_offset, byte[] val)
row
- col_offset
- the colum offsetval
- the valuepublic void setCell(int _row, int _col, int val)
_row
- _col
- val
- public byte getCell(int _row, int _col)
_row
- _col
-
public void setColorPalette(java.awt.Color[] colors)
colors
- public void setIndexedColor(int i, java.awt.Color color)
i
- the value to set the color for.color
- public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |