FileDocCategorySizeDatePackage
RegionQualifier.javaAPI DocAndroid 1.5 API4038Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors.resources.configurations

RegionQualifier

public final class RegionQualifier extends ResourceQualifier
Resource Qualifier for Region.

Fields Summary
private static final Pattern
sRegionPattern
public static final String
NAME
private String
mValue
Constructors Summary
Methods Summary
public booleancheckAndSet(java.lang.String value, FolderConfiguration config)

        RegionQualifier qualifier = getQualifier(value);
        if (qualifier != null) {
            config.setRegionQualifier(qualifier);
            return true;
        }
        
        return false;
    
public booleanequals(java.lang.Object qualifier)

        if (qualifier instanceof RegionQualifier) {
            if (mValue == null) {
                return ((RegionQualifier)qualifier).mValue == null;
            }
            return mValue.equals(((RegionQualifier)qualifier).mValue);
        }
        
        return false;
    
public static java.lang.StringgetFolderSegment(java.lang.String value)
Returns the folder name segment for the given value. This is equivalent to calling {@link #toString()} on a {@link RegionQualifier} object.

param
value the value of the qualifier, as returned by {@link #getValue()}.

        if (value != null) {
            String segment = "r" + value.toUpperCase(); //$NON-NLS-1$
            if (sRegionPattern.matcher(segment).matches()) {
                return segment;
            }
        }
            
        return "";  //$NON-NLS-1$
    
public org.eclipse.swt.graphics.ImagegetIcon()

        return IconFactory.getInstance().getIcon("region"); //$NON-NLS-1$
    
public java.lang.StringgetName()

        return NAME;
    
public static com.android.ide.eclipse.editors.resources.configurations.RegionQualifiergetQualifier(java.lang.String segment)
Creates and returns a qualifier from the given folder segment. If the segment is incorrect, null is returned.

param
segment the folder segment from which to create a qualifier.
return
a new {@link RegionQualifier} object or null

    
                                              
         
        Matcher m = sRegionPattern.matcher(segment);
        if (m.matches()) {
            RegionQualifier qualifier = new RegionQualifier();
            qualifier.mValue = m.group(1);

            return qualifier;
        }
        return null;
    
public java.lang.StringgetShortName()

        return NAME;
    
public java.lang.StringgetStringValue()

        if (mValue != null) {
            return mValue;
        }
        
        return ""; //$NON-NLS-1$
    
public java.lang.StringgetValue()

        if (mValue != null) {
            return mValue;
        }
        
        return ""; //$NON-NLS-1$
    
public inthashCode()

        if (mValue != null) {
            return mValue.hashCode();
        }
        
        return 0;
    
public booleanisValid()

        return mValue != null;
    
public java.lang.StringtoString()
Returns the string used to represent this qualifier in the folder name.

        return getFolderSegment(mValue);