1 | package org.farng.mp3.filename; |
2 | |
3 | import org.farng.mp3.AbstractMP3Tag; |
4 | import org.farng.mp3.id3.AbstractID3v2Frame; |
5 | import org.farng.mp3.id3.ID3v2_4; |
6 | |
7 | import java.util.Iterator; |
8 | |
9 | /** |
10 | * The file name is parsed into a composite with this class as the base composite class. |
11 | * |
12 | * @author Eric Farng |
13 | * @version $Revision: 1.3 $ |
14 | */ |
15 | public abstract class AbstractFilenameComposite { |
16 | |
17 | /** |
18 | * Keep a record of the original token that this composite is supposed to represent |
19 | */ |
20 | private String originalToken = null; |
21 | |
22 | /** |
23 | * Creates a new AbstractFilenameComposite object. |
24 | */ |
25 | protected AbstractFilenameComposite() { |
26 | super(); |
27 | } |
28 | |
29 | /** |
30 | * Creates a new AbstractFilenameComposite object. |
31 | */ |
32 | protected AbstractFilenameComposite(final AbstractFilenameComposite copyObject) { |
33 | super(); |
34 | originalToken = copyObject.originalToken; |
35 | } |
36 | |
37 | public abstract void setFrame(AbstractID3v2Frame frame); |
38 | |
39 | /** |
40 | * Reconstruct the filename that is represented by this composite. |
41 | * |
42 | * @return the filename that is represented by this composite. |
43 | */ |
44 | public abstract String composeFilename(); |
45 | |
46 | /** |
47 | * Returns an iterator through each <code>FilenameToken</code> in this composite in the correct order for the file |
48 | * name. |
49 | * |
50 | * @return an iterator through each <code>FilenameToken</code> in this composite |
51 | */ |
52 | public abstract Iterator iterator(); |
53 | |
54 | /** |
55 | * Match all elements of this composite against the keywords for this class type found in |
56 | * <code>TagOptionSingleton</code>. If the <code>FilenameToken</code> matches the keyword, the token's class is |
57 | * set. |
58 | * |
59 | * @param id3v2FrameBodyClass Class of keywords to match against. |
60 | */ |
61 | public abstract void matchAgainstKeyword(Class id3v2FrameBodyClass); |
62 | |
63 | /** |
64 | * Match all elements of this composite against the given tag. If any element of <code>matchTag</code> matches any |
65 | * element of this tag's composite, then this tag's composite leaf node's class is set. |
66 | * |
67 | * @param matchTag Tag to match against |
68 | */ |
69 | public abstract void matchAgainstTag(AbstractMP3Tag matchTag); |
70 | |
71 | /** |
72 | * Sets the original string that this composite represents. |
73 | * |
74 | * @param originalToken the original string that this composite represents. |
75 | */ |
76 | public void setOriginalToken(final String originalToken) { |
77 | this.originalToken = originalToken; |
78 | } |
79 | |
80 | /** |
81 | * Get the original string that this composite represents. |
82 | * |
83 | * @return the original string that this composite represents. |
84 | */ |
85 | public String getOriginalToken() { |
86 | return originalToken; |
87 | } |
88 | |
89 | public abstract ID3v2_4 createId3Tag(); |
90 | } |