Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
26   99   16   3.71
18   57   0.62   7
7     2.29  
1    
 
  FormalProofLineListVo       Line # 31 26 16 100% 1.0
 
  (31)
 
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.se.dto.module;
17   
18    import java.util.ArrayList;
19    import java.util.List;
20   
21    import org.qedeq.base.utility.EqualsUtility;
22    import org.qedeq.kernel.se.base.module.FormalProofLine;
23    import org.qedeq.kernel.se.base.module.FormalProofLineList;
24   
25   
26    /**
27    * List of formal proofs.
28    *
29    * @author Michael Meyling
30    */
 
31    public class FormalProofLineListVo implements FormalProofLineList {
32   
33    /** Contains all list elements. */
34    private final List list;
35   
36    /**
37    * Constructs an empty list of proof lines.
38    */
 
39  2126 toggle public FormalProofLineListVo() {
40  2126 this.list = new ArrayList();
41    }
42   
43    /**
44    * Add proof line to this list.
45    *
46    * @param proofLine Proof line to add.
47    */
 
48  12205 toggle public final void add(final FormalProofLine proofLine) {
49  12205 list.add(proofLine);
50    }
51   
 
52  296443 toggle public final int size() {
53  296443 return list.size();
54    }
55   
 
56  623287 toggle public final FormalProofLine get(final int index) {
57  623287 return (FormalProofLine) list.get(index);
58    }
59   
 
60  115 toggle public boolean equals(final Object obj) {
61  115 if (!(obj instanceof FormalProofLineListVo)) {
62  8 return false;
63    }
64  107 final FormalProofLineListVo otherList = (FormalProofLineListVo) obj;
65  107 if (size() != otherList.size()) {
66  7 return false;
67    }
68  197 for (int i = 0; i < size(); i++) {
69  99 if (!EqualsUtility.equals(get(i), otherList.get(i))) {
70  2 return false;
71    }
72    }
73  98 return true;
74    }
75   
 
76  160 toggle public int hashCode() {
77  160 int hash = 0;
78  330 for (int i = 0; i < size(); i++) {
79  170 hash = hash ^ (i + 1);
80  170 if (get(i) != null) {
81  169 hash = hash ^ get(i).hashCode();
82    }
83    }
84  160 return hash;
85    }
86   
 
87  133 toggle public String toString() {
88  133 final StringBuffer buffer = new StringBuffer("Lines:\n");
89  275 for (int i = 0; i < size(); i++) {
90  142 if (i != 0) {
91  12 buffer.append("\n");
92    }
93  142 buffer.append((i + 1) + ":\t");
94  142 buffer.append(get(i) != null ? get(i).toString() : null);
95    }
96  133 return buffer.toString();
97    }
98   
99    }