2024-06-15 19:55:30 +00:00
|
|
|
|
package logging;
|
|
|
|
|
|
2024-07-02 19:13:30 +00:00
|
|
|
|
import visualisation.HybridWindow;
|
|
|
|
|
|
2024-06-15 19:55:30 +00:00
|
|
|
|
import java.util.Vector;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This class provides a container for log list elements.
|
|
|
|
|
* Use it in assoziation with packages logging and visualization.
|
|
|
|
|
* In general you will not have to extend this class so it is final.
|
|
|
|
|
* @see logging.Algorithm
|
|
|
|
|
* @see logging.LogElement
|
2024-07-02 19:13:30 +00:00
|
|
|
|
* @see HybridWindow
|
2024-06-15 19:55:30 +00:00
|
|
|
|
* @see java.util.Vector
|
2024-07-02 19:13:30 +00:00
|
|
|
|
* @author Bj<EFBFBD>rn Strobel<br><small>
|
2024-06-15 19:55:30 +00:00
|
|
|
|
* University of Cooperative Education Stuttgart,
|
|
|
|
|
* Campus Horb<br>
|
|
|
|
|
* Department of Information Technology<br>
|
|
|
|
|
* it2003<br></small>
|
|
|
|
|
*/
|
|
|
|
|
public final class LogElementList <LOG extends LogElement> extends Vector{
|
|
|
|
|
|
|
|
|
|
/** Index of the Lists actual element.*/
|
|
|
|
|
private int actual;
|
|
|
|
|
/** Determines wether the log element list's index is valid or not.*/
|
|
|
|
|
private boolean initialized;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Standard constructor.
|
|
|
|
|
* Creates an empty uninitialized log list with index -1.
|
|
|
|
|
*/
|
|
|
|
|
public LogElementList() {
|
|
|
|
|
super();
|
|
|
|
|
actual=-1;
|
|
|
|
|
initialized=false;
|
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the log lists actual element identified by member actual.
|
|
|
|
|
* @return the log lists actual element
|
|
|
|
|
*/
|
|
|
|
|
public Object get(){
|
|
|
|
|
return get(actual);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns wether the log element list is initialized or not.
|
|
|
|
|
* @return true if list is initialized, false if not
|
|
|
|
|
*/
|
|
|
|
|
public boolean isInitialized(){
|
|
|
|
|
return initialized;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Clears the log list.
|
|
|
|
|
*/
|
|
|
|
|
public void clear(){
|
|
|
|
|
super.clear();
|
|
|
|
|
actual=-1;
|
|
|
|
|
initialized=false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the actual's element's previous as actual.
|
|
|
|
|
*/
|
|
|
|
|
public void prev(){
|
|
|
|
|
if(actual>0){
|
|
|
|
|
actual--;}
|
|
|
|
|
else{
|
|
|
|
|
actual=0;}
|
|
|
|
|
initialized=true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the actual's element's next as actual.
|
|
|
|
|
*/
|
|
|
|
|
public void next(){
|
|
|
|
|
if(actual<size()-1){
|
|
|
|
|
actual++;}
|
|
|
|
|
else{
|
|
|
|
|
actual=size()-1;}
|
|
|
|
|
initialized=true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the first element as actual.
|
|
|
|
|
*/
|
|
|
|
|
public void first(){
|
|
|
|
|
actual=0;
|
|
|
|
|
initialized=true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the last element as actual.
|
|
|
|
|
*/
|
|
|
|
|
public void last(){
|
|
|
|
|
actual=size()-1;
|
|
|
|
|
initialized=true;
|
|
|
|
|
}
|
|
|
|
|
}
|