// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/DotChangeAction.java
// public interface DotChangeAction {
// 	/**
// 	 * Perform an action when a dot changes
// 	 * @param index The one dimensional coordinate of the dot that has changed
// 	 * @param on The new state of the dot
// 	 */
// 	public void dotHasChanged(int index, boolean on);
// }


import java.util.ArrayList;
import java.util.List;
import com.escapeindustries.dotmatrix.DotChangeAction;
package com.escapeindustries.dotmatrix.tests;



public class DotChangeCounter implements DotChangeAction {
	
	private List<Integer> dimmed;
	private List<Integer> lit;
	
	public DotChangeCounter() {
		this.dimmed = new ArrayList<Integer>();
		this.lit = new ArrayList<Integer>();
	}

	@Override
	public void dotHasChanged(int index, boolean on) {
		if (on) {
			lit.add(index);
		} else {
			dimmed.add(index);
		}
	}

	public int[] getDotsToDim() {
		return intListToArray(dimmed);
	}
	
	public int[] getDotsToLight() {
		return intListToArray(lit);
	}

	private int[] intListToArray(List<Integer> dimWorking) {
		int[] dim = new int[dimWorking.size()];
		for (int i = 0; i < dimWorking.size(); i++) {
			dim[i] = dimWorking.get(i);
		}
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/DotChangeAction.java
// public interface DotChangeAction {
// 	/**
// 	 * Perform an action when a dot changes
// 	 * @param index The one dimensional coordinate of the dot that has changed
// 	 * @param on The new state of the dot
// 	 */
// 	public void dotHasChanged(int index, boolean on);
// }


// Path: DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/DotChangeCounter.java
import java.util.ArrayList;
import java.util.List;
import com.escapeindustries.dotmatrix.DotChangeAction;

package com.escapeindustries.dotmatrix.tests;



public class DotChangeCounter implements DotChangeAction {
	
	private List<Integer> dimmed;
	private List<Integer> lit;
	
	public DotChangeCounter() {
		this.dimmed = new ArrayList<Integer>();
		this.lit = new ArrayList<Integer>();
	}

	@Override
	public void dotHasChanged(int index, boolean on) {
		if (on) {
			lit.add(index);
		} else {
			dimmed.add(index);
		}
	}

	public int[] getDotsToDim() {
		return intListToArray(dimmed);
	}
	
	public int[] getDotsToLight() {
		return intListToArray(lit);
	}

	private int[] intListToArray(List<Integer> dimWorking) {
		int[] dim = new int[dimWorking.size()];
		for (int i = 0; i < dimWorking.size(); i++) {
			dim[i] = dimWorking.get(i);
		}
		return dim;