Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
26   100   16   3.71
18   57   0.62   7
7     2.29  
1    
 
  ProofListVo       Line # 31 26 16 100% 1.0
 
  (37)
 
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.Proof;
23    import org.qedeq.kernel.se.base.module.ProofList;
24   
25   
26    /**
27    * List of proofs.
28    *
29    * @author Michael Meyling
30    */
 
31    public class ProofListVo implements ProofList {
32   
33    /** Contains all list elements. */
34    private final List list;
35   
36    /**
37    * Constructs an empty list of proofs.
38    */
 
39  5624 toggle public ProofListVo() {
40  5624 this.list = new ArrayList();
41   
42    }
43   
44    /**
45    * Add proof to this list.
46    *
47    * @param proof Proof to add.
48    */
 
49  5938 toggle public final void add(final ProofVo proof) {
50  5938 list.add(proof);
51    }
52   
 
53  8268 toggle public final int size() {
54  8268 return list.size();
55    }
56   
 
57  6317 toggle public final Proof get(final int index) {
58  6317 return (Proof) list.get(index);
59    }
60   
 
61  127 toggle public boolean equals(final Object obj) {
62  127 if (!(obj instanceof ProofListVo)) {
63  10 return false;
64    }
65  117 final ProofListVo otherList = (ProofListVo) obj;
66  117 if (size() != otherList.size()) {
67  15 return false;
68    }
69  313 for (int i = 0; i < size(); i++) {
70  217 if (!EqualsUtility.equals(get(i), otherList.get(i))) {
71  6 return false;
72    }
73    }
74  96 return true;
75    }
76   
 
77  128 toggle public int hashCode() {
78  128 int hash = 0;
79  366 for (int i = 0; i < size(); i++) {
80  238 hash = hash ^ (i + 1);
81  238 if (get(i) != null) {
82  235 hash = hash ^ get(i).hashCode();
83    }
84    }
85  128 return hash;
86    }
87   
 
88  86 toggle public String toString() {
89  86 final StringBuffer buffer = new StringBuffer("Proofs:\n");
90  281 for (int i = 0; i < size(); i++) {
91  195 if (i != 0) {
92  112 buffer.append("\n");
93    }
94  195 buffer.append((i + 1) + ":\t");
95  195 buffer.append(get(i) != null ? get(i).toString() : null);
96    }
97  86 return buffer.toString();
98    }
99   
100    }