com.google.gwt.i18n.server
Class RegionInheritance

java.lang.Object
  extended by com.google.gwt.i18n.server.RegionInheritance

public class RegionInheritance
extends java.lang.Object

Generated maps of regions into parent regions, used for locale inheritance. TODO(jat): make this actually be generated.


Constructor Summary
RegionInheritance()
           
 
Method Summary
static java.lang.String findCommonParent(java.lang.String region1, java.lang.String region2)
          Finds the first region which is a common parent of two regions.
static java.util.List<java.lang.String> getAllAncestors(java.lang.String child)
          Returns a set of all ancestors of a given region, including the region itself, in order of inheritance (ie, this region first, top-most region last).
static java.util.Set<java.lang.String> getImmediateParents(java.lang.String region)
          Returns the set of immediate parents of a given region, not including this region.
static boolean isParentOf(java.lang.String parent, java.lang.String child)
          Returns true if parent is equal to the child or is an ancestor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegionInheritance

public RegionInheritance()
Method Detail

findCommonParent

public static java.lang.String findCommonParent(java.lang.String region1,
                                                java.lang.String region2)
Finds the first region which is a common parent of two regions. If either region is null or if there is no common parent, returns null. Otherwise, returns the region which contains both regions.

Parameters:
region1 -
region2 -
Returns:
common parent or null if none

getAllAncestors

public static java.util.List<java.lang.String> getAllAncestors(java.lang.String child)
Returns a set of all ancestors of a given region, including the region itself, in order of inheritance (ie, this region first, top-most region last).

Parameters:
child -
Returns:
list of ancestors

getImmediateParents

public static java.util.Set<java.lang.String> getImmediateParents(java.lang.String region)
Returns the set of immediate parents of a given region, not including this region.

Parameters:
region -
Returns:
set of immediate parents

isParentOf

public static boolean isParentOf(java.lang.String parent,
                                 java.lang.String child)
Returns true if parent is equal to the child or is an ancestor. If both are null, true is returned; otherwise if either is null false is returned.

Parameters:
parent -
child -
Returns:
true if parent is an ancestor of child