001    /*
002     * SonarQube, open source software quality management tool.
003     * Copyright (C) 2008-2014 SonarSource
004     * mailto:contact AT sonarsource DOT com
005     *
006     * SonarQube is free software; you can redistribute it and/or
007     * modify it under the terms of the GNU Lesser General Public
008     * License as published by the Free Software Foundation; either
009     * version 3 of the License, or (at your option) any later version.
010     *
011     * SonarQube is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014     * Lesser General Public License for more details.
015     *
016     * You should have received a copy of the GNU Lesser General Public License
017     * along with this program; if not, write to the Free Software Foundation,
018     * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019     */
020    
021    package org.sonar.api.server.debt;
022    
023    import javax.annotation.CheckForNull;
024    
025    /**
026     * Function used to calculate the remediation cost of an issue. There are three types :
027     * <ul>
028     * <li>
029     * <b>Linear</b> - Each issue of the rule costs the same amount of time (coefficient) to fix.
030     * </li>
031     * <li>
032     * <b>Linear with offset</b> - It takes a certain amount of time to analyze the issues of such kind on the file (offset).
033     * Then, each issue of the rule costs the same amount of time (coefficient) to fix. Total remediation cost
034     * by file = offset + (number of issues x coefficient)
035     * </li>
036     * <li><b>Constant/issue</b> - The cost to fix all the issues of the rule is the same whatever the number of issues
037     * of this rule in the file. Total remediation cost by file = constant
038     * </li>
039     * </ul>
040     *
041     * @since 4.3
042     */
043    public interface DebtRemediationFunction {
044    
045      static enum Type {
046        LINEAR, LINEAR_OFFSET, CONSTANT_ISSUE
047      }
048    
049      Type type();
050    
051      /**
052       * Factor is set on types {@link Type#LINEAR} and {@link Type#LINEAR_OFFSET}, else it's null.
053       */
054      @CheckForNull
055      String coefficient();
056    
057      /**
058       * Offset is set on types {@link Type#LINEAR_OFFSET} and {@link Type#CONSTANT_ISSUE}, else it's null.
059       */
060      @CheckForNull
061      String offset();
062    
063    }