ikg.eleven.sortarray
Class SortArray

java.lang.Object
  extended byjava.util.Observable
      extended byikg.eleven.sortarray.SortArray

public class SortArray
extends java.util.Observable

This class gives an array of integers for testing sorting and searching algorithms.

Version:
1
Author:
U. Seyer

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
 boolean equal(int platzeins, int platzzwei)
          Two elements are compared.
 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 isEqual(int pos, int value)
          One element of the array at position pos and the the number value are compared.
 boolean isGreater(int pos, int value)
          One element of the array at position pos and the the number value are compared.
 boolean isLess(int pos, int value)
          One element of the array at position pos and the the number value 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

maxSize

final int maxSize
The maximum of elements is set with the Limit class

See Also:
Limit

myDate1

java.util.Date myDate1
These objects are the internal clocks for the start and stop time;


myDate2

java.util.Date myDate2
These objects are the internal clocks for the start and stop time;


start

int start
Startindex of the field.


startTime

long startTime
startTime der Uhr in ms.


stop

int stop
Stopindex of the field.


stopTime

long stopTime
stopTime of the clock in ms.

Constructor Detail

SortArray

public SortArray(int zahl)
Constructor with the maximum number of elemnts.
This number is checked.

Method Detail

equal

public boolean equal(int platzeins,
                     int platzzwei)
Two elements are compared. If element at index one is equal the element at index two true is returned
else false.


fillInvers

public void fillInvers()
Invers filling with values from maximum to zero.


fillNormal

public void fillNormal()
Ordered filling with values from zero to maximum -1.


fillRandom

public void fillRandom()
The array is filled with random numbers between 1 and the maximum
given by the constructor.


getElapsedTime

public java.lang.String getElapsedTime()
The actual elapsed time is returned as String


getStart

public int getStart()
The lowest array index is returned.


getStop

public int getStop()
The highest array index is returned.


greater

public boolean greater(int platzeins,
                       int platzzwei)
Two elements are compared. If element at index one is greater than element at index two true is returned
else false.


isEqual

public boolean isEqual(int pos,
                       int value)
One element of the array at position pos and the the number value are compared. If element at pos one is equal than value true is returned
else false.


isGreater

public boolean isGreater(int pos,
                         int value)
One element of the array at position pos and the the number value are compared. If element at pos one is greater than value true is returned
else false.


isLess

public boolean isLess(int pos,
                      int value)
One element of the array at position pos and the the number value are compared. If element at pos one is less than value true is returned
else false.


less

public boolean less(int platzeins,
                    int platzzwei)
Two elements are compared. If element at index one is less than element at index two true is returned
else false.


replace

public void replace(int von,
                    int nach)
Two array elements change their places. If the main class implements observers
the notifyObservers call will take effect.


showTime

public void showTime()
The difference between the two saved timestamps is written to the terminal.


startClock

public void startClock()
The actual time is determined and saved.


stopClock

public void stopClock()
The actual time is determined and saved.