--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2006 by Michael Andreen *
+ * andreen@student.chalmers.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
+ ***************************************************************************/
+
+#ifndef __REVERSEACTION_H__
+#define __REVERSEACTION_H__
+
+#include "sortaction.h"
+/**
+ * Reverses an interval
+ *
+ * \author Michael Andreen
+ */
+class ReverseAction : public SortAction{
+ public:
+
+ /**
+ * Creates a new reverse action for the interval [i,j]
+ */
+ ReverseAction(size_t i, size_t j):_i(i),_j(j){}
+
+ /**
+ * Sort SortActions by score
+ */
+ virtual GeneOrder& operator()(GeneOrder& go) const{
+ go.reverse(_i,_j);
+ return go;
+ }
+
+ virtual bool operator==(const SortAction& sa) const{
+ if (const ReverseAction* psa = dynamic_cast<const ReverseAction*>(&sa)){
+ if (_i == psa->_i && _j == psa->_j)
+ return true;
+ }
+ return false;
+ }
+ private:
+ size_t _i;
+ size_t _j;
+};
+
+#endif
+