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 [Function.java]

nameclass, %method, %block, %line, %
Function.java100% (2/2)50%  (4/8)81%  (52/64)67%  (8/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Function100% (1/1)33%  (2/6)76%  (39/51)64%  (7/11)
getDescription (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getMaximumArgumentNumber (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getMinimumArgumentNumber (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/3)0%   (0/1)
Function (int, int, String, String): void 100% (1/1)100% (15/15)100% (6/6)
createConstant (Entity): Function 100% (1/1)100% (24/24)100% (1/1)
     
class Function$1100% (1/1)100% (2/2)100% (13/13)100% (2/2)
Function$1 (int, int, String, String, Entity): void 100% (1/1)100% (10/10)100% (1/1)
map (Entity []): Entity 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 
18/**
19 * One function for our model.
20 *
21 * @author  Michael Meyling
22 */
23public abstract class Function {
24 
25 
26    /** Minimum number of arguments this function has. */
27    private final int minimum;
28 
29    /** Maximum number of arguments this function has. */
30    private final int maximum;
31 
32    /** Display text. */
33    private final String display;
34 
35    /** Description for this function. */
36    private final String description;
37 
38    static Function createConstant(final Entity entity) {
39        return new Function(0, 90, "->" + entity, "contant " + entity.getDescription()) {
40            public Entity map(final Entity[] entities) {
41                return entity;
42            }
43        };
44    }
45 
46    /**
47     * Constructor.
48     *
49     * @param   minimum         Minimum number of arguments this function has.
50     * @param   maximum         Maximum number of arguments this function has.
51     * @param   display         Show this to represent the function within outputs.
52     * @param   description     Description for this function.
53     */
54    public Function(final int minimum, final int maximum, final String display,
55            final String description) {
56        this.minimum = minimum;
57        this.maximum = maximum;
58        this.display = display;
59        this.description = description;
60    }
61 
62    /**
63     * Get minimum number of arguments this function has.
64     *
65     * @return  Minimum number of arguments for this function.
66     */
67    public int getMinimumArgumentNumber() {
68        return minimum;
69    }
70 
71    /**
72     * Get maximum number of arguments this function has.
73     *
74     * @return  Maximum number of arguments for this function.
75     */
76    public int getMaximumArgumentNumber() {
77        return maximum;
78    }
79 
80    /**
81     * Get display text.
82     *
83     * @return  Representation of this function for textual output.
84     */
85    public String toString() {
86        return display;
87    }
88 
89    /**
90     * Get description.
91     *
92     * @return  Description of this function.
93     */
94    public String getDescription() {
95        return description;
96    }
97 
98    /**
99     * Calculate truth value.
100     *
101     * @param   entities    Calculate function for this entities.
102     * @return  Truth value.
103     */
104    public abstract Entity map(Entity[] entities);
105 
106}

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