1 | package dk.deepthought.sidious.explanation; |
2 | |
3 | import java.util.ArrayList; |
4 | import java.util.Collection; |
5 | |
6 | |
7 | import net.jcip.annotations.Immutable; |
8 | |
9 | /** |
10 | * Value object for abstracting explanations from the pathfinding algorithm. |
11 | * |
12 | * @author Deepthought |
13 | * |
14 | */ |
15 | @Immutable |
16 | public class Explanation { |
17 | |
18 | /** |
19 | * The entries of this. |
20 | */ |
21 | private final Collection<ExplanationEntry> entries; |
22 | |
23 | /** |
24 | * Constructor. |
25 | * |
26 | * @param entries |
27 | * the entries |
28 | */ |
29 | public Explanation(final Collection<ExplanationEntry> entries) { |
30 | this.entries = new ArrayList<ExplanationEntry>(entries); |
31 | } |
32 | |
33 | /** |
34 | * Gets a defensive copy of the entries of this. |
35 | * |
36 | * @return the entries |
37 | */ |
38 | public Collection<ExplanationEntry> getEntries() { |
39 | return new ArrayList<ExplanationEntry>(entries); |
40 | } |
41 | |
42 | /* |
43 | * (non-Javadoc) |
44 | * |
45 | * @see java.lang.Object#toString() |
46 | */ |
47 | @Override |
48 | public String toString() { |
49 | return getClass().getSimpleName() + "[entries=" + entries + "]"; |
50 | } |
51 | } |