public class Energies
extends java.lang.Object
The main intended usage is with the various force layout algorithms that use a an "energy" minimization process to compute a layout. This class allows to store the energy at a current step of layout computation and to remember a history of such steps.
At a current step of layout computation, one can accumulate energy in the
current cell of the energies buffer using accumulateEnergy(double)
.
When the step finishes, one calls storeEnergy()
to store this
accumulated energy in a cell of the memory, push a new cell on the memory and
therefore start a new step.
At any time you can get the last energy value computed with
getEnergy()
. Be careful this is not the energy currently accumulated
but the value of the last energy stored with storeEnergy()
. You can
also get at any time the average energy in the memory with
getAverageEnergy()
, as well as an estimate of the stabilization (how
much the energies are varying) using getStabilization()
.
Constructor and Description |
---|
Energies() |
Modifier and Type | Method and Description |
---|---|
void |
accumulateEnergy(double value)
Accumulate some energy in the current energy cell.
|
double |
getAverageEnergy()
The average energy in the whole buffer.
|
int |
getBufferSize()
The number of energy values remembered, the memory.
|
double |
getEnergy()
The last computed energy value.
|
double |
getPreviousEnergyValue(int stepsBack)
A previous energy value.
|
double |
getStabilization()
A number in [0..1] with 1 meaning fully stabilized.
|
void |
storeEnergy()
Add a the current accumulated energy value in the set.
|
public double getEnergy()
public int getBufferSize()
public double getStabilization()
public double getAverageEnergy()
public double getPreviousEnergyValue(int stepsBack)
stepsBack
- The number of steps back in history. This number must not be
larger than the size of the memory (energy buffer) else it is set
to this size.public void accumulateEnergy(double value)
value
- The value to accumulate to the current cell.public void storeEnergy()