|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.japtproxy.packages.AbstractRepoPackageVersionComparator
public abstract class AbstractRepoPackageVersionComparator
The VersionComparator is responsible for comparing package versions. This is required for sorting a list of packages from the same program with different versions.
The algorithm used in this class was borrowed from vercmp.c
in libdpkg which is written by Ian Jackson.
| Field Summary | |
|---|---|
protected static org.slf4j.Logger |
LOG
The logger instance. |
protected static int |
NON_ASCII_OFFSET
Non ASCII offset constant. |
| Constructor Summary | |
|---|---|
AbstractRepoPackageVersionComparator()
|
|
| Method Summary | |
|---|---|
int |
compare(java.lang.String f1,
java.lang.String f2)
Compares two packages based on the version and revision field. |
protected abstract int |
order(char[] ca,
int pos)
Returns the order for a single character. |
void |
setRepoPackageFactory(IRepoPackageFactory repoPackageFactory)
|
protected int |
strCompare(java.lang.String s1,
java.lang.String s2)
Compares two version strings and returns and int that
specifies the order. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
|---|
equals |
| Field Detail |
|---|
protected static final org.slf4j.Logger LOG
protected static final int NON_ASCII_OFFSET
| Constructor Detail |
|---|
public AbstractRepoPackageVersionComparator()
| Method Detail |
|---|
public void setRepoPackageFactory(IRepoPackageFactory repoPackageFactory)
protected abstract int order(char[] ca,
int pos)
ca - the character arraypos - the position in the character array
protected int strCompare(java.lang.String s1,
java.lang.String s2)
int that
specifies the order.
s1 - version string 1s2 - version string 2
public int compare(java.lang.String f1,
java.lang.String f2)
compare in interface java.util.Comparator<java.lang.String>f1 - file1f2 - file2
0 if both packages have the same version (should
not happen), 1 if f1 is more recent
than f2, otherwise -1
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||