46 lines
886 B
Java
Raw Normal View History

package input;
/**
* The class handling the parsing of one input.
* @author Victor
*
*/
public class Inputs {
private static final int numberOfInputs = 8;
private static boolean[] tab;
public Inputs() {
this.tab = new boolean[numberOfInputs];
for(int i = 0; i < numberOfInputs; i ++) {
this.tab[i] = false;
}
}
/**
* record one input
* @param i the integer value corresponding to the tab location
*/
public void recordOneInput(int i) {
try {
this.tab[i] = true;
} catch (ArrayIndexOutOfBoundsException e) {
//TODO : what do we do here ? Error message ?
}
}
/**
* Check if a specific input (for example UP) has been recorded
* @param i the integer value corresponding to the input
* @return
*/
public boolean containsInput(Button b) {
return this.tab[b.toInt()];
}
public boolean[] getInputs() {
return this.tab;
}
}