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

LanguageQualifier

public final class LanguageQualifier extends ResourceQualifier
Resource Qualifier for Language.

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

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

        if (qualifier instanceof LanguageQualifier) {
            if (mValue == null) {
                return ((LanguageQualifier)qualifier).mValue == null;
            }
            return mValue.equals(((LanguageQualifier)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 LanguageQualifier} object.

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

        String segment = value.toLowerCase();
        if (sLanguagePattern.matcher(segment).matches()) {
            return segment;
        }
        
        return null;
    
public org.eclipse.swt.graphics.ImagegetIcon()

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

        return NAME;
    
public static com.android.ide.eclipse.editors.resources.configurations.LanguageQualifiergetQualifier(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 LanguageQualifier} object or null

    
                                              
         
        if (sLanguagePattern.matcher(segment).matches()) {
            LanguageQualifier qualifier = new LanguageQualifier();
            qualifier.mValue = segment;
            
            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.

        if (mValue != null) {
            return getFolderSegment(mValue);
        }

        return ""; //$NON-NLS-1$