Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
26   102   15   3,71
18   57   0,58   7
7     2,14  
1    
 
  LatexListVo       Line # 34 26 15 100% 1.0
 
  (58)
 
1    /* $Id: LatexListVo.java,v 1.9 2008/07/26 07:59:35 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU General Public
9    * License as published by the Free Software Foundation; either
10    * version 2 of the License, or (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    * GNU General Public License for more details.
16    */
17   
18    package org.qedeq.kernel.dto.module;
19   
20    import java.util.ArrayList;
21    import java.util.List;
22   
23    import org.qedeq.base.utility.EqualsUtility;
24    import org.qedeq.kernel.base.module.Latex;
25    import org.qedeq.kernel.base.module.LatexList;
26   
27   
28    /**
29    * List of LaTeX text parts.
30    *
31    * @version $Revision: 1.9 $
32    * @author Michael Meyling
33    */
 
34    public class LatexListVo implements LatexList {
35   
36    /** Contains all list elements. */
37    private final List list;
38   
39    /**
40    * Constructs an empty list of LaTeX text parts.
41    */
 
42  10266 toggle public LatexListVo() {
43  10266 this.list = new ArrayList();
44    }
45   
46    /**
47    * Add language dependent LaTeX text to list.
48    *
49    * @param latex LaTeX text.
50    */
 
51  17752 toggle public final void add(final LatexVo latex) {
52  17752 list.add(latex);
53    }
54   
 
55  596082 toggle public final int size() {
56  596082 return list.size();
57    }
58   
 
59  410684 toggle public final Latex get(final int index) {
60  410684 return (Latex) list.get(index);
61    }
62   
 
63  1648 toggle public boolean equals(final Object obj) {
64  1648 if (!(obj instanceof LatexListVo)) {
65  42 return false;
66    }
67  1606 final LatexListVo otherList = (LatexListVo) obj;
68  1606 if (size() != otherList.size()) {
69  7 return false;
70    }
71  3198 for (int i = 0; i < size(); i++) {
72  1601 if (!EqualsUtility.equals(get(i), otherList.get(i))) {
73  2 return false;
74    }
75    }
76  1597 return true;
77    }
78   
 
79  1585 toggle public int hashCode() {
80  1585 int hash = 0;
81  3168 for (int i = 0; i < size(); i++) {
82  1583 hash = hash ^ (i + 1);
83  1583 if (get(i) != null) {
84  1582 hash = hash ^ get(i).hashCode();
85    }
86    }
87  1585 return hash;
88    }
89   
 
90  1090 toggle public String toString() {
91  1090 final StringBuffer buffer = new StringBuffer("Latex:\n");
92  2177 for (int i = 0; i < size(); i++) {
93  1087 if (i != 0) {
94  6 buffer.append("\n");
95    }
96  1087 buffer.append((i + 1) + ":\t");
97  1087 buffer.append(get(i) != null ? get(i).toString() : null);
98    }
99  1090 return buffer.toString();
100    }
101   
102    }