<commit_before>/**
 * 
 */
package com.catalyst.sonar.score.batch;

import org.sonar.api.BatchExtension;

/**
 * @author JDunn
 *
 */
public class PointsCalculator implements BatchExtension {
	
	public static final int LOWEST_POINTS = 0;
	public static final double PERCENT = 100.0;
	public static final double MAGNIFY_PACKAGE_TANGLE = 100.0;
	
	/**
	 * The following constants give weight to the lines of code in each class in brackets.
	 */
	public static final double FACTOR1 = 3;
	public static final double BRACKET1 = 30;
	public static final double FACTOR2 = 2;
	public static final double BRACKET2 = 60;
	public static final double FACTOR3 = 1;
	public static final double BRACKET3 = 90;
	public static final double FACTOR4 = 0;

	/**
	 * calculates the base points from the number of lines and classes.
	 * @param lines
	 * @param classes
	 * @return
	 */
	public static double calculateBasePoints(double lines, double classes) {
		double basePoints = 0;
		if (lines <= classes*BRACKET1) {//average lines per class 0 to 30
			basePoints = lines*FACTOR1;
		} else if (lines <= classes*BRACKET2) {//average lines per class 31 to 60
			basePoints = classes*BRACKET1*FACTOR1;
			basePoints += (lines-FACTOR1)*FACTOR2;
		} else if (lines <= classes*BRACKET3) {//average lines per class 61 to 90
			basePoints = classes*BRACKET1*FACTOR1;<commit_msg>PointsCalculator.java:  Turned misplaced javadoc into comment, made class abstract.<commit_after>/**
 * 
 */
package com.catalyst.sonar.score.batch;

import org.sonar.api.BatchExtension;

/**
 * @author JDunn
 *
 */
public abstract class PointsCalculator implements BatchExtension {
	
	public static final int LOWEST_POINTS = 0;
	public static final double PERCENT = 100.0;
	public static final double MAGNIFY_PACKAGE_TANGLE = 100.0;
	
	// The following constants give weight to the lines of code in each class in brackets.
	public static final double FACTOR1 = 3;
	public static final double BRACKET1 = 30;
	public static final double FACTOR2 = 2;
	public static final double BRACKET2 = 60;
	public static final double FACTOR3 = 1;
	public static final double BRACKET3 = 90;
	public static final double FACTOR4 = 0;

	/**
	 * calculates the base points from the number of lines and classes.
	 * @param lines
	 * @param classes
	 * @return
	 */
	public static double calculateBasePoints(double lines, double classes) {
		double basePoints = 0;
		if (lines <= classes*BRACKET1) {//average lines per class 0 to 30
			basePoints = lines*FACTOR1;
		} else if (lines <= classes*BRACKET2) {//average lines per class 31 to 60
			basePoints = classes*BRACKET1*FACTOR1;
			basePoints += (lines-FACTOR1)*FACTOR2;
		} else if (lines <= classes*BRACKET3) {//average lines per class 61 to 90
			basePoints = classes*BRACKET1*FACTOR1;
{'fraction_non_alphanumeric': 0.08588957055214724, 'fraction_numerical': 0.03464453265968964, 'mean_word_length': 3.976660682226212, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3315998', 'n_tokens_mistral': 974, 'n_tokens_neox': 835, 'n_words': 314}