EMMA Coverage Report (generated Fri Feb 14 08:28:31 UTC 2014)
[all classes][org.qedeq.kernel.bo.logic.model]

COVERAGE SUMMARY FOR SOURCE FILE [SubjectVariableAllocation.java]

nameclass, %method, %block, %line, %
SubjectVariableAllocation.java100% (1/1)88%  (7/8)56%  (53/94)86%  (19/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SubjectVariableAllocation100% (1/1)88%  (7/8)56%  (53/94)86%  (19/22)
toString (): String 0%   (0/1)0%   (0/15)0%   (0/1)
increaseNumber (): void 100% (1/1)35%  (7/20)75%  (3/4)
resetNumber (): void 100% (1/1)35%  (7/20)75%  (3/4)
SubjectVariableAllocation (SubjectVariable): void 100% (1/1)100% (14/14)100% (5/5)
SubjectVariableAllocation (SubjectVariable, int): void 100% (1/1)100% (15/15)100% (5/5)
getValue (): int 100% (1/1)100% (4/4)100% (1/1)
getVariable (): SubjectVariable 100% (1/1)100% (3/3)100% (1/1)
isFixed (): boolean 100% (1/1)100% (3/3)100% (1/1)

1/* This file is part of the project "Hilbert II" - http://www.qedeq.org
2 *
3 * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
4 *
5 * "Hilbert II" is free software; you can redistribute
6 * it and/or modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15 
16package org.qedeq.kernel.bo.logic.model;
17 
18import org.qedeq.base.utility.Enumerator;
19import org.qedeq.kernel.bo.logic.common.SubjectVariable;
20 
21/**
22 * One subject variable allocation for our model.
23 *
24 * @author  Michael Meyling
25 */
26public class SubjectVariableAllocation {
27 
28    /** This subject variable. */
29    private final SubjectVariable variable;
30 
31    /** Reference to current interpretation entity. */
32    private final Enumerator value;
33 
34    /** Is this a fixed interpretatin? */
35    private boolean fixed;
36 
37    /**
38     * Constructor.
39     *
40     * @param   variable    Subject variable.
41     */
42    public SubjectVariableAllocation(final SubjectVariable variable) {
43        this.variable = variable;
44        this.value = new Enumerator();
45        this.fixed = false;
46    }
47 
48    /**
49     * Constructor.
50     *
51     * @param   variable    Subject variable.
52     * @param   value       Value for subject variable.
53     */
54    public SubjectVariableAllocation(final SubjectVariable variable, final int value) {
55        this.variable = variable;
56        this.value = new Enumerator(value);
57        this.fixed = true;
58    }
59 
60    /**
61     * Get subject variable.
62     *
63     * @return  Subject variable.
64     */
65    public SubjectVariable getVariable() {
66        return variable;
67    }
68 
69    /**
70     * Is this a fixed interpretation?
71     *
72     * @return  Is this a fixed interpretation?
73     */
74    public boolean isFixed() {
75        return fixed;
76    }
77 
78    /**
79     * Get reference to current model entity.
80     *
81     * @return  Entity number.
82     */
83    public int getValue() {
84        return value.getNumber();
85    }
86 
87    /**
88     * Increase model entity number.
89     */
90    public void increaseNumber() {
91        if (fixed) {
92            throw new IllegalStateException("variable could not iterate: " + toString());
93        }
94        value.increaseNumber();
95    }
96 
97    /**
98     * Reset model entity number.
99     */
100    public void resetNumber() {
101        if (fixed) {
102            throw new IllegalStateException("variable could not iterate: " + toString());
103        }
104        value.reset();
105    }
106 
107    public String toString() {
108        return variable.toString() + "=" + value.getNumber();
109    }
110 
111}

[all classes][org.qedeq.kernel.bo.logic.model]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov