1
2
3
4
5
6
7 package com.octo.captcha.sound.gimpy;
8
9 import com.octo.captcha.sound.SoundCaptcha;
10
11 import javax.sound.sampled.AudioInputStream;
12
13 /***
14 * <p>Description: </p>
15 *
16 * @author <a href="mailto:mga@octo.com">Mathieu Gandin</a>
17 * @author Benoit Doumas
18 * @version 1.0
19 */
20 public class GimpySound extends SoundCaptcha {
21
22 private String response;
23
24 public GimpySound(String thequestion,
25 AudioInputStream thechallenge, String theresponse) {
26 super(thequestion, thechallenge);
27 this.response = theresponse;
28 }
29
30 public Boolean validateResponse(Object theresponse) {
31 if ((theresponse != null) && (theresponse instanceof String)) {
32 return this.validateResponse((String) theresponse);
33 } else {
34 return Boolean.FALSE;
35 }
36 }
37
38 public Boolean validateResponse(String theresponse) {
39 return Boolean.valueOf(this.response.equalsIgnoreCase(theresponse));
40 }
41
42 }