Package org.gwtproject.i18n.processor
Class RegionInheritance
java.lang.Object
org.gwtproject.i18n.processor.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
Constructors Constructor Description RegionInheritance() -
Method Summary
Modifier and Type Method Description static java.lang.StringfindCommonParent(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 booleanisParentOf(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
RegionInheritance
public RegionInheritance()
-
-
Method Details
-
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
-