// Path: app/src/main/java/de/codecentric/util/TwitterLinkCreator.java
// public class TwitterLinkCreator {
// 
//     public static final Pattern TWITTER_NAME_PATTERN = Pattern.compile("@[a-zA-Z0-9_]+");
// 
//     public static String process(String result) {
//         Matcher m = TWITTER_NAME_PATTERN.matcher(result);
// 
//         while (m.find()) {
//             final String name = m.group();
//             result = result.replaceFirst(name, "<a href=\"http://twitter.com/" + name.substring(1) + "\">" + name + "</a>");
//         }
// 
//         return result;
//     }
// }
// 
// Path: app/src/main/java/de/codecentric/validate/NameValidator.java
// public interface NameValidator {
// 
//     public boolean isValid(String speaker);
// 
// }


import de.codecentric.util.TwitterLinkCreator;
import de.codecentric.validate.NameValidator;
package de.codecentric.validate.impl;


/**
 * Created by adi on 8/21/14.
 */
public class NameValidatorImpl implements NameValidator {

    @Override
    public boolean isValid(String speaker) {

        if (speaker.isEmpty()) {
            return false;
        }

// Path: app/src/main/java/de/codecentric/util/TwitterLinkCreator.java
// public class TwitterLinkCreator {
// 
//     public static final Pattern TWITTER_NAME_PATTERN = Pattern.compile("@[a-zA-Z0-9_]+");
// 
//     public static String process(String result) {
//         Matcher m = TWITTER_NAME_PATTERN.matcher(result);
// 
//         while (m.find()) {
//             final String name = m.group();
//             result = result.replaceFirst(name, "<a href=\"http://twitter.com/" + name.substring(1) + "\">" + name + "</a>");
//         }
// 
//         return result;
//     }
// }
// 
// Path: app/src/main/java/de/codecentric/validate/NameValidator.java
// public interface NameValidator {
// 
//     public boolean isValid(String speaker);
// 
// }


// Path: app/src/main/java/de/codecentric/validate/impl/NameValidatorImpl.java
import de.codecentric.util.TwitterLinkCreator;
import de.codecentric.validate.NameValidator;

package de.codecentric.validate.impl;


/**
 * Created by adi on 8/21/14.
 */
public class NameValidatorImpl implements NameValidator {

    @Override
    public boolean isValid(String speaker) {

        if (speaker.isEmpty()) {
            return false;
        }

        return TwitterLinkCreator.TWITTER_NAME_PATTERN.matcher(speaker).matches();