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 [FormalProofListVo.java]

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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