All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.kit.kastel.sdq.artemis4j.grading.model.rule.PenaltyRule Maven / Gradle / Ivy

Go to download

Artemis4J is a Java library for interacting with the Artemis teaching system.

There is a newer version: 7.5.6
Show newest version
/* Licensed under EPL-2.0 2022-2023. */
package edu.kit.kastel.sdq.artemis4j.grading.model.rule;

import edu.kit.kastel.sdq.artemis4j.api.grading.IAnnotation;
import edu.kit.kastel.sdq.artemis4j.grading.config.PenaltyRuleDeserializer;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import java.util.List;

/**
 * This class is used by an IMistakeType-Instance to calculate penalties.
 */
@JsonDeserialize(using = PenaltyRuleDeserializer.class)
public abstract class PenaltyRule {

	/**
	 * Calculate the penalty these Annotations add to the result.
	 *
	 * @param annotations the annotations on which the calculation is based.
	 * @return a reducing penalty
	 */
	public abstract double calculate(List annotations);

	/**
	 * @return true if the maximum limit is reached, false otherwise.
	 */
	public abstract boolean limitReached(List annotations);

	public abstract String getDisplayName();

	public abstract String getShortName();

	/**
	 * @return a tooltip String (e.g. for thresholdPenalty the score and how many
	 *         annotations were made.)
	 */
	public abstract String getTooltip(List annotations);

	public abstract boolean isCustomPenalty();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy