Package org.apache.abdera.i18n.rfc4646
Class Range
- java.lang.Object
-
- org.apache.abdera.i18n.rfc4646.Range
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>,java.lang.Iterable<Subtag>
public class Range extends java.lang.ObjectA language range used for matching language tags- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Range(java.lang.String range)Create a Language-RangeRange(java.lang.String range, boolean extended)Create a Language-RangeRange(Lang lang)Create a Language-Range from a Lang tagRange(Lang lang, boolean extended)Create a Language-Range from a Lang tag
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Rangeappend(Subtag subtag)Append a subtag to the rangeRangeappendWildcard()Append a wildcard subtag to the rangejava.util.List<Subtag>asList()Rangeclone()Copy this rangeintcompareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)booleancontains(java.lang.String tag)booleancontains(java.lang.String tag, Subtag.Type type)booleancontains(Subtag subtag)intcount()booleanequals(java.lang.Object obj)java.lang.String[]filter(java.lang.String... lang)Filter the given set of lang tags.static java.lang.String[]filter(java.lang.String range, java.lang.String... lang)Filter the given set of lang tags.static Lang[]filter(java.lang.String range, Lang... lang)Filter the given set of lang tags.Lang[]filter(Lang... lang)Filter the given set of lang tags.Subtagget(int index)inthashCode()booleanisBasic()True if this range is a basic rangebooleanisValid()java.util.Iterator<Subtag>iterator()intlength()booleanmatches(java.lang.String lang)True if the lang tag matches this rangebooleanmatches(java.lang.String lang, boolean extended)True if the lang tag matches this rangestatic booleanmatches(java.lang.String range, java.lang.String lang)True if the lang tag matches the range.static booleanmatches(java.lang.String range, java.lang.String lang, boolean extended)True if the lang tag matches the range.static booleanmatches(java.lang.String range, Lang lang)True if the lang tag matches the range.static booleanmatches(java.lang.String range, Lang lang, boolean extended)True if the lang tag matches the range.booleanmatches(Lang lang)True if the lang tag matches this rangebooleanmatches(Lang lang, boolean extended)True if the lang tag matches this rangestatic Rangeparse(java.lang.String range)Parse the language-rangestatic Rangeparse(java.lang.String range, boolean extended)Parse the language-rangeSubtag[]toArray()RangetoBasicRange()Create a basic language-range from this rangejava.lang.StringtoString()
-
-
-
Constructor Detail
-
Range
public Range(java.lang.String range, boolean extended)Create a Language-Range- Parameters:
range- The language-rangeextended- true if this is an extended language range
-
Range
public Range(java.lang.String range)
Create a Language-Range
-
Range
public Range(Lang lang)
Create a Language-Range from a Lang tag
-
Range
public Range(Lang lang, boolean extended)
Create a Language-Range from a Lang tag- Parameters:
lang- The language tagextended- true if this is an extended language-range
-
-
Method Detail
-
appendWildcard
public Range appendWildcard()
Append a wildcard subtag to the range
-
clone
public Range clone()
Copy this range
-
toBasicRange
public Range toBasicRange()
Create a basic language-range from this range
-
isBasic
public boolean isBasic()
True if this range is a basic range
-
matches
public boolean matches(java.lang.String lang)
True if the lang tag matches this range
-
matches
public boolean matches(java.lang.String lang, boolean extended)True if the lang tag matches this range- Parameters:
lang- The language tageextended- True if extended matching rules should be used
-
matches
public boolean matches(Lang lang)
True if the lang tag matches this range
-
matches
public boolean matches(Lang lang, boolean extended)
True if the lang tag matches this range- Parameters:
lang- The language tageextended- True if extended matching rules should be used
-
filter
public Lang[] filter(Lang... lang)
Filter the given set of lang tags. Return an array of matching tags
-
filter
public java.lang.String[] filter(java.lang.String... lang)
Filter the given set of lang tags. Return an array of matching tags
-
filter
public static Lang[] filter(java.lang.String range, Lang... lang)
Filter the given set of lang tags. Return an array of matching tags
-
filter
public static java.lang.String[] filter(java.lang.String range, java.lang.String... lang)Filter the given set of lang tags. Return an array of matching tags
-
matches
public static boolean matches(java.lang.String range, Lang lang, boolean extended)True if the lang tag matches the range.- Parameters:
range- The language-rangelang- The language tagextended- true to use extended match rules
-
matches
public static boolean matches(java.lang.String range, Lang lang)True if the lang tag matches the range.- Parameters:
range- The language-rangelang- The language tagextended- true to use extended match rules
-
matches
public static boolean matches(java.lang.String range, java.lang.String lang, boolean extended)True if the lang tag matches the range.- Parameters:
range- The language-rangelang- The language tagextended- true to use extended match rules
-
matches
public static boolean matches(java.lang.String range, java.lang.String lang)True if the lang tag matches the range.- Parameters:
range- The language-rangelang- The language tagextended- true to use extended match rules
-
parse
public static Range parse(java.lang.String range)
Parse the language-range
-
parse
public static Range parse(java.lang.String range, boolean extended)
Parse the language-range- Parameters:
range- The language-rangeextended- true to use extended language rules
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
iterator
public java.util.Iterator<Subtag> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Subtag>
-
contains
public boolean contains(Subtag subtag)
-
contains
public boolean contains(java.lang.String tag)
-
contains
public boolean contains(java.lang.String tag, Subtag.Type type)
-
length
public int length()
-
isValid
public boolean isValid()
-
count
public int count()
-
get
public Subtag get(int index)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toArray
public Subtag[] toArray()
-
asList
public java.util.List<Subtag> asList()
-
compareTo
public int compareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)
- Specified by:
compareToin interfacejava.lang.Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>
-
-