Test coverage report for RuleViolation.java - www.sdmetrics.com

  1. /*
  2.  * SDMetrics Open Core for UML design measurement
  3.  * Copyright (c) Juergen Wuest
  4.  * To contact the author, see <http://www.sdmetrics.com/Contact.html>.
  5.  *
  6.  * This file is part of the SDMetrics Open Core.
  7.  *
  8.  * SDMetrics Open Core is free software: you can redistribute it and/or modify
  9.  * it under the terms of the GNU Affero General Public License as
  10.  * published by the Free Software Foundation, either version 3 of the
  11.  * License, or (at your option) any later version.
  12.    
  13.  * SDMetrics Open Core is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU Affero General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Affero General Public License
  19.  * along with SDMetrics Open Core.  If not, see <http://www.gnu.org/licenses/>.
  20.  *
  21.  */
  22. package com.sdmetrics.metrics;

  23. import com.sdmetrics.model.ModelElement;

  24. /**
  25.  * Stores details about the violation of one specific rule by one specific model
  26.  * element.
  27.  */
  28. public class RuleViolation {
  29.     /** The violating model element. */
  30.     private final ModelElement element;
  31.     /** The violated rule. */
  32.     private final Rule rule;
  33.     /** The value of the rule describing the violation. */
  34.     private final Object value;

  35.     /**
  36.      * Constructor.
  37.      * @param element The violating model element.
  38.      * @param rule The violated rule.
  39.      * @param value Value of the rule violation.
  40.      */
  41.     public RuleViolation(ModelElement element, Rule rule, Object value) {
  42.         this.element = element;
  43.         this.rule = rule;
  44.         this.value = value;
  45.     }

  46.     /**
  47.      * Gets the model element of this rule violation.
  48.      *
  49.      * @return The violating model element.
  50.      */
  51.     public ModelElement getModelElement() {
  52.         return element;
  53.     }

  54.     /**
  55.      * Gets the rule of this rule violation.
  56.      *
  57.      * @return The violated rule.
  58.      */
  59.     public Rule getRule() {
  60.         return rule;
  61.     }

  62.     /**
  63.      * Gets the value for this rule violation.
  64.      *
  65.      * @return Value of the rule describing the violation.
  66.      */
  67.     public Object getValue() {
  68.         return value;
  69.     }

  70. }