|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dvb.user.Preference
public abstract class Preference
This abstract class defines the Preference object. A Preference maps a name to a list of favourite values. The first element in the list is the favourite value for this preference.
The preference names are treated as case-insensitive. The preference names shall be considered equal at least when the method java.lang.String.equalsIgnoreCase() returns true for the strings when the locale "EN.UK" is used. Depending on the locale used in the implementation, implementations are allowed to consider equal also other upper and lower case character pairs in addition to those defined by the "EN.UK" locale.
The standardized preference names in the present document shall only use such letters where the upper and lower case characters are recognized by the "EN.UK" locale.
Constructor Summary | |
---|---|
Preference(java.lang.String name,
java.lang.String value)
Creates a new preference with the specified name and the specified value. |
|
Preference(java.lang.String name,
java.lang.String[] value)
Creates a new preference with the specified name and the specified value set. |
Method Summary | |
---|---|
void |
add(int position,
java.lang.String value)
Adds a new value for this preference. |
void |
add(java.lang.String value)
Adds a new value for this preference. |
void |
add(java.lang.String[] values)
Adds several new values for this preferences. |
java.lang.String[] |
getFavourites()
Returns the list of favourite values for this preference. |
java.lang.String |
getMostFavourite()
Returns the most favourite value for this preference, that is, the first element of the list. |
java.lang.String |
getName()
Returns the name of the preference. |
int |
getPosition(java.lang.String value)
Returns the position in the list of the specified value. |
boolean |
hasValue()
Tests if this preference has at least one value set. |
void |
remove(java.lang.String value)
Removes the specified value from the list of favourites. |
void |
removeAll()
Removes all the values of a preference |
void |
setMostFavourite(java.lang.String value)
Sets the most favourite value for this preference. |
java.lang.String |
toString()
Convert name and favourites to a String. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Preference(java.lang.String name, java.lang.String value)
name
- a String object representing the name of the preference.value
- a String object representing the value of the preference.public Preference(java.lang.String name, java.lang.String[] value)
name
- a String object representing the name of the preference.value
- an array of String objects representing the set of values
for this preference ordered from the most favourite to the least favourite.Method Detail |
---|
public void add(java.lang.String value)
value
- a String object representing the new value.public void add(java.lang.String[] values)
values
- an array of strings representing the values to addpublic void add(int position, java.lang.String value)
position
- an int representing the position in the list counting from zero.value
- a String representing the new value to insert.public java.lang.String[] getFavourites()
public java.lang.String getMostFavourite()
public java.lang.String getName()
public int getPosition(java.lang.String value)
value
- a String representing the value to look for.
public boolean hasValue()
public void remove(java.lang.String value)
value
- a String representing the value to remove.public void removeAll()
public void setMostFavourite(java.lang.String value)
value
- the most favourite valuepublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |