org.apache.abdera.i18n.rfc4646
Class Range

java.lang.Object
  extended by org.apache.abdera.i18n.rfc4646.Range
All Implemented Interfaces:
Serializable, Cloneable, Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>, Iterable<Subtag>

public class Range
extends Object

A language range used for matching language tags

See Also:
Serialized Form

Field Summary
protected  Subtag primary
           
 
Constructor Summary
Range(Lang lang)
          Create a Language-Range from a Lang tag
Range(Lang lang, boolean extended)
          Create a Language-Range from a Lang tag
Range(String range)
          Create a Language-Range
Range(String range, boolean extended)
          Create a Language-Range
 
Method Summary
 Range append(Subtag subtag)
          Append a subtag to the range
 Range appendWildcard()
          Append a wildcard subtag to the range
 List<Subtag> asList()
           
 Range clone()
          Copy this range
 int compareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)
           
 boolean contains(String tag)
           
 boolean contains(String tag, Subtag.Type type)
           
 boolean contains(Subtag subtag)
           
 int count()
           
 boolean equals(Object obj)
           
 Lang[] filter(Lang... lang)
          Filter the given set of lang tags.
 String[] filter(String... lang)
          Filter the given set of lang tags.
static Lang[] filter(String range, Lang... lang)
          Filter the given set of lang tags.
static String[] filter(String range, String... lang)
          Filter the given set of lang tags.
 Subtag get(int index)
           
 int hashCode()
           
 boolean isBasic()
          True if this range is a basic range
 boolean isValid()
           
 Iterator<Subtag> iterator()
           
 int length()
           
 boolean matches(Lang lang)
          True if the lang tag matches this range
 boolean matches(Lang lang, boolean extended)
          True if the lang tag matches this range
 boolean matches(String lang)
          True if the lang tag matches this range
 boolean matches(String lang, boolean extended)
          True if the lang tag matches this range
static boolean matches(String range, Lang lang)
          True if the lang tag matches the range.
static boolean matches(String range, Lang lang, boolean extended)
          True if the lang tag matches the range.
static boolean matches(String range, String lang)
          True if the lang tag matches the range.
static boolean matches(String range, String lang, boolean extended)
          True if the lang tag matches the range.
static Range parse(String range)
          Parse the language-range
static Range parse(String range, boolean extended)
          Parse the language-range
 Subtag[] toArray()
           
 Range toBasicRange()
          Create a basic language-range from this range
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

primary

protected final Subtag primary
Constructor Detail

Range

public Range(String range,
             boolean extended)
Create a Language-Range

Parameters:
range - The language-range
extended - true if this is an extended language range

Range

public Range(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 tag
extended - true if this is an extended language-range
Method Detail

append

public Range append(Subtag subtag)
Append a subtag to the range


appendWildcard

public Range appendWildcard()
Append a wildcard subtag to the range


clone

public Range clone()
Copy this range

Overrides:
clone in class Object

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(String lang)
True if the lang tag matches this range


matches

public boolean matches(String lang,
                       boolean extended)
True if the lang tag matches this range

Parameters:
lang - The language tage
extended - 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 tage
extended - 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 String[] filter(String... lang)
Filter the given set of lang tags. Return an array of matching tags


filter

public static Lang[] filter(String range,
                            Lang... lang)
Filter the given set of lang tags. Return an array of matching tags


filter

public static String[] filter(String range,
                              String... lang)
Filter the given set of lang tags. Return an array of matching tags


matches

public static boolean matches(String range,
                              Lang lang,
                              boolean extended)
True if the lang tag matches the range.

Parameters:
range - The language-range
lang - The language tag
extended - true to use extended match rules

matches

public static boolean matches(String range,
                              Lang lang)
True if the lang tag matches the range.

Parameters:
range - The language-range
lang - The language tag
extended - true to use extended match rules

matches

public static boolean matches(String range,
                              String lang,
                              boolean extended)
True if the lang tag matches the range.

Parameters:
range - The language-range
lang - The language tag
extended - true to use extended match rules

matches

public static boolean matches(String range,
                              String lang)
True if the lang tag matches the range.

Parameters:
range - The language-range
lang - The language tag
extended - true to use extended match rules

parse

public static Range parse(String range)
Parse the language-range


parse

public static Range parse(String range,
                          boolean extended)
Parse the language-range

Parameters:
range - The language-range
extended - true to use extended language rules

toString

public String toString()
Overrides:
toString in class Object

iterator

public Iterator<Subtag> iterator()
Specified by:
iterator in interface Iterable<Subtag>

contains

public boolean contains(Subtag subtag)

contains

public boolean contains(String tag)

contains

public boolean contains(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:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toArray

public Subtag[] toArray()

asList

public List<Subtag> asList()

compareTo

public int compareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)
Specified by:
compareTo in interface Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.