git://git.nikiroo.be
/
jvcard.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix PREF handling (was not correct relative to the RFC!)
[jvcard.git]
/
src
/
be
/
nikiroo
/
jvcard
/
Data.java
diff --git
a/src/be/nikiroo/jvcard/Data.java
b/src/be/nikiroo/jvcard/Data.java
index ba5fde5df13a9d86381b965aa1487d702ff61be8..4d3da7e4c7d37f0aa3bd1754065cfbcbdc0e4872 100644
(file)
--- a/
src/be/nikiroo/jvcard/Data.java
+++ b/
src/be/nikiroo/jvcard/Data.java
@@
-186,18
+186,23
@@
public class Data extends BaseClass<TypeInfo> {
}
/**
}
/**
- * Check if this {@link Data} has the "preferred" flag.
+ * Return the preferred value of this {@link Data}, or
+ * {@link Integer#MAX_VALUE} if none.
*
*
- * @return
TRUE if it has
+ * @return
the preferred value
*/
*/
- public
boolean is
Preferred() {
+ public
int get
Preferred() {
for (TypeInfo type : this) {
for (TypeInfo type : this) {
- if (type.getName().equals("TYPE") && type.getValue().equals("pref")) {
- return true;
+ if (type.getName().equals("PRE")) {
+ try {
+ return Integer.parseInt(type.getValue());
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
}
}
}
}
- return
false
;
+ return
Integer.MAX_VALUE
;
}
/**
}
/**