java.lang.Objectjava.util.Observable
SortArray
public class SortArray
This class gives an array of integers for testing sorting algorithms.
| Field Summary | |
|---|---|
(package private) int |
maxSize
The maximum of elements is set with the Limit class |
(package private) java.util.Date |
myDate1
These objects are the internal clocks for the start and stop time; |
(package private) java.util.Date |
myDate2
These objects are the internal clocks for the start and stop time; |
(package private) int |
start
Startindex of the field. |
(package private) long |
startTime
startTime der Uhr in ms. |
(package private) int |
stop
Stopindex of the field. |
(package private) long |
stopTime
stopTime of the clock in ms. |
| Constructor Summary | |
|---|---|
SortArray(int zahl)
Constructor with the maximum number of elemnts. |
|
| Method Summary | |
|---|---|
void |
fillInvers()
Invers filling with values from maximum to zero. |
void |
fillNormal()
Ordered filling with values from zero to maximum -1. |
void |
fillRandom()
The array is filled with random numbers between 1 and the maximum given by the constructor. |
java.lang.String |
getElapsedTime()
The actual elapsed time is returned as String |
int |
getStart()
The lowest array index is returned. |
int |
getStop()
The highest array index is returned. |
boolean |
greater(int platzeins,
int platzzwei)
Two elements are compared. |
boolean |
less(int platzeins,
int platzzwei)
Two elements are compared. |
void |
replace(int von,
int nach)
Two array elements change their places. |
void |
showTime()
The difference between the two saved timestamps is written to the terminal. |
void |
startClock()
The actual time is determined and saved. |
void |
stopClock()
The actual time is determined and saved. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
final int maxSize
Limitjava.util.Date myDate1
java.util.Date myDate2
int start
long startTime
int stop
long stopTime
| Constructor Detail |
|---|
public SortArray(int zahl)
| Method Detail |
|---|
public void fillInvers()
public void fillNormal()
public void fillRandom()
public java.lang.String getElapsedTime()
public int getStart()
public int getStop()
public boolean greater(int platzeins,
int platzzwei)
public boolean less(int platzeins,
int platzzwei)
public void replace(int von,
int nach)
public void showTime()
public void startClock()
public void stopClock()