import java.io.Serializable; import java.util.Arrays; public class MCVraag implements Serializable { private static final long serialVersionUID = 912; private String vraag; private String[] antwoord; private boolean[] correct; public MCVraag(String vraag, String[] antwoord, boolean[] correct) { this.vraag = vraag; this.antwoord = antwoord; this.correct = correct; } public String getVraag() { return vraag; } public boolean isCorrect(boolean[] antwoord) { for(int i = 0; i < correct.length; i++) if(correct[i] != antwoord[i]) return false; return true; } public int getAantalAntwoorden() { return antwoord.length; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(antwoord); result = prime * result + Arrays.hashCode(correct); result = prime * result + ((vraag == null) ? 0 : vraag.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MCVraag other = (MCVraag) obj; if (!Arrays.equals(antwoord, other.antwoord)) return false; if (!Arrays.equals(correct, other.correct)) return false; if (vraag == null) { if (other.vraag != null) return false; } else if (!vraag.equals(other.vraag)) return false; return true; } @Override public String toString() { return "'" + vraag + "'"; } }