3 * Copyright (C) 2009-2016 SonarSource SA
4 * mailto:contact AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.server.computation.task.projectanalysis.period;
22 import java.util.List;
25 * Repository of period used to compute differential measures.
26 * Here are the steps to retrieve the period :
27 * - Read the period property ${@link org.sonar.core.config.CorePropertyDefinitions#TIMEMACHINE_PERIOD_PREFIX}
28 * - Try to find the matching snapshots from the property
29 * - If a snapshot is found, the period is added to the repository
31 public interface PeriodsHolder {
34 int MAX_NUMBER_OF_PERIODS = 5;
37 * Return the list of differential periods, ordered by increasing index.
39 * @throws IllegalStateException if the periods haven't been initialized
40 * @deprecated replaced by {@link #getPeriod()}
43 List<Period> getPeriods();
46 * Finds out whether the holder contains a Period for the specified index.
48 * @throws IllegalStateException if the periods haven't been initialized
49 * @throws IndexOutOfBoundsException if i is either < 1 or > 5
50 * @deprecated replaced by {@link #hasPeriod()}
53 boolean hasPeriod(int i);
56 * Retrieves the Period for the specified index from the Holder.
58 * @throws IllegalStateException if the periods haven't been initialized
59 * @throws IllegalStateException if there is no period for the specified index (see {@link #hasPeriod(int)})
60 * @throws IndexOutOfBoundsException if i is either < 1 or > 5
61 * @deprecated replaced by {@link #getPeriod()}
64 Period getPeriod(int i);
67 * Finds out whether the holder contains a Period
69 * @throws IllegalStateException if the periods haven't been initialized
74 * Retrieve the period from the Holder.
76 * @throws IllegalStateException if the periods haven't been initialized