com.Bayesia.positioning.event
Class ProgressEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bycom.Bayesia.positioning.event.ProgressEvent
All Implemented Interfaces:
java.io.Serializable

public class ProgressEvent
extends java.util.EventObject

The class ProgressEvent is used to indicate the progress of a positioning algorithm. It can be either GeneticPositioning or SymmetricPositioning

It indicates the current progress of the algorithm, the type of the event (start, progress, end) and the mode of the algorithm (limited or infinite). According to the type of algorithm, it specify the current score and the last individual chosen for the GeneticPositioning algorithm and the preferred length of the edges for the SymmetricPositioning algorithm.

Please see ProgressListener.

Version:
2.0 28/10/04
See Also:
Serialized Form

Field Summary
static int END_EVENT
          Type of the event when the progression ends.
static int INFINITE
          Mode of the algorithm if no number of iterations is specified.
static int LIMITED
          Mode of the algorithm if a number of iterations is specified.
static int PROGRESS_EVENT
          Type of the event when the progression continues.
static int START_EVENT
          Type of the event when the progression starts.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ProgressEvent(java.lang.Object source, int type, int progress, int maximum, double length)
          Create a new ProgressEvent with the current progress, the maximum number of iterations and the preferred length og the edges.
ProgressEvent(java.lang.Object source, int type, int progress, int maximum, double score, int individual)
          Create a new ProgressEvent with the current progress, the maximum number of generations, the last score and the last individual chosen.
 
Method Summary
 int getIndividual()
          Return the last individual chosen in the population.
 double getLength()
          Return the preferred length of the edges according to the available dimension of the graph.
 int getMaximum()
          The maximum number of generations or -1 if no maximum is specified.
 int getMode()
           
 int getProgress()
          The progress is always between 0 and getMaximum() if the maximum is specified.
 double getScore()
          Return the score of the last individual chosen.
 int getType()
          If the progress is 0, it returns START_EVENT, if the progress is 100, it returns END_EVENT, otherwise it returns PROGRESS_EVENT.
 java.lang.String toString()
          Return a String representation of this ProgressEvent.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INFINITE

public static final int INFINITE
Mode of the algorithm if no number of iterations is specified.

See Also:
Constant Field Values

LIMITED

public static final int LIMITED
Mode of the algorithm if a number of iterations is specified.

See Also:
Constant Field Values

START_EVENT

public static final int START_EVENT
Type of the event when the progression starts.

See Also:
Constant Field Values

PROGRESS_EVENT

public static final int PROGRESS_EVENT
Type of the event when the progression continues.

See Also:
Constant Field Values

END_EVENT

public static final int END_EVENT
Type of the event when the progression ends.

See Also:
Constant Field Values
Constructor Detail

ProgressEvent

public ProgressEvent(java.lang.Object source,
                     int type,
                     int progress,
                     int maximum,
                     double score,
                     int individual)
Create a new ProgressEvent with the current progress, the maximum number of generations, the last score and the last individual chosen. Used by GeneticPositioning.

Parameters:
source - the source positioning algorithm (i.e. GeneticPositioning)
type - the type of the event
progress - the current progress
maximum - the maximum number of iterations if specified
score - the current score of the algorithm
individual - the last individual chosen

ProgressEvent

public ProgressEvent(java.lang.Object source,
                     int type,
                     int progress,
                     int maximum,
                     double length)
Create a new ProgressEvent with the current progress, the maximum number of iterations and the preferred length og the edges. Used by SymmetricPositioning.

Parameters:
source - the source positioning algorithm (i.e. SymmetricPositioning)
type - the type of the event
progress - the current progress
maximum - always -1 with the SymmetricPositioning
length - the preferred length og the edges
Method Detail

getMode

public int getMode()
Returns:
the mode of the algorithm.
See Also:
INFINITE, LIMITED

getProgress

public int getProgress()
The progress is always between 0 and getMaximum() if the maximum is specified.

Returns:
the current progress of the algorithm.

getType

public int getType()
If the progress is 0, it returns START_EVENT, if the progress is 100, it returns END_EVENT, otherwise it returns PROGRESS_EVENT.

Returns:
the current type of the event.
See Also:
START_EVENT, PROGRESS_EVENT, END_EVENT

getIndividual

public int getIndividual()
Return the last individual chosen in the population. Used by GeneticPositioning only.

Returns:
the last individual chosen in the population.

getMaximum

public int getMaximum()
The maximum number of generations or -1 if no maximum is specified. Used by GeneticPositioning. Return always -1 with the SymmetricPositioning.

Returns:
the maximum number of generations of the GeneticPositioningAlgorithm

getScore

public double getScore()
Return the score of the last individual chosen. Used by GeneticPositioning only.

Returns:
the score of the last individual chosen.

getLength

public double getLength()
Return the preferred length of the edges according to the available dimension of the graph. Used by SymmetricPositioning only.

Returns:
the preferred length of the edges.

toString

public java.lang.String toString()
Return a String representation of this ProgressEvent.

See Also:
Object.toString()