ProjektGraph/logging/LogElementList.java
2024-07-02 21:13:30 +02:00

102 lines
2.0 KiB
Java
Raw Blame History

package logging;
import visualisation.HybridWindow;
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
* @see HybridWindow
* @see java.util.Vector
* @author Bj<42>rn Strobel<br><small>
* 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;
}
}