/*
 * NoCoincideExpresionRegular
 *
 * Created on 1 de Octubre de 2010, 12:47 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.fidufosyga.rules;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 
 * @author 
 */
public class NoCoincideExpresionRegular extends AbstractRule {

	private Pattern pattern;

	public void setParams(Object[] params) {
		String patternStr = (String) params[0];
 		//System.out.println("Matcher: " + patternStr);
		pattern = Pattern.compile(patternStr);
		super.setParams(params);
	}

	public boolean performValidation(String field, String registro[], String nombreArchivo) {

		if(field.length() == 0)
		{
			field = " ";
                        
		}
                
		Matcher matcher = pattern.matcher(field);
 		//System.out.println("Matcher: " + pattern.matcher(field) + "Campo: " + field + "Resultado Evaluacion:" + matcher.find());
		return !matcher.matches();
	}

}
