package org.khelekore.jsizer;

/** A filter that removes too small classes. */
class SizeFilter {
    private int minNumFields;
    private int minNumMethods;
    private int minNumMethodsLine;
    
    public SizeFilter (int minNumFields, int minNumMethods, 
		       int minNumMethodsLine) {
	this.minNumFields = minNumFields;
	this.minNumMethods = minNumMethods;
	this.minNumMethodsLine = minNumMethodsLine;
    }

    public boolean accept (ClassSize cs) {
	return 
	    (minNumFields > 0 && cs.getNumFields () >= minNumFields) ||
	    (minNumMethods > 0 && cs.getNumMethods () >= minNumMethods) ||
	    (minNumMethodsLine > 0 && 
	     cs.getNumMethodLines () >= minNumMethodsLine);
    }

    public int getMinFields () {
	return minNumFields;
    }

    public int getMinMethods () {
	return minNumMethods;
    }

    public int getMinLines () {
	return minNumMethodsLine;
    }
}
