package at.ac.tuwien.kr.alpha;

public class NoGood {
	private final int[] literals;
	private final int head;

	/**
	 * Constructs a NoGood of specified size without a head literal.
	 * @param size
	 */
	public NoGood(int size) {
		this(new int[size], -1);
	}

	public NoGood(int[] literals) {
		this(literals, -1);
	}

	public NoGood(int[] literals, int head) {
		this.literals = literals;
		this.head = head;
	}

	public int size() {
		return literals.length;
	}

	public int getLiteral(int index) {
		return literals[index];
	}

	public void setLiteral(int index, int value) {
		literals[index] = value;
	}

	public int getHead() {
		return head;
	}

	public boolean hasHead() {
		return head >= 0;
	}
}

@@ -29,27 +29,84 @@
 a;%0A%0A
-public class NoGood
+import java.util.Iterator;%0A%0Apublic class NoGood implements Iterable%3CInteger%3E
  %7B%0A%09
@@ -754,11 +754,250 @@
 %3E= 0;%0A%09%7D
+%0A%0A%09@Override%0A%09public Iterator%3CInteger%3E iterator() %7B%0A%09%09return new Iterator%3CInteger%3E() %7B%0A%09%09%09private int i;%0A%0A%09%09%09public boolean hasNext() %7B%0A%09%09%09%09return literals.length %3E i;%0A%09%09%09%7D%0A%0A%09%09%09public Integer next() %7B%0A%09%09%09%09return literals%5Bi++%5D;%0A%09%09%09%7D%0A%09%09%7D;%0A%09%7D
 %0A%7D%0A

Make NoGood an Iterable<Integer>