| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ModificationResult |
|
| 0.0;0 |
| 1 | package org.jaudiotagger.audio.asf.io; | |
| 2 | ||
| 3 | import org.jaudiotagger.audio.asf.data.GUID; | |
| 4 | ||
| 5 | import java.util.Arrays; | |
| 6 | import java.util.HashSet; | |
| 7 | import java.util.Set; | |
| 8 | ||
| 9 | /** | |
| 10 | * Structure to tell the differences occurred by altering a chunk. | |
| 11 | * | |
| 12 | * @author Christian Laireiter | |
| 13 | */ | |
| 14 | 5 | final class ModificationResult |
| 15 | { | |
| 16 | ||
| 17 | /** | |
| 18 | * Stores the difference of bytes.<br> | |
| 19 | */ | |
| 20 | private final long byteDifference; | |
| 21 | ||
| 22 | /** | |
| 23 | * Stores the difference of the amount of chunks.<br> | |
| 24 | * "-1" if the chunk disappeared upon modification.<br> | |
| 25 | * "0" if the chunk was just modified.<br> | |
| 26 | * "1" if a chunk has been created.<br> | |
| 27 | */ | |
| 28 | private final int chunkCountDifference; | |
| 29 | ||
| 30 | /** | |
| 31 | * Stores all GUIDs, which have been read.<br> | |
| 32 | */ | |
| 33 | 46 | private final HashSet<GUID> occuredGUIDs = new HashSet<GUID>(); |
| 34 | ||
| 35 | /** | |
| 36 | * Creates an instance.<br> | |
| 37 | * | |
| 38 | * @param chunkCountDiff amount of chunks appeared, disappeared | |
| 39 | * @param bytesDiffer amount of bytes added or removed. | |
| 40 | * @param occurred all GUIDs which have been occurred, during processing | |
| 41 | */ | |
| 42 | public ModificationResult(int chunkCountDiff, long bytesDiffer, GUID... occurred) | |
| 43 | 42 | { |
| 44 | 42 | assert occurred != null && occurred.length > 0; |
| 45 | 42 | this.chunkCountDifference = chunkCountDiff; |
| 46 | 42 | this.byteDifference = bytesDiffer; |
| 47 | 42 | this.occuredGUIDs.addAll(Arrays.asList(occurred)); |
| 48 | 42 | } |
| 49 | ||
| 50 | /** | |
| 51 | * Creates an instance.<br> | |
| 52 | * | |
| 53 | * @param chunkCountDiff amount of chunks appeared, disappeared | |
| 54 | * @param bytesDiffer amount of bytes added or removed. | |
| 55 | * @param occurred all GUIDs which have been occurred, during processing | |
| 56 | */ | |
| 57 | public ModificationResult(int chunkCountDiff, long bytesDiffer, Set<GUID> occurred) | |
| 58 | 4 | { |
| 59 | 4 | this.chunkCountDifference = chunkCountDiff; |
| 60 | 4 | this.byteDifference = bytesDiffer; |
| 61 | 4 | this.occuredGUIDs.addAll(occurred); |
| 62 | 4 | } |
| 63 | ||
| 64 | /** | |
| 65 | * Returns the difference of bytes. | |
| 66 | * | |
| 67 | * @return the byte difference | |
| 68 | */ | |
| 69 | public long getByteDifference() | |
| 70 | { | |
| 71 | 46 | return this.byteDifference; |
| 72 | } | |
| 73 | ||
| 74 | /** | |
| 75 | * Returns the difference of the amount of chunks. | |
| 76 | * | |
| 77 | * @return the chunk count difference | |
| 78 | */ | |
| 79 | public int getChunkCountDifference() | |
| 80 | { | |
| 81 | 42 | return this.chunkCountDifference; |
| 82 | } | |
| 83 | ||
| 84 | /** | |
| 85 | * Returns all GUIDs which have been occurred during processing. | |
| 86 | * @return see description.s | |
| 87 | */ | |
| 88 | public HashSet<GUID> getOccuredGUIDs() | |
| 89 | { | |
| 90 | 4 | return this.occuredGUIDs; |
| 91 | } | |
| 92 | ||
| 93 | } |