package com.philisense.www.license;

public class Policy
{
    private static Policy current;
    
    public static void setCurrent(final Policy current) {
        Policy.current = current;
    }
    
    public static Policy getCurrent() {
        if (Policy.current == null) {
            Policy.current = new Policy();
        }
        return Policy.current;
    }
    
    protected Policy() {
    }
    
    public void checkPwd(final String s) {
        final int length = s.length();
        if (length < 6) {
            throw new IllegalPasswordException();
        }
        boolean b = false;
        boolean b2 = false;
        for (int i = 0; i < length; ++i) {
            final char char1 = s.charAt(i);
            if (Character.isLetter(char1)) {
                b = true;
            }
            else if (Character.isDigit(char1)) {
                b2 = true;
            }
        }
        if (!b || !b2) {
            throw new IllegalPasswordException();
        }
    }
}
