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

COVERAGE SUMMARY FOR SOURCE FILE [SectionListVo.java]

nameclass, %method, %block, %line, %
SectionListVo.java100% (1/1)100% (7/7)100% (136/136)100% (29/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SectionListVo100% (1/1)100% (7/7)100% (136/136)100% (29/29)
SectionListVo (): void 100% (1/1)100% (8/8)100% (3/3)
add (SectionVo): void 100% (1/1)100% (6/6)100% (2/2)
equals (Object): boolean 100% (1/1)100% (35/35)100% (9/9)
get (int): Section 100% (1/1)100% (6/6)100% (1/1)
hashCode (): int 100% (1/1)100% (29/29)100% (6/6)
size (): int 100% (1/1)100% (4/4)100% (1/1)
toString (): String 100% (1/1)100% (48/48)100% (7/7)

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.dto.module;
17 
18import java.util.ArrayList;
19import java.util.List;
20 
21import org.qedeq.base.utility.EqualsUtility;
22import org.qedeq.kernel.se.base.module.Section;
23import org.qedeq.kernel.se.base.module.SectionList;
24 
25 
26/**
27 * List of sections.
28 *
29 * @author  Michael Meyling
30 */
31public class SectionListVo implements SectionList {
32 
33    /** Contains all sections. */
34    private final List list;
35 
36    /**
37     * Constructs an empty section list.
38     */
39    public SectionListVo() {
40        this.list = new ArrayList();
41 
42    }
43 
44    /**
45     * Add section to this list.
46     *
47     * @param   section Section to add.
48     */
49    public final void add(final SectionVo section) {
50        list.add(section);
51    }
52 
53    public final int size() {
54        return list.size();
55    }
56 
57    public final Section get(final int index) {
58        return (Section) list.get(index);
59    }
60 
61    public boolean equals(final Object obj) {
62        if (!(obj instanceof SectionListVo)) {
63            return false;
64        }
65        final SectionListVo otherList = (SectionListVo) obj;
66        if (size() != otherList.size()) {
67            return false;
68        }
69        for (int i = 0; i < size(); i++) {
70            if (!EqualsUtility.equals(get(i), otherList.get(i))) {
71                return false;
72            }
73        }
74        return true;
75    }
76 
77    public int hashCode() {
78        int hash = 0;
79        for (int i = 0; i < size(); i++) {
80            hash = hash ^ (i + 1);
81            if (get(i) != null) {
82                hash = hash ^ get(i).hashCode();
83            }
84        }
85        return hash;
86    }
87 
88    public String toString() {
89        final StringBuffer buffer = new StringBuffer("List of sections:\n");
90        for (int i = 0; i < size(); i++) {
91            if (i != 0) {
92                buffer.append("\n");
93            }
94            buffer.append((i + 1) + ":\t");
95            buffer.append(get(i) != null ? get(i).toString() : null);
96        }
97        return buffer.toString();
98    }
99 
100}

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