1 package net.sourceforge.argval.version;
2
3
4 import java.util.List;
5
6
7 /**
8 * A version hierarchy can be used to register versions and then check for compatibility.
9 *
10 * @author <a href="http://sourceforge.net/users/verhagent/">T. Verhagen</a>
11 */
12 public interface VersionHierarchy extends VersionNumberVisitorAcceptor {
13 /** The default version part separator '<code>.</code>'. */
14 static final String VERSION_PART_SEPARATOR = ".";
15
16 /**
17 * Adding a version number.
18 *
19 * @param version - the version number
20 */
21 void addVersion(final VersionNumber version);
22
23 /**
24 * Adding a version number. Uses the {@link #convertVersion(String, String)} for conversion.
25 *
26 * @param versionStr - as a text string separating the version number parts by a separator
27 * @see #convertVersion(String, String)
28 */
29 void addVersion(final String versionStr);
30
31 /**
32 * Adding a version number.
33 *
34 * @param version - as a list containing the version number parts
35 */
36 void addVersion(final List<String> version);
37
38 /**
39 *
40 * @param versionStr
41 * @return
42 */
43 List<String> convertVersion(final String versionStr);
44
45 /**
46 * Returns <code>true</code> if the version is compatible with the known versions.
47 *
48 * @param version - the version number
49 * @return <code>true</code> if the version is compatible with the known versions
50 * , otherwise <code>false</code>.
51 */
52 boolean isCompatible(final VersionNumber version);
53
54 /**
55 * Returns <code>true</code> if the version is compatible with the known versions.
56 * Uses the {@link #convertVersion(String, String)} for conversion.
57 *
58 * @param version - the version number
59 * @return <code>true</code> if the version is compatible with the known versions
60 * , otherwise <code>false</code>.
61 */
62 boolean isCompatible(final String version);
63
64 /**
65 * Returns <code>true</code> if the version is compatible with the known versions.
66 *
67 * @param version - the version number
68 * @return <code>true</code> if the version is compatible with the known versions
69 * , otherwise <code>false</code>.
70 */
71 boolean isCompatible(final List<String> version);
72
73 /**
74 * Returns the registered versions as a List of String instances.
75 * @return The registered versions as a List of String instances.
76 */
77 List<String> getRegisteredVersionAsStings();
78
79 /**
80 * Returns the registered versions as a List of {@link VersionNumber} instances.
81 * @return The registered versions as a List of {@link VersionNumber} instances.
82 */
83 List<VersionNumber> getRegisteredVersionNumbers();
84
85 }