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

COVERAGE SUMMARY FOR SOURCE FILE [RuleKey.java]

nameclass, %method, %block, %line, %
RuleKey.java100% (1/1)100% (6/6)100% (72/72)100% (12/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RuleKey100% (1/1)100% (6/6)100% (72/72)100% (12/12)
RuleKey (String, String): void 100% (1/1)100% (9/9)100% (4/4)
equals (Object): boolean 100% (1/1)100% (24/24)100% (4/4)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getVersion (): String 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (18/18)100% (1/1)
toString (): String 100% (1/1)100% (15/15)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.se.common;
17 
18import org.qedeq.base.utility.EqualsUtility;
19 
20/**
21 * Rule key, describing a certain version of a rule.
22 *
23 * @author  Michael Meyling
24 */
25public final class RuleKey {
26 
27    /** Rule name. */
28    private String name;
29 
30    /** Rule version. */
31    private String version;
32 
33    /**
34     * Constructor.
35     *
36     * @param   name        Rule name.
37     * @param   version     Rule argument number.
38     */
39    public RuleKey(final String name, final String version) {
40        this.name = name;
41        this.version = version;
42    }
43 
44    /**
45     * Get rule name.
46     *
47     * @return  Rule name.
48     */
49    public String getName() {
50        return name;
51    }
52 
53    /**
54     * Get rule version.
55     *
56     * @return  Rule version.
57     */
58    public String getVersion() {
59        return version;
60    }
61 
62    public int hashCode() {
63        return (getName() != null ? getName().hashCode() : 0)
64            ^ (getVersion() != null ? getVersion().hashCode() : 0);
65    }
66 
67    public boolean equals(final Object obj) {
68        if (!(obj instanceof RuleKey)) {
69            return false;
70        }
71        final RuleKey other = (RuleKey) obj;
72        return EqualsUtility.equals(getName(), other.getName())
73            && EqualsUtility.equals(getVersion(), other.getVersion());
74    }
75 
76    public String toString() {
77        return getName() + " [" + getVersion() + "]";
78    }
79 
80 
81}

[all classes][org.qedeq.kernel.se.common]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov