Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
21   93   11   3.5
10   44   0.52   6
6     1.83  
1    
 
  Operator       Line # 25 21 11 100% 1.0
 
  (312)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, 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   
16    package org.qedeq.kernel.bo.logic.model;
17   
18    import org.qedeq.base.utility.EqualsUtility;
19   
20    /**
21    * Operators with arguments.
22    *
23    * @author Michael Meyling
24    */
 
25    public abstract class Operator {
26   
27    /** Text to identify the variable. */
28    private final String name;
29   
30    /** Argument number for variable. */
31    private final int number;
32   
33    /**
34    * Constructor.
35    *
36    * @param name Text to identify the operator.
37    * @param number Argument number for operator.
38    */
 
39  594283 toggle public Operator(final String name, final int number) {
40  594283 this.name = name;
41  594283 this.number = number;
42    }
43   
44    /**
45    * Get operator name.
46    *
47    * @return Operator name.
48    */
 
49  5 toggle public String getName() {
50  5 return name;
51    }
52   
53    /**
54    * Get number of arguments this operator has.
55    *
56    * @return Number of arguments for this operator.
57    */
 
58  543627 toggle public int getArgumentNumber() {
59  543627 return number;
60    }
61   
 
62  68071 toggle public int hashCode() {
63  68071 return name.hashCode() ^ number ^ getClass().hashCode();
64    }
65   
 
66  2520216 toggle public boolean equals(final Object other) {
67  2520216 if (!(other instanceof Operator)) {
68  5 return false;
69    }
70  2520211 if (!other.getClass().equals(getClass())) {
71  10 return false;
72    }
73  2520201 final Operator var = (Operator) other;
74  2520201 return number == var.number && EqualsUtility.equals(name, var.name);
75    }
76   
 
77  44 toggle public String toString() {
78  44 final StringBuffer buffer = new StringBuffer();
79  44 buffer.append(name);
80  44 if (number > 0) {
81  39 buffer.append("(");
82  88 for (int i = 0; i < number; i++) {
83  49 if (i > 0) {
84  10 buffer.append(", ");
85    }
86  49 buffer.append("*");
87    }
88  39 buffer.append(")");
89    }
90  44 return buffer.toString();
91    }
92   
93    }