package relop;

/**
 * The projection operator extracts columns from a relation; unlike in
 * relational algebra, this operator does NOT eliminate duplicate tuples.
 */
public class Projection extends Iterator {
	private Iterator iter;
	private Integer[] fields;

	/**
	 * Constructs a projection, given the underlying iterator and field numbers.
	 */
	public Projection(Iterator iter, Integer... fields) {
		this.iter = iter;
		this.fields = fields;
		this.setSchema(this.iter.getSchema());

		// throw new UnsupportedOperationException("Not implemented");
	}

	/**
	 * Gives a one-line explaination of the iterator, repeats the call on any
	 * child iterators, and increases the indent depth along the way.
	 */
	public void explain(int depth) {
		throw new UnsupportedOperationException("Not implemented");
	}

	/**
	 * Restarts the iterator, i.e. as if it were just constructed.
	 */
	public void restart() {
		throw new UnsupportedOperationException("Not implemented");
	}

	/**
	 * Returns true if the iterator is open; false otherwise.
	 */
	public boolean isOpen() {
		throw new UnsupportedOperationException("Not implemented");
	}

	/**
	 * Closes the iterator, releasing any resources (i.e. pinned pages).
	 */
	public void close() {
		throw new UnsupportedOperationException("Not implemented");
	}

	/**
	 * Returns true if there are more tuples, false otherwise.
	 */
	public boolean hasNext() {
		throw new UnsupportedOperationException("Not implemented");
	}

	/**
	 * Gets the next tuple in the iteration.
	 * 
	 * @throws IllegalStateException
	 *             if no more tuples
	 */
	public Tuple getNext() {
		throw new UnsupportedOperationException("Not implemented");
	}

} // public class Projection extends Iterator

@@ -765,24 +765,122 @@
 depth) %7B%0D%0A%09%09
+// TODO: Done%0D%0A%09%09this.indent(depth++);%0D%0A%09%09System.out.println(%22Projection depth: %22 + depth);%0D%0A%09%09// 
 throw new Un
@@ -1031,32 +1031,76 @@
  restart() %7B%0D%0A%09%09
+// TODO: Done%0D%0A%09%09this.iter.restart();%0D%0A%09%09// 
 throw new Unsupp
@@ -1244,32 +1244,115 @@
 n isOpen() %7B%0D%0A%09%09
+// TODO: Done%0D%0A%09%09if (this.iter.isOpen())%0D%0A%09%09%09return true;%0D%0A%09%09return false;%0D%0A%0D%0A%09%09// 
 throw new Unsupp
@@ -1503,32 +1503,74 @@
 id close() %7B%0D%0A%09%09
+// TODO: Done%0D%0A%09%09this.iter.close();%0D%0A%09%09// 
 throw new Unsupp
@@ -1716,32 +1716,129 @@
  hasNext() %7B%0D%0A%09%09
+// TODO: projection has next%0D%0A%09%09if (this.iter.hasNext())%0D%0A%09%09%09return true;%0D%0A%09%09return false;%0D%0A%09%09// 
 throw new Unsupp
@@ -2042,24 +2042,64 @@
 etNext() %7B%0D%0A
+%09%09// TODO: projection get next tuple%0D%0A%0D%0A
 %09%09throw new 

update projection functions