Coverage Report - com.sdmetrics.metrics.RuleViolation - www.sdmetrics.com
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleViolation
100%
8/8
N/A
1
 
 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  
 
 24  
 import com.sdmetrics.model.ModelElement;
 25  
 
 26  
 /**
 27  
  * Stores details about the violation of one specific rule by one specific model
 28  
  * element.
 29  
  */
 30  
 public class RuleViolation {
 31  
         /** The violating model element. */
 32  
         private final ModelElement element;
 33  
         /** The violated rule. */
 34  
         private final Rule rule;
 35  
         /** The value of the rule describing the violation. */
 36  
         private final Object value;
 37  
 
 38  
         /**
 39  
          * Constructor.
 40  
          * @param element The violating model element.
 41  
          * @param rule The violated rule.
 42  
          * @param value Value of the rule violation.
 43  
          */
 44  16
         public RuleViolation(ModelElement element, Rule rule, Object value) {
 45  16
                 this.element = element;
 46  16
                 this.rule = rule;
 47  16
                 this.value = value;
 48  16
         }
 49  
 
 50  
         /**
 51  
          * Gets the model element of this rule violation.
 52  
          * 
 53  
          * @return The violating model element.
 54  
          */
 55  
         public ModelElement getModelElement() {
 56  16
                 return element;
 57  
         }
 58  
 
 59  
         /**
 60  
          * Gets the rule of this rule violation.
 61  
          * 
 62  
          * @return The violated rule.
 63  
          */
 64  
         public Rule getRule() {
 65  16
                 return rule;
 66  
         }
 67  
 
 68  
         /**
 69  
          * Gets the value for this rule violation.
 70  
          * 
 71  
          * @return Value of the rule describing the violation.
 72  
          */
 73  
         public Object getValue() {
 74  36
                 return value;
 75  
         }
 76  
 
 77  
 }