1 | package org.apollo.audio.structure;
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Immutable outside package.
|
---|
5 | *
|
---|
6 | * @see {@link AudioStructureModel} for thread safe convention.
|
---|
7 | *
|
---|
8 | * @author Brook Novak
|
---|
9 | *
|
---|
10 | */
|
---|
11 | public class TrackGraphNode extends AbstractTrackGraphNode {
|
---|
12 |
|
---|
13 | private String localFilename; // immutable
|
---|
14 |
|
---|
15 | private long runningTime; // ms
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Friendly constructor.
|
---|
19 | *
|
---|
20 | * @param localFilename
|
---|
21 | * Must not be null or empty.
|
---|
22 | *
|
---|
23 | * @param initiationTime
|
---|
24 | * Must be positive. In milliseconds
|
---|
25 | *
|
---|
26 | * @param runningMS
|
---|
27 | * Must be larger than zero. In milliseconds.
|
---|
28 | *
|
---|
29 | * @param name
|
---|
30 | * The name to set this to. Can be null
|
---|
31 | *
|
---|
32 | * @throws NullPointerException
|
---|
33 | * if localFilename is null.
|
---|
34 | *
|
---|
35 | * @throws IllegalArgumentException
|
---|
36 | * if ms is smaller or equal to zero.
|
---|
37 | * or if localFilename is empty.
|
---|
38 | * or if initiationTime is less than zero
|
---|
39 | */
|
---|
40 | TrackGraphNode(long initiationTime, String localFilename, long runningMS, String name) {
|
---|
41 | super(initiationTime, name);
|
---|
42 |
|
---|
43 | if (localFilename == null) throw new NullPointerException("localFilename");
|
---|
44 | else if (localFilename.length() == 0) throw new IllegalArgumentException("localFilename.length() == 0");
|
---|
45 |
|
---|
46 | setRunningTime(runningMS);
|
---|
47 |
|
---|
48 | this.localFilename = localFilename;
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | public String getLocalFilename() {
|
---|
53 | return localFilename;
|
---|
54 | }
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Precomputed and maintained by the graph model.
|
---|
58 | * Always larger or equal to zero.
|
---|
59 | *
|
---|
60 | * @return
|
---|
61 | * The running time in milliseconds.
|
---|
62 | */
|
---|
63 | @Override
|
---|
64 | public long getRunningTime() {
|
---|
65 | return runningTime;
|
---|
66 | }
|
---|
67 |
|
---|
68 | /**
|
---|
69 | *
|
---|
70 | * @param runningMS
|
---|
71 | * Must be larger than zero. IN milliseconds
|
---|
72 | *
|
---|
73 | * @throws IllegalArgumentException
|
---|
74 | * if ms is smaller or equal to zero.
|
---|
75 | *
|
---|
76 | */
|
---|
77 | void setRunningTime(long runningMS) {
|
---|
78 | if (runningMS <= 0) throw new IllegalArgumentException("runningMS = " + runningMS);
|
---|
79 | this.runningTime = runningMS;
|
---|
80 | }
|
---|
81 |
|
---|
82 | }
|
---|