private EvaluatedRelation project(EvaluatedRelation relation, Set<Attribute> newHeading) {
Set<Tuple> newTuples = new HashSet<Tuple>();
Set<Tuple> tuples = relation.getTuples();
for (Tuple tuple : tuples) {
Tuple newTuple = createNewTuples(tuple, newHeading);
// TODO (AN) Only add non empty attributes - this failed.
if (!newTuple.getAttributeValues().isEmpty()) {
newTuples.add(newTuple);
}
}
// TODO (AN) Used to just be getRelation(newHeading) - this failed.