Index: src/stackclass.hpp
===================================================================
--- src/stackclass.hpp	(revision 7f3b9d586ee7b40daaed7e586efd3f0d178326f6)
+++ src/stackclass.hpp	(revision 6ac7eeecbbe9724fc31880df564e84ba30311c54)
@@ -10,25 +10,25 @@
  */
 template <typename T> class StackClass {
-  public:
-  StackClass<T>(int dimension);
-  ~StackClass<T>();
-  
-  bool Push(T object);
-  T PopFirst();
-  T PopLast();
-  bool RemoveItem(T ptr);
-  void ClearStack();
-  bool IsEmpty();
-  bool IsFull();
-  int ItemCount();
-  void Output(ofstream *out) const;
-  void TestImplementation(ofstream *out, T test);
-  
-  private:
-    T *StackList;   //!< the list containing the atom pointers
-    int EntryCount;     //!< number of entries in the stack
-    int CurrentLastEntry;   //!< Current last entry (newest item on stack)
-    int CurrentFirstEntry;   //!< Current first entry (oldest item on stack)
-    int NextFreeField;       //!< Current index of next free field
+	public:
+	StackClass<T>(int dimension);
+	~StackClass<T>();
+
+	bool Push(T object);
+	T PopFirst();
+	T PopLast();
+	bool RemoveItem(T ptr);
+	void ClearStack();
+	bool IsEmpty();
+	bool IsFull();
+	int ItemCount();
+	void Output(ofstream *out) const;
+	void TestImplementation(ofstream *out, T test);
+
+	private:
+		T *StackList;	 //!< the list containing the atom pointers
+		int EntryCount;		 //!< number of entries in the stack
+		int CurrentLastEntry;	 //!< Current last entry (newest item on stack)
+		int CurrentFirstEntry;	 //!< Current first entry (oldest item on stack)
+		int NextFreeField;			 //!< Current index of next free field
 };
 
@@ -37,9 +37,9 @@
 template <typename T> StackClass<T>::StackClass(int dimension)
 {
-  CurrentLastEntry = 0;
-  CurrentFirstEntry = 0;
-  NextFreeField = 0;
-  EntryCount = dimension;
-  StackList = (T *) Malloc(sizeof(T)*EntryCount, "StackClass::StackClass: **StackList");
+	CurrentLastEntry = 0;
+	CurrentFirstEntry = 0;
+	NextFreeField = 0;
+	EntryCount = dimension;
+	StackList = (T *) Malloc(sizeof(T)*EntryCount, "StackClass::StackClass: **StackList");
 };
 
@@ -48,5 +48,5 @@
 template <typename T> StackClass<T>::~StackClass()
 {
-  Free((void **)&StackList, "StackClass::StackClass: **StackList");
+	Free((void **)&StackList, "StackClass::StackClass: **StackList");
 };
 
@@ -57,13 +57,13 @@
 template <typename T> bool StackClass<T>::Push(T object)
 {
-  if (!IsFull()) {    // check whether free field is really not occupied
-    StackList[NextFreeField] = object;
-    CurrentLastEntry = NextFreeField;
-    NextFreeField = (NextFreeField + 1) % EntryCount; // step on to next free field
-    return true;
-  } else {
-    cerr << "ERROR: Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl;
-    return false;
-  }
+	if (!IsFull()) {		// check whether free field is really not occupied
+		StackList[NextFreeField] = object;
+		CurrentLastEntry = NextFreeField;
+		NextFreeField = (NextFreeField + 1) % EntryCount; // step on to next free field
+		return true;
+	} else {
+		cerr << "ERROR: Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl;
+		return false;
+	}
 };
 
@@ -74,19 +74,19 @@
 template <typename T> T StackClass<T>::PopFirst()
 {
-  T Walker = NULL;
-  if (!IsEmpty()) {
-    Walker = StackList[CurrentFirstEntry];
-    if (Walker == NULL)
-      cerr << "ERROR: Stack's field is empty!" << endl;
-    StackList[CurrentFirstEntry] = NULL;
-    if (CurrentFirstEntry != CurrentLastEntry) { // hasn't last item been popped as well?
-      CurrentFirstEntry = (CurrentFirstEntry + 1) % EntryCount; // step back from current free field to last used (somehow modulo does not work in -1)
-    } else {
-      CurrentFirstEntry = (CurrentFirstEntry + 1) % EntryCount; // step back from current free field to last used (somehow modulo does not work in -1)
-      CurrentLastEntry = CurrentFirstEntry;
-    }
-  } else
-    cerr << "ERROR: Stack is empty!" << endl; 
-  return Walker;
+	T Walker = NULL;
+	if (!IsEmpty()) {
+		Walker = StackList[CurrentFirstEntry];
+		if (Walker == NULL)
+			cerr << "ERROR: Stack's field is empty!" << endl;
+		StackList[CurrentFirstEntry] = NULL;
+		if (CurrentFirstEntry != CurrentLastEntry) { // hasn't last item been popped as well?
+			CurrentFirstEntry = (CurrentFirstEntry + 1) % EntryCount; // step back from current free field to last used (somehow modulo does not work in -1)
+		} else {
+			CurrentFirstEntry = (CurrentFirstEntry + 1) % EntryCount; // step back from current free field to last used (somehow modulo does not work in -1)
+			CurrentLastEntry = CurrentFirstEntry;
+		}
+	} else
+		cerr << "ERROR: Stack is empty!" << endl;
+	return Walker;
 };
 
@@ -97,17 +97,17 @@
 template <typename T> T StackClass<T>::PopLast()
 {
-  T Walker = NULL;
-  if (!IsEmpty()) {
-    Walker = StackList[CurrentLastEntry];
-    StackList[CurrentLastEntry] = NULL;
-    if (Walker == NULL)
-      cerr << "ERROR: Stack's field is empty!" << endl;
-    NextFreeField = CurrentLastEntry;
-    if (CurrentLastEntry != CurrentFirstEntry)  // has there been more than one item on stack
-      CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount; // step back from current free field to last (modulo does not work in -1, thus go EntryCount-1 instead)
-  } else {
-    cerr << "ERROR: Stack is empty!" << endl;
-  } 
-  return Walker;
+	T Walker = NULL;
+	if (!IsEmpty()) {
+		Walker = StackList[CurrentLastEntry];
+		StackList[CurrentLastEntry] = NULL;
+		if (Walker == NULL)
+			cerr << "ERROR: Stack's field is empty!" << endl;
+		NextFreeField = CurrentLastEntry;
+		if (CurrentLastEntry != CurrentFirstEntry)	// has there been more than one item on stack
+			CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount; // step back from current free field to last (modulo does not work in -1, thus go EntryCount-1 instead)
+	} else {
+		cerr << "ERROR: Stack is empty!" << endl;
+	}
+	return Walker;
 };
 
@@ -120,78 +120,78 @@
 template <typename T> bool StackClass<T>::RemoveItem(T ptr)
 {
-  bool found = false;
-  cout << Verbose(5) << "First " << CurrentFirstEntry<< "\tLast " << CurrentLastEntry<< "\tNext " << NextFreeField<< "\tCount " << EntryCount<< "." << endl;
-  int i=CurrentFirstEntry;
-  if (!IsEmpty())
-    do {
-      if (StackList[i] == ptr) {  // if item found, remove
-        cout << Verbose(5) << "Item " << *ptr << " was number " << i << " on stack, removing it." << endl;
-        found = true;
-        StackList[i] = NULL;
-      }
-      if ((found) && (StackList[i] != NULL)) {  // means we have to shift (and not the removed item)
-        if (i == 0) { // we are down to first item in stack, have to put onto last item
-          cout << Verbose(5) << "Shifting item 0 to place " << EntryCount-1 << "." << endl;
-          StackList[EntryCount-1] = StackList[0];
-        } else {
-          cout << Verbose(5) << "Shifting item " << i << " to place " << i-1 << "." << endl;
-          StackList[i-1] = StackList[i];
-        }
-      }
-      i=((i + 1) % EntryCount); // step on
-    } while (i!=NextFreeField);
-  else
-    cerr << "ERROR: Stack is already empty!" << endl;
-  if (found) {
-    NextFreeField = CurrentLastEntry;
-    if (CurrentLastEntry != CurrentFirstEntry)  // has there been more than one item on stack
-      CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount;
-  }
-  return found;
+	bool found = false;
+	cout << Verbose(5) << "First " << CurrentFirstEntry<< "\tLast " << CurrentLastEntry<< "\tNext " << NextFreeField<< "\tCount " << EntryCount<< "." << endl;
+	int i=CurrentFirstEntry;
+	if (!IsEmpty())
+		do {
+			if (StackList[i] == ptr) {	// if item found, remove
+				cout << Verbose(5) << "Item " << *ptr << " was number " << i << " on stack, removing it." << endl;
+				found = true;
+				StackList[i] = NULL;
+			}
+			if ((found) && (StackList[i] != NULL)) {	// means we have to shift (and not the removed item)
+				if (i == 0) { // we are down to first item in stack, have to put onto last item
+					cout << Verbose(5) << "Shifting item 0 to place " << EntryCount-1 << "." << endl;
+					StackList[EntryCount-1] = StackList[0];
+				} else {
+					cout << Verbose(5) << "Shifting item " << i << " to place " << i-1 << "." << endl;
+					StackList[i-1] = StackList[i];
+				}
+			}
+			i=((i + 1) % EntryCount); // step on
+		} while (i!=NextFreeField);
+	else
+		cerr << "ERROR: Stack is already empty!" << endl;
+	if (found) {
+		NextFreeField = CurrentLastEntry;
+		if (CurrentLastEntry != CurrentFirstEntry)	// has there been more than one item on stack
+			CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount;
+	}
+	return found;
 };
 
 /** Test the functionality of the stack.
  * \param *out ofstream for debugging
- * \param *test one item to put on stack  
+ * \param *test one item to put on stack
  * \return true - all tests worked correctly
  */
 template <typename T> void StackClass<T>::TestImplementation(ofstream *out, T test)
 {
-  T Walker = test;
-  *out << Verbose(1) << "Testing the snake stack..." << endl;
-  for (int i=0;i<EntryCount;i++) {
-    *out << Verbose(2) << "Filling " << i << "th element of stack." << endl; 
-    Push(Walker);
-    Walker=Walker->next;
-  }
-  *out << endl;
-  Output(out);
-  if (IsFull())
-    *out << "Stack is full as supposed to be!" << endl;
-  else
-    *out << "ERROR: Stack is not as full as supposed to be!" << endl;
-  //if (StackList[(EntryCount+1)/2] != NULL) {
-    *out << "Removing element in the middle ..." << endl;
-    RemoveItem(StackList[(EntryCount+1)/2]);
-    Output(out);
-  //}
-  //if (StackList[CurrentFirstEntry] != NULL) {
-    *out << "Removing first element  ..." << endl;
-    RemoveItem(StackList[CurrentFirstEntry]);
-    Output(out);
-  //}
-  //if (StackList[CurrentLastEntry] != NULL) {
-    *out << "Removing last element ..." << endl;
-    RemoveItem(StackList[CurrentLastEntry]);
-    Output(out);
-  //}
-  *out << "Clearing stack ... " << endl;  
-  ClearStack();
-  Output(out);
-  if (IsEmpty())
-    *out << "Stack is empty as supposed to be!" << endl;
-  else
-    *out << "ERROR: Stack is not as empty as supposed to be!" << endl;
-  *out << "done." << endl;
+	T Walker = test;
+	*out << Verbose(1) << "Testing the snake stack..." << endl;
+	for (int i=0;i<EntryCount;i++) {
+		*out << Verbose(2) << "Filling " << i << "th element of stack." << endl;
+		Push(Walker);
+		Walker=Walker->next;
+	}
+	*out << endl;
+	Output(out);
+	if (IsFull())
+		*out << "Stack is full as supposed to be!" << endl;
+	else
+		*out << "ERROR: Stack is not as full as supposed to be!" << endl;
+	//if (StackList[(EntryCount+1)/2] != NULL) {
+		*out << "Removing element in the middle ..." << endl;
+		RemoveItem(StackList[(EntryCount+1)/2]);
+		Output(out);
+	//}
+	//if (StackList[CurrentFirstEntry] != NULL) {
+		*out << "Removing first element	..." << endl;
+		RemoveItem(StackList[CurrentFirstEntry]);
+		Output(out);
+	//}
+	//if (StackList[CurrentLastEntry] != NULL) {
+		*out << "Removing last element ..." << endl;
+		RemoveItem(StackList[CurrentLastEntry]);
+		Output(out);
+	//}
+	*out << "Clearing stack ... " << endl;
+	ClearStack();
+	Output(out);
+	if (IsEmpty())
+		*out << "Stack is empty as supposed to be!" << endl;
+	else
+		*out << "ERROR: Stack is not as empty as supposed to be!" << endl;
+	*out << "done." << endl;
 };
 
@@ -201,16 +201,16 @@
 template <typename T> void StackClass<T>::Output(ofstream *out) const
 {
-  *out << "Contents of Stack: ";
-  for(int i=0;i<EntryCount;i++) {
-    *out << "\t";
-    if (i == CurrentFirstEntry)
-      *out << " 1";
-    if  (i == CurrentLastEntry)
-      *out << " "<< EntryCount;
-    if (i ==  NextFreeField)
-      *out << " F";
-    *out << ": " << StackList[i];
-  }
-  *out << endl;
+	*out << "Contents of Stack: ";
+	for(int i=0;i<EntryCount;i++) {
+		*out << "\t";
+		if (i == CurrentFirstEntry)
+			*out << " 1";
+		if	(i == CurrentLastEntry)
+			*out << " "<< EntryCount;
+		if (i ==	NextFreeField)
+			*out << " F";
+		*out << ": " << StackList[i];
+	}
+	*out << endl;
 };
 
@@ -222,5 +222,5 @@
 template <typename T> bool StackClass<T>::IsEmpty()
 {
-  return((NextFreeField == CurrentFirstEntry) && (CurrentLastEntry == CurrentFirstEntry));
+	return((NextFreeField == CurrentFirstEntry) && (CurrentLastEntry == CurrentFirstEntry));
 };
 
@@ -232,5 +232,5 @@
 template <typename T> bool StackClass<T>::IsFull()
 {
-  return((NextFreeField == CurrentFirstEntry) && (CurrentLastEntry != CurrentFirstEntry));
+	return((NextFreeField == CurrentFirstEntry) && (CurrentLastEntry != CurrentFirstEntry));
 };
 
@@ -242,6 +242,6 @@
 template <typename T> int StackClass<T>::ItemCount()
 {
-  //cout << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tEntryCount " << EntryCount << "." << endl;
-  return((NextFreeField + (EntryCount - CurrentFirstEntry)) % EntryCount);
+	//cout << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tEntryCount " << EntryCount << "." << endl;
+	return((NextFreeField + (EntryCount - CurrentFirstEntry)) % EntryCount);
 };
 
@@ -251,9 +251,9 @@
 template <typename T> void StackClass<T>::ClearStack()
 {
-  for(int i=EntryCount; i--;)
-    StackList[i] = NULL;
-  CurrentFirstEntry = 0;
-  CurrentLastEntry = 0;
-  NextFreeField = 0;
+	for(int i=EntryCount; i--;)
+		StackList[i] = NULL;
+	CurrentFirstEntry = 0;
+	CurrentLastEntry = 0;
+	NextFreeField = 0;
 };
 
