~ubuntu-branches/ubuntu/trusty/libjaudiotagger-java/trusty

« back to all changes in this revision

Viewing changes to src/org/jaudiotagger/audio/asf/io/ModificationResult.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-04-28 23:52:43 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110428235243-pzalvw6lncis3ukf
Tags: 2.0.3-1
* d/control: Drop Depends on default-jre per Debian Java Policy as its
  a library package.
* d/watch: Fix to directly monitor SVN tags.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.2 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
final class ModificationResult {
15
 
 
16
 
    /**
17
 
     * Stores the difference of bytes.<br>
18
 
     */
19
 
    private final long byteDifference;
20
 
 
21
 
    /**
22
 
     * Stores the difference of the amount of chunks.<br>
23
 
     * &quot;-1&quot; if the chunk disappeared upon modification.<br>
24
 
     * &quot;0&quot; if the chunk was just modified.<br>
25
 
     * &quot;1&quot; if a chunk has been created.<br>
26
 
     */
27
 
    private final int chunkDifference;
28
 
 
29
 
    /**
30
 
     * Stores all GUIDs, which have been read.<br>
31
 
     */
32
 
    private final Set<GUID> occuredGUIDs = new HashSet<GUID>();
33
 
 
34
 
    /**
35
 
     * Creates an instance.<br>
36
 
     * 
37
 
     * @param chunkCountDiff
38
 
     *            amount of chunks appeared, disappeared
39
 
     * @param bytesDiffer
40
 
     *            amount of bytes added or removed.
41
 
     * @param occurred
42
 
     *            all GUIDs which have been occurred, during processing
43
 
     */
44
 
    public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
45
 
            final GUID... occurred) {
46
 
        assert occurred != null && occurred.length > 0;
47
 
        this.chunkDifference = chunkCountDiff;
48
 
        this.byteDifference = bytesDiffer;
49
 
        this.occuredGUIDs.addAll(Arrays.asList(occurred));
50
 
    }
51
 
 
52
 
    /**
53
 
     * Creates an instance.<br>
54
 
     * 
55
 
     * @param chunkCountDiff
56
 
     *            amount of chunks appeared, disappeared
57
 
     * @param bytesDiffer
58
 
     *            amount of bytes added or removed.
59
 
     * @param occurred
60
 
     *            all GUIDs which have been occurred, during processing
61
 
     */
62
 
    public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
63
 
            final Set<GUID> occurred) {
64
 
        this.chunkDifference = chunkCountDiff;
65
 
        this.byteDifference = bytesDiffer;
66
 
        this.occuredGUIDs.addAll(occurred);
67
 
    }
68
 
 
69
 
    /**
70
 
     * Returns the difference of bytes.
71
 
     * 
72
 
     * @return the byte difference
73
 
     */
74
 
    public long getByteDifference() {
75
 
        return this.byteDifference;
76
 
    }
77
 
 
78
 
    /**
79
 
     * Returns the difference of the amount of chunks.
80
 
     * 
81
 
     * @return the chunk count difference
82
 
     */
83
 
    public int getChunkCountDifference() {
84
 
        return this.chunkDifference;
85
 
    }
86
 
 
87
 
    /**
88
 
     * Returns all GUIDs which have been occurred during processing.
89
 
     * 
90
 
     * @return see description.s
91
 
     */
92
 
    public Set<GUID> getOccuredGUIDs() {
93
 
        return new HashSet<GUID>(this.occuredGUIDs);
94
 
    }
95
 
 
96
 
}
 
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
final class ModificationResult {
 
15
 
 
16
    /**
 
17
     * Stores the difference of bytes.<br>
 
18
     */
 
19
    private final long byteDifference;
 
20
 
 
21
    /**
 
22
     * Stores the difference of the amount of chunks.<br>
 
23
     * &quot;-1&quot; if the chunk disappeared upon modification.<br>
 
24
     * &quot;0&quot; if the chunk was just modified.<br>
 
25
     * &quot;1&quot; if a chunk has been created.<br>
 
26
     */
 
27
    private final int chunkDifference;
 
28
 
 
29
    /**
 
30
     * Stores all GUIDs, which have been read.<br>
 
31
     */
 
32
    private final Set<GUID> occuredGUIDs = new HashSet<GUID>();
 
33
 
 
34
    /**
 
35
     * Creates an instance.<br>
 
36
     * 
 
37
     * @param chunkCountDiff
 
38
     *            amount of chunks appeared, disappeared
 
39
     * @param bytesDiffer
 
40
     *            amount of bytes added or removed.
 
41
     * @param occurred
 
42
     *            all GUIDs which have been occurred, during processing
 
43
     */
 
44
    public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
 
45
            final GUID... occurred) {
 
46
        assert occurred != null && occurred.length > 0;
 
47
        this.chunkDifference = chunkCountDiff;
 
48
        this.byteDifference = bytesDiffer;
 
49
        this.occuredGUIDs.addAll(Arrays.asList(occurred));
 
50
    }
 
51
 
 
52
    /**
 
53
     * Creates an instance.<br>
 
54
     * 
 
55
     * @param chunkCountDiff
 
56
     *            amount of chunks appeared, disappeared
 
57
     * @param bytesDiffer
 
58
     *            amount of bytes added or removed.
 
59
     * @param occurred
 
60
     *            all GUIDs which have been occurred, during processing
 
61
     */
 
62
    public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
 
63
            final Set<GUID> occurred) {
 
64
        this.chunkDifference = chunkCountDiff;
 
65
        this.byteDifference = bytesDiffer;
 
66
        this.occuredGUIDs.addAll(occurred);
 
67
    }
 
68
 
 
69
    /**
 
70
     * Returns the difference of bytes.
 
71
     * 
 
72
     * @return the byte difference
 
73
     */
 
74
    public long getByteDifference() {
 
75
        return this.byteDifference;
 
76
    }
 
77
 
 
78
    /**
 
79
     * Returns the difference of the amount of chunks.
 
80
     * 
 
81
     * @return the chunk count difference
 
82
     */
 
83
    public int getChunkCountDifference() {
 
84
        return this.chunkDifference;
 
85
    }
 
86
 
 
87
    /**
 
88
     * Returns all GUIDs which have been occurred during processing.
 
89
     * 
 
90
     * @return see description.s
 
91
     */
 
92
    public Set<GUID> getOccuredGUIDs() {
 
93
        return new HashSet<GUID>(this.occuredGUIDs);
 
94
    }
 
95
 
 
96
}