OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
80 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.modules;
15
 
16
public class DepSolverResult {
17
 
18
    static public interface Factory {
19
        DepSolverResult create(DepSolverResult parent, int tryCount, String error, DepSolverGraph graph);
20
    }
21
 
22
    private final DepSolverResult parent;
23
    private final int triesCount;
24
    private final String error;
25
    private final DepSolverGraph graph;
26
 
27
    public DepSolverResult(DepSolverResult parent, int tryCount, String error, DepSolverGraph graph) {
28
        super();
29
        this.parent = parent;
30
        this.triesCount = tryCount;
31
        this.error = error;
32
        this.graph = graph;
33
    }
34
 
35
    /**
36
     * The result that led to this one. E.g. there could have been a missing dependency for the
37
     * latest version of a module and thus this result contains an older version of the module.
38
     *
39
     * @return the parent result.
40
     */
41
    public final DepSolverResult getParent() {
42
        return this.parent;
43
    }
44
 
45
    /**
46
     * The number of tries before obtaining this result.
47
     *
48
     * @return the tries count, starts at 0.
49
     */
50
    public final int getTriesCount() {
51
        return this.triesCount;
52
    }
53
 
54
    public final String getError() {
55
        return this.error;
56
    }
57
 
58
    public final DepSolverGraph getGraph() {
59
        return this.graph;
60
    }
61
 
62
    @Override
63
    public String toString() {
64
        return this.getClass().getSimpleName() + (this.getError() == null ? " no errors" : (" error : " + this.getError()));
65
    }
66
}