Index: src/ChangeTracker.cpp
===================================================================
--- src/ChangeTracker.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/ChangeTracker.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,46 @@
+/*
+ * ChangeTracker.cpp
+ *
+ *  Created on: Mar 1, 2010
+ *      Author: metzler
+ */
+
+#include "ChangeTracker.hpp"
+
+ChangeTracker* ChangeTracker::instance = NULL;
+
+ChangeTracker::ChangeTracker() {
+  isConsistent = true;
+  World::get()->signOn(this);
+}
+
+ChangeTracker::~ChangeTracker() {
+  World::get()->signOff(this);
+}
+
+ChangeTracker* ChangeTracker::get() {
+  if (instance == NULL) {
+    instance = new ChangeTracker();
+  }
+
+  return instance;
+}
+
+void ChangeTracker::destroy() {
+  delete instance;
+  instance = NULL;
+}
+
+void ChangeTracker::update(Observable *publisher) {
+  isConsistent = false;
+}
+
+bool ChangeTracker::hasChanged() {
+  return !isConsistent;
+}
+
+void ChangeTracker::saveStatus() {
+  if (hasChanged()) {
+    notifyAll();
+  }
+}
Index: src/ChangeTracker.hpp
===================================================================
--- src/ChangeTracker.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/ChangeTracker.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,37 @@
+/*
+ * ChangeTracker.hpp
+ *
+ *  Created on: Mar 1, 2010
+ *      Author: metzler
+ */
+
+#ifndef CHANGETRACKER_HPP_
+#define CHANGETRACKER_HPP_
+
+#include "Patterns/Observer.hpp"
+#include "World.hpp"
+
+using namespace std;
+
+/**
+ * Observes the world and notifies subscribers via saveStatus if there are
+ * changes to it.
+ */
+class ChangeTracker : public Observable {
+public:
+  void saveStatus();
+  static ChangeTracker* get();
+  static void destroy();
+
+protected:
+  void update(Observable *publisher);
+  bool hasChanged();
+
+private:
+  bool isConsistent;
+  static ChangeTracker* instance;
+  ChangeTracker();
+  ~ChangeTracker();
+};
+
+#endif /* CHANGETRACKER_HPP_ */
Index: src/FormatParser.cpp
===================================================================
--- src/FormatParser.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/FormatParser.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,31 @@
+/*
+ * FormatParser.cpp
+ *
+ *  Created on: Mar 1, 2010
+ *      Author: metzler
+ */
+
+#include "FormatParser.hpp"
+
+FormatParser::FormatParser() {
+  ChangeTracker::get()->signOn(this);
+}
+
+FormatParser::~FormatParser() {
+  ChangeTracker::get()->signOff(this);
+}
+
+/**
+ * Parses a file into a matrix container.
+ *
+ * \param absolute path of the file
+ * \param number of lines to skip initially (will be stored as header)
+ * \param number of columns to skip initially
+ * \return matrix container
+ */
+MatrixContainer* readData(char* fileName, int skiplines, int skipcolumns) {
+  MatrixContainer* result = new MatrixContainer();
+//  result->ParseMatrix(*fileName, skiplines, skipcolumns, 0);
+
+  return result;
+}
Index: src/FormatParser.hpp
===================================================================
--- src/FormatParser.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/FormatParser.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,29 @@
+/*
+ * FormatParser.hpp
+ *
+ *  Created on: Mar 1, 2010
+ *      Author: metzler
+ */
+
+#ifndef FORMATPARSER_HPP_
+#define FORMATPARSER_HPP_
+
+#include "Patterns/Observer.hpp"
+#include "ChangeTracker.hpp"
+#include "parser.hpp"
+
+using namespace std;
+
+class FormatParser : public Observer {
+public:
+  FormatParser();
+  ~FormatParser();
+  virtual void save(char* fileName);
+  virtual void load(char* fileName);
+
+private:
+  MatrixContainer* readData(char* fileName, int skiplines, int skipcolumns);
+  virtual int getHeaderSize(char identifier);
+};
+
+#endif /* FORMATPARSER_HPP_ */
Index: src/Matrix.cpp
===================================================================
--- src/Matrix.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/Matrix.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,192 @@
+/*
+ * Matrix.cpp
+ *
+ *  Created on: Mar 2, 2010
+ *      Author: metzler
+ */
+
+/**
+ * Gets the value as string.
+ */
+string FieldContent::getAsString() {
+  return value;
+}
+
+/**
+ * Gets the value as integer.
+ */
+int FieldContent::getAsInt() {
+  return value.intVal();
+}
+
+/**
+ * Gets the value as double.
+ */
+double FieldContent::getAsDouble() {
+  return value.getAsdouble();
+}
+
+/**
+ * Sets the value as string.
+ */
+void FieldContent::set(string valueToSet) {
+  value = valueToSet;
+}
+
+/**
+ * Sets the value as string.
+ */
+void FieldContent::set(int valueToSet) {
+  value = string(valueToSet);
+}
+
+/**
+ * Sets the value as string.
+ */
+void FieldContent::set(double valueToSet) {
+  value = string(valueToSet);
+}
+
+/**
+ * Matrix constructor.
+ *
+ * \param number of rows to initialize the matrix with
+ * \param number of columns to initialize the matrix with
+ */
+Matrix::Matrix() {
+  fields = new vector<vector<FieldContent> >();
+}
+
+/**
+ * Matrix destructor.
+ */
+Matrix::~Matrix() {
+  vector<vector<FieldContent> >::iterator row;
+  for (row = fields.begin(); row < fields.end(); it++ )
+    delete(*row);
+
+  delete(fields);
+  delete(header);
+}
+
+/**
+ * Sets the matrix header.
+ *
+ * \param char* matrix header
+ */
+void setHeader(const string text) {
+  header = text;
+}
+
+/**
+ * Gets the header.
+ */
+string getHeader() {
+  return header;
+}
+
+/**
+ * Gets the number of rows.
+ */
+int getNumberOfRows() {
+  return numberOfRows;
+}
+
+/**
+ * Gets the number of columns.
+ */
+int getNumberOfColumns() {
+  return numberOfColumns;
+}
+
+/**
+ * Sets the value of a field.
+ *
+ * \param row index
+ * \param column index
+ * \param value to set
+ */
+void setField(int rowIndex, int columnIndex, FieldContent value) {
+  fields[rowIndex][columnIndex] = value;
+}
+
+/**
+ * Gets the value of a field.
+ *
+ * \param row index
+ * \param column index
+ */
+FieldContent getField(int rowIndex, int columnIndex) {
+  return fields[rowIndex][columnIndex];
+}
+
+/**
+ * Constructor which initializes the reader with default delimiters.
+ */
+MatrixReader::MatrixReader() : skipBegin('#'), skipEnd('\n'),
+    columnSeparator('\t'), rowBegin(''), rowEnd('\n') {}
+
+/**
+ * Constructor for customized delimiters.
+ *
+ * \param column separating character
+ * \param row begin indicator
+ * \param row end indicator
+ * \param comment begin indicator
+ * \param comment end indicator
+ */
+MatrixReader::MatrixReader(char columnSep, char rowInitializer, char rowTerminator, char skipInitiator, char skipTerminator) :
+    skipBegin(skipInitiator), skipEnd(skipTerminator), columnSeparator(columnSep),
+    rowBegin(rowInitializer), rowEnd(rowTerminator) {}
+
+/**
+ * Determines the number of columns assuming that the number of columns found in
+ * the first data line is appropriate for all other lines.
+ *
+ * \return number of columns
+ */
+int MatrixReader::determineNumberOfColumns() {
+
+}
+
+/**
+ * Reads a matrix from a given file using the default delimiter set consisting
+ * of \t (tab) separating columns and \n (newline) separating rows if not
+ * initialized differently
+ *
+ * \param file name where to read the matrix from
+ * \param number of initial rows to skip
+ * \param number of initial columns to skip
+ */
+Matrix* MatrixReader::read(char* fileName, int rowOffset, int columnOffset) {
+
+}
+
+/**
+ * Writes a matrix to a file.
+ *
+ * \param file name
+ * \param matrix to write
+ * \param column separating character
+ * \param row begin indicating character
+ * \param row end indicating character
+ */
+void write(char* fileName, Matrix* matrix, char columnSeparator, char rowInitializer, char rowTerminator) {
+  ofstream output;
+  stringstream line;
+
+  line << fileName;
+  output.open(line.str().c_str(), ios::out);
+  if (output == NULL) {
+    throw new Exception("Unable to open matrix output file %s.\n", line.str());
+  }
+  output << matrix->getHeader() << endl;
+  for(int i = 0; i < matrix->getNumberOfRows(); i++) {
+    output << rowInitializer;
+    for(int j = 0; j < matrix->getNumberOfColumns(); j++) {
+      output << scientific << matrix->getField(j, k) << columnSeparator;
+    }
+    output << rowTerminator;
+  }
+  output.close();
+}
Index: src/Matrix.hpp
===================================================================
--- src/Matrix.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/Matrix.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,77 @@
+/*
+ * Matrix.hpp
+ *
+ *  Created on: Mar 2, 2010
+ *      Author: metzler
+ */
+
+#ifndef MATRIX_HPP_
+#define MATRIX_HPP_
+
+#include "memoryallocator.hpp"
+#include <vector>
+
+using namespace std;
+
+/**
+ * "Generic" field content type. Holds a value as its string representation as
+ * to use in a text file.
+ */
+class FieldContent {
+public:
+  string getAsString();
+  int getAsInt();
+  double getAsDouble();
+  void set(string valueToSet);
+  void set(int valueToSet);
+  void set(double valueToSet);
+private:
+  string value;
+};
+
+/**
+ * Holds the data of a matrix.
+ */
+class Matrix {
+public:
+  Matrix(int rows, int columns);
+  ~Matrix();
+  void setHeader(const string text);
+  string getHeader();
+  int getNumberOfRows();
+  int getNumberOfColumns();
+  void setField(int rowIndex, int columnIndex, FieldContent value);
+  FieldContent getField(int rowIndex, int columnIndex);
+
+private:
+  string header;
+  vector<vector<FieldContent> > fields;
+};
+
+/**
+ * Reads matrix with any formatting from a file.
+ */
+class MatrixReader {
+public:
+  MatrixReader();
+  MatrixReader(char columnSep, char rowInitializer, char rowTerminator, char skipInitiator, char skipTerminator);
+  Matrix* read(char* fileName, int rowOffset, int columnOffset);
+
+private:
+  int determineNumberOfColumns();
+  char skipBegin;
+  char skipEnd;
+  char columnSeparator;
+  char rowBegin;
+  char rowEnd;
+};
+
+/**
+ * Writes a matrix with any formatting to a file.
+ */
+class MatrixWriter {
+public:
+  void write(char* fileName, Matrix* matrix, char columnSeparator, char rowInitializer, char rowTerminator);
+};
+
+#endif /* MATRIX_HPP_ */
Index: src/TremoloParser.cpp
===================================================================
--- src/TremoloParser.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/TremoloParser.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,21 @@
+/*
+ * TremoloParser.cpp
+ *
+ *  Created on: Mar 2, 2010
+ *      Author: metzler
+ */
+
+void TremoloParser::load(char* fileName) {
+MatrixContainer* data = readData(fileName, getHeaderSize('#'), 0);
+store additional data
+for (each line in matrix) {
+  add atom to the world
+}
+}
+
+void TremoloParser::save(char* fileName) {
+write header
+for (each atom in world) {
+  write coordinates and additional data
+}
+}
Index: src/TremoloParser.hpp
===================================================================
--- src/TremoloParser.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/TremoloParser.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,23 @@
+/*
+ * TremoloParser.hpp
+ *
+ *  Created on: Mar 2, 2010
+ *      Author: metzler
+ */
+
+#ifndef TREMOLOPARSER_HPP_
+#define TREMOLOPARSER_HPP_
+
+#include "FormatParser.hpp"
+#include "World.hpp"
+
+class TremoloParser : public FormatParser {
+public:
+  void load(char* fileName);
+  void save(char* fileName);
+
+private:
+  void* moreData;
+};
+
+#endif /* TREMOLOPARSER_HPP_ */
Index: src/XyzParser.cpp
===================================================================
--- src/XyzParser.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/XyzParser.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,26 @@
+/*
+ * XyzParser.cpp
+ *
+ *  Created on: Mar 2, 2010
+ *      Author: metzler
+ */
+
+void XyzParser::load(char* fileName) {
+MatrixContainer* data = readData(fileName, 2, 0);
+comment
+for (each line in matrix) {
+  add atom to the world
+}
+}
+
+void XyzParser::save(char* fileName) {
+write number of atoms to file
+write comment from original header to file or sum formula if there is none
+for (each atom in world) {
+  write coordinates
+}
+}
+
+int getHeaderSize(char identifier) {
+  return 2;
+}
Index: src/XyzParser.hpp
===================================================================
--- src/XyzParser.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/XyzParser.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,24 @@
+/*
+ * XyzParser.hpp
+ *
+ *  Created on: Mar 2, 2010
+ *      Author: metzler
+ */
+
+#ifndef XYZPARSER_HPP_
+#define XYZPARSER_HPP_
+
+#include "FormatParser.hpp"
+#include "World.hpp"
+
+class XyZParser : public FormatParser {
+public:
+  void load(char* fileName);
+  void save(char* fileName);
+
+private:
+  char* comment;
+  int getHeaderSize(char identifier);
+};
+
+#endif /* XYZPARSER_HPP_ */
Index: src/unittests/MatrixUnitTest.cpp
===================================================================
--- src/unittests/MatrixUnitTest.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/unittests/MatrixUnitTest.cpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,47 @@
+/*
+ * MatrixUnitTest.cpp
+ *
+ *  Created on: Mar 3, 2010
+ *      Author: metzler
+ */
+
+#include "MatrixUnitTest.hpp"
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include <boost/bind.hpp>
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( MatrixUnitTest );
+
+
+void MatrixUnitTest::setUp() {
+//  testMatrix = new Matrix(3, 4);
+}
+
+void MatrixUnitTest::tearDown() {
+//  delete(testMatrix);
+}
+
+/************************************ tests ***********************************/
+
+void MatrixUnitTest::setAndGetHeaderTest() {
+//  testMatrix->setHeader("foo bar");
+//  CPPUNIT_ASSERT_EQUAL( "foo bar", testMatrix->getHeader() );
+}
+
+void MatrixUnitTest::assignAndGetValuesTest() {
+//  testMatrix->setField(0, 0, (void*) "foo bar");
+//  CPPUNIT_ASSERT_TRUE( strcmp("foo bar", (char*) testMatrix->getField(0, 0)) == 0 );
+//  testMatrix->setField(0, 1, (void*) "12.25");
+//  CPPUNIT_ASSERT_EQUAL( 12.25, (float) testMatrix->getField(0,1) );
+//  testMatrix->setField(0, 2, (void*) "3");
+//  CPPUNIT_ASSERT_EQUAL( 3, (int) testMatrix->getField(0, 2) );
+}
+
Index: src/unittests/MatrixUnitTest.hpp
===================================================================
--- src/unittests/MatrixUnitTest.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
+++ src/unittests/MatrixUnitTest.hpp	(revision 6bc51d7e039a246cef5026ea3b2aba64674a5b59)
@@ -0,0 +1,27 @@
+/*
+ * MatrixUnitTest.hpp
+ *
+ *  Created on: Mar 3, 2010
+ *      Author: metzler
+ */
+
+#include <cppunit/extensions/HelperMacros.h>
+#include "Matrix.hpp"
+
+class MatrixUnitTest :  public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( MatrixUnitTest ) ;
+  CPPUNIT_TEST ( setAndGetHeaderTest );
+  CPPUNIT_TEST ( assignAndGetValuesTest );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp();
+  void tearDown();
+
+  void setAndGetHeaderTest();
+  void assignAndGetValuesTest();
+
+private:
+  Matrix* testMatrix;
+};
