FileDocCategorySizeDatePackage
DynamicIdMap.javaAPI DocAndroid 5.1 API2398Thu Mar 12 22:22:44 GMT 2015com.android.layoutlib.bridge.util

DynamicIdMap

public class DynamicIdMap extends Object

Fields Summary
private final Map
mDynamicIds
private final android.util.SparseArray
mRevDynamicIds
private int
mDynamicSeed
Constructors Summary
public DynamicIdMap(int seed)


       
        mDynamicSeed = seed;
    
Methods Summary
public java.lang.IntegergetId(com.android.resources.ResourceType type, java.lang.String name)
Returns a dynamic integer for the given resource type/name, creating it if it doesn't already exist.

param
type the type of the resource
param
name the name of the resource
return
an integer.

        return getId(Pair.of(type, name));
    
public java.lang.IntegergetId(com.android.util.Pair resource)
Returns a dynamic integer for the given resource type/name, creating it if it doesn't already exist.

param
resource the type/name of the resource
return
an integer.

        Integer value = mDynamicIds.get(resource);
        if (value == null) {
            value = ++mDynamicSeed;
            mDynamicIds.put(resource, value);
            mRevDynamicIds.put(value, resource);
        }

        return value;
    
public voidreset(int seed)

        mDynamicIds.clear();
        mRevDynamicIds.clear();
        mDynamicSeed = seed;
    
public com.android.util.PairresolveId(int id)

        return mRevDynamicIds.get(id);