Move Cephelepod into deprecated_compiler, create captian.sh to handle bootstrapping kraken from backup or from Cephelepod

This commit is contained in:
Nathan Braswell
2016-03-29 12:54:05 -04:00
parent 40c3e428c1
commit c7e50282ad
53 changed files with 51 additions and 19 deletions

View File

@@ -0,0 +1,50 @@
#ifndef REMOVALTRANSFORMATION_H
#define REMOVALTRANSFORMATION_H
#include <queue>
#include <vector>
#include "NodeTransformation.h"
template<class T>
class RemovalTransformation: public NodeTransformation<T,T> {
public:
RemovalTransformation(T toRemove);
~RemovalTransformation();
virtual NodeTree<T>* transform(NodeTree<T>* from);
private:
T toRemove;
};
#endif
template<class T>
RemovalTransformation<T>::RemovalTransformation(T toRemove) {
this->toRemove = toRemove;
}
template<class T>
RemovalTransformation<T>::~RemovalTransformation() {
//
}
template<class T>
NodeTree<T>* RemovalTransformation<T>::transform(NodeTree<T>* from) {
std::queue<NodeTree<T>*> toProcess;
toProcess.push(from);
while(!toProcess.empty()) {
NodeTree<T>* node = toProcess.front();
toProcess.pop();
if (!node)
continue;
std::vector<NodeTree<T>*> children = node->getChildren();
for (int i = 0; i < children.size(); i++) {
if (children[i]->getData() == toRemove)
node->removeChild(children[i]);
else if (children[i])
toProcess.push(children[i]);
}
}
return from;
}